An example showing the use of CHIP on the Silicon Labs SiWx917 SoC device.
NOTE: Silicon Laboratories now maintains a public matter GitHub repo with frequent releases thoroughly tested and validated. Developers looking to develop matter products with silabs hardware are encouraged to use our latest release with added tools and documentation. Silabs Matter Github
The SiWx917 light switch example provides a baseline demonstration of an on-off light switch device, built using Matter, the Silicon Labs Gecko SDK, and the Silicon Labs WiseMCU SDK. It can be controlled by a Chip controller over a Wi-Fi network.
The SiWx917 device can be commissioned over Bluetooth Low Energy where the device and the Chip controller will exchange security information with the rendezvous procedure. Wi-Fi Network credentials are then provided to the SiWx917 device which will then join the Wi-Fi network.
If the LCD is enabled, the LCD on the Silabs WSTK shows a QR Code containing the needed commissioning information for the BLE connection and starting the rendezvous procedure.
The light switch example is intended to serve both as a means to explore the workings of Matter as well as a template for creating real products based on the Silicon Labs platform.
Download the Simplicity Commander command line tool, and ensure that commander
is your shell search path. (For Mac OS X, commander
is located inside Commander.app/Contents/MacOS/
.)
Download and install a suitable ARM gcc tool chain: GNU Arm Embedded Toolchain 9-2019-q4-major
Install some additional tools(likely already present for CHIP developers):
$ sudo apt-get install git ninja-build
$ brew install ninja
Supported hardware:
For the latest supported hardware please refer to the Hardware Requirements in the Silicon Labs Matter Github Repo
Build the example application:
cd ~/connectedhomeip ./scripts/examples/gn_efr32_example.sh ./examples/light-switch-app/silabs/SiWx917/ ./out/light-switch-app BRD4325B
To delete generated executable, libraries and object files use:
$ cd ~/connectedhomeip $ rm -rf ./out/
Flashing requires the SiWx917 SoC device to be configured in the Ozone Debugger.
Once it's configured, it can be run with the Ozone Debugger by loading the .out file.
For detailed instructions, please refer to Running the Matter Demo on SiWx917 SoC in the Silicon Labs Matter Github Repo
The example application's logging output can be viewed in the Ozone Debugger.
You can provision and control the Chip device using the chip-tool standalone
Here is an example with the chip-tool for unicast commands only:
$SSID and $PSK are the SSID and passcode of your Wi-Fi Access Point.
chip-tool pairing ble-wifi 1122 $SSID $PSK 20202021 3840 chip-tool accesscontrol write acl '[{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [<chip-tool-node-id>], "targets": null }{"fabricIndex": 1, "privilege": 3, "authMode": 2, "subjects": [1], "targets": null }]' <lighting-node-id> 0 chip-tool binding write binding '[{"fabricIndex": 1, "node": <lighting-node-id>, "endpoint": 1, "cluster":6}]' 1 1
Here is an example with the chip-tool for groups commands only:
chip-tool pairing ble-wifi 1122 $SSID $PSK 20202021 3840 chip-tool tests TestGroupDemoConfig --nodeId 1 chip-tool tests TestGroupDemoConfig --nodeId <lighting-node-id> chip-tool binding write binding '[{"fabricIndex": 1, "group": 257}]' 1 1
To run the example with unicast and groups commands, run the group configuration commands and replace the last one with binding this command
chip-tool binding write binding '[{"fabricIndex": 1, "group": 257},{"fabricIndex": 1, "node": <lighting-node-id>, "endpoint": 1, "cluster":6} ]' 1 1
To acquire the chip-tool node id, read the acl table right after commissioning
./connectedhomeip/out/chip-tool/chip-tool accesscontrol read acl <nodeid> 0
$ sudo ip addr add dev <Network interface> 2002::1/64
#Add IPv6 route on PC(Linux) $ sudo ip route add /64 via 2002::2
While most of the RAM usage in CHIP is static, allowing easier debugging and optimization with symbols analysis, we still need some HEAP for the crypto and Wi-Fi stack. Size of the HEAP can be modified by changing the value of the configTOTAL_HEAP_SIZE
define inside of the FreeRTOSConfig.h file of this example. Please take note that a HEAP size smaller than 13k can and will cause an Mbedtls failure during the BLE rendezvous or CASE session
To track memory usage you can set enable_heap_monitoring = true
either in the BUILD.gn file or pass it as a build argument to gn. This will print on the RTT console the RAM usage of each individual task and the number of Memory allocation and Free. While this is not extensive monitoring you're welcome to modify examples/platform/silabs/SiWx917/MemMonitoring.cpp
to add your own memory tracking code inside the trackAlloc
and trackFree
function
All of Silabs's examples within the Matter repo have all the features enabled by default, as to provide the best end user experience. However some of those features can easily be toggled on or off. Here is a short list of options :
chip_progress_logging, chip_detail_logging, chip_automation_logging
$ ./scripts/examples/gn_efr32_example.sh ./examples/light-switch-app/silabs/SiWx917 ./out/light-switch-app BRD4325B "chip_detail_logging=false chip_automation_logging=false chip_progress_logging=false"
is_debug
$ ./scripts/examples/gn_efr32_example.sh ./examples/light-switch-app/silabs/SiWx917 ./out/light-switch-app BRD4325B "is_debug=false"
show_qr_code
$ ./scripts/examples/gn_efr32_example.sh ./examples/light-switch-app/silabs/SiWx917 ./out/light-switch-app BRD4325B "show_qr_code=false"
kvs_max_entries
Set the maximum Kvs entries that can be stored in NVM (Default 75) Thresholds: 30 <= kvs_max_entries <= 255 $ ./scripts/examples/gn_efr32_example.sh ./examples/light-switch-app/silabs/SiWx917 ./out/light-switch-app BRD4325B kvs_max_entries=50