Zigbee Protocol Controller 1.6.0
|
For this guide you need :
Easy to install tools :
Clone the unify git repo :
git clone https://github.com/SiliconLabs/UnifySDK.git
Initialise the git submodules of the repo : git submodule update --init --recursive
Get a copy of the GSDK
github.com/SiliconLabs/gecko_sdk
public repo :
git clone https://github.com/SiliconLabs/gecko_sdk
You need to add the GSDK location to your environment variable GSDK_LOCATION
See also : Specific build instruction /projects/UIC/repos/uic/browse/doc/build_instructions.internal.md
After having installed docker desktop
To build and cross compile stuff ( inside host shell )
From the uic repository /docker folder : To create new container for specific architectures : ./build_docker.sh <architecture> <container_name>
EX : For the Pi ./build_docker.sh arm64 uic_arm64
Ex : To run unit test ./build_docker.sh amd64 uic_amd64
Once the docker script is done : From the uic root folder run :
Using the Raspberry Pi Imager, select the latest 64 bit Rasbian OS. In advanced options of the Imager (Click the gear icon after selecting the OS), enable ssh, set username and password, hostname, enable wifi.
Add mosquitto to the system:
Install the packages from latest release :
Get the latest packages from the develop branch :
https://github.com/SiliconLabs/UnifySDK/releases
Install them using (change name as required ) :
See user guide for more info : /projects/UIC/repos/uic/browse/doc/readme_user.md
For future MQTT Explorer use, add those lines to /etc/mosquitto/mosquitto.conf
On the development computer :
Go back to uic folder and enter your docker container using the previous docker run command (See Docker Setup). Set up the cmake build folder using :
Notice that this is telling cmake to use the specific target architecture ( arm64 ) toolchain and to enable debug symbol for future debugging.
If you want to reduce build time, you can specifically build a specific component :
Since Simplicity Studio adds time to this process, we will try to skip its usage. Be aware that you can generate new firmware with specific cluster using Simplicity Studio or by modifying the slcp file and then generating using the slc tool.
Thus, we will use the slc command line tool to create the firmware for the ncp.
Related user guide : https://www.silabs.com/documents/public/user-guides/ug520-software-project-generation-configuration-with-slc-cli.pdf
Follow the user guide installation process in order to install the tool, then add the slc folder to your system environment path.
You can find Zigbee sample apps for the ncp in the Gecko SDK folder under gecko-sdk/protocol/zigbee/app/ncp/sample-app/ncp-uart-hw
The Boatloader is under gecko-sdk/platform/bootloader/sample-apps/bootloader-storage-spiflash
In order to get the .s37 executable for the boatloader and the zigbee application :
Example board identifier Thunderboard sense 2 : brd4166a
Note : To synchronise the device and the gateway address table. add under define in the <NCP-NAME>.slcp
This value must match EMBER_AF_PLUGIN_ADDRESS_TABLE_SIZE in zigpc/components/zigpc_gateway/libs/zigbee_host/gen/config
Once you have both .s37 files, flash using simplicity commander / Simplicity Studio
There are some common issues faced when updating to a new version of ZigPC or a new version of the GeckoSDK
After upgrading, it is possible to see ZigPC fail to start with the error:
ERROR: ezspErrorHandler 0x30
Or an equivalent error.
Usually this occurs because the version of the GeckoSDK on the gateway and the version on the NCP do not match. It's important that version matches so that the EZSP communication libraries are the same on both the host and the radio.
This issue can be resolved in 2 ways: downgrading the version of the GeckoSDK to match with the NCP or updating the NCP firmware to match the gateway.
To change the version of the GeckoSDK used by the gateway, download the desired version of the GeckoSDK and keep note of the directory it is stored in. By default, the provided Docker container downloads the latest version to the 'externals' folder in the uic project. This can be overridden by setting the "GSDK\_LOCATION" environment variable with the new GeckoSDK and re-compiling the ZigPC gateway.
To update the NCP firmware, re-generate the firmware as described above with the matching version of the GeckoSDK. If you have hardware access, re-flash the NCP as usual. However, if only remote access is possible, ZigPC can be used to update the NCP firmware as described in the User Guide (section 'Updating NCP Firmware'
When running the ZigPC, its possible for the gateway to fail to start with an error describing:
ASSERT addressTableSize mismatch
or a similar error.
Usually, this occurs because the address table size was not properly set in the NCP. Some information is shared between the gateway and the NCP, specifically related to the network information. In this case, the address table is used to resolve the global EUI64 with the short ID commonly used on zigbee networks. The size of these tables should match on both the gateway and NCP to ensure that no data is lost when handling too many devices.
There are two ways of solving this: reducing the address table on the gateway or increasing the address table size on the NCP.
The recommended method is to increase the address table size on the NCP. This can be done by adding the "EMBER\_ADDRESS\_TABLE\_SIZE" to the .slcp file, as described in the section above. Alternatively, add a definition to the NCP makefile setting the above define. Compiling with -DEMBER_ADDRESS_TABLE_SIZE= 32 will also work.
It is possible to solve this by reducing EMBER_AF_ADDRESS_TABLE_SIZE on the gateway, however this is NOT recommended as it can reduce the number of devices that ZigPC will support
From phase 6 you should now have the ability to generate custom zigpc executables.
Transfer them to the pi using FileZila or scp.
make sure that no uic-zigpc from previously installed package are running using (use killall if need be)
>Note : zigpc should not usually be runned as superuser. There is currently a bug in datastore that forces this issue.
You should now be able to access the devgui of the gateway under raspberrypi.local:3080
For more information about the devgui see : /projects/UIC/repos/uic/browse/applications/dev_ui/dev_gui/readme_user.md
Debugging using visual studio code : Install native debug extension : https://marketplace.visualstudio.com/items?itemName=webfreak.debug
Create a code workspace containing both the Gecko SDK folder and the UIC folder
As the Launch.json use :
On the Pi install gdbserver
Cleaning the code : To clang format in zigpc (Modify path as needed)