Project CHIP

Relates to #

Overview #

The image above does only focus on the relation between CHIP, Thread and Zigbee. Both CHIP and Zigbee run on 802.15.4 (optional for CHIP), and both are directly or indirectly based on ZCL which is in case of CHIP named ZAP Zigbee Cluster Library Advanced Platform.

Definition #

We can consider the project CHIP Connected Home Over IP definition as in two folds :

  • a takeover of the Zigbee Cluster Library to be fit over the IP layer.
  • The abstraction of all different transport protocols with IP

This will avoid that each transport (e.g. BT, Zigbee) have a custom app layer. It is interesting to notice that the Zigbee Alliance is driving this project whereas Zigbee itself does not map to an IP layer, and therefore Thread is the natural transition from Zigbee as both are 802.15.4 compliant at the bottom and both will keep the same logic of the ZCL that devices are familiar with.

Tools #

ZAP : ZCL Advaned Platform

ZCL : Zigbee Cluster Library

on windows install with node v14.15.1 failed, errors after manuall install of GTK filed an issue

on linux the following commands succeed using node v14.15.5 :

  npm uninstall node-pre-gyp --save
  npm install @mapbox/node-pre-gyp --save

  npm install
  npm run zap

Running on nRF52 #

nRF Connect integration #

The above diagram taken from the CHIP repo link in the button below, shows the integration of a CHIP application on top of the nRF Connect SDK.

The MPSL is only required if needed to combine both bluetooth and Thread. Also the softDevice is only needed for bluetooth but not for Thread.

Note that zephyr and connectedhomeip will be managed as ncs dependencies with west from nrf/west.yml

install #

mkdir ~/ncs && cd ~/ncs
west init -m --mr v1.4.0
west update
west zephyr-export
pip3 install --user -r zephyr/scripts/requirements.txt
pip3 install --user -r nrf/scripts/requirements.txt
pip3 install --user -r bootloader/mcuboot/scripts/requirements.txt

then on every new session

cd ncs
source zephyr/
  • step 3, from the same link above install gn

lighting app #

  • Update prj.conf params to match the thread border router parametrs (e.g. channel,…)
cd ncs/modules/lib/connectedhomeip/examples/lighting-app/nrfconnect/
west build -b nrf52840dongle_nrf52840 -t menuconfig
west build -b nrf52840dongle_nrf52840 -- -DCONF_FILE="prj.conf"
west flash
nrfjprog -f nrf52 --program zephyr.hex --sectorerase --verify

note on config :

  • the RTT logging is enabled to get the log through the SWD Segger J-Link interface, see # Logging section
  • as CHIP is running over zephyr, a zephyr shell is provided alo through the RTT with config on the # shell section
  • the shown CONFIG_OPENTHREAD_MASTERKEY is a dummy key and has to be kept secret in a production environment
#    Copyright (c) 2020 Project CHIP Authors
#    Licensed under the Apache License, Version 2.0 (the "License");
#    you may not use this file except in compliance with the License.
#    You may obtain a copy of the License at
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.

# This sample uses sample-defaults.conf to set options common for all
# samples. This file should contain only options specific for this sample
# or overrides of default values.

# Add support for LEDs and buttons on Nordic development kits

# Default OpenThread network settings

# Bluetooth overrides

# Additional configs for debbugging experience.

# CHIP configuration


# Logging

# shell

The log output is then as follows

RTT Log output
I: nRF5 802154 radio initialized
I: 4 Sectors of 4096 bytes
I: alloc wra: 0, ec0
I: data wra: 0, 227
*** Booting Zephyr OS build v2.4.99-ncs1-rc1  ***
I: Init CHIP stack
I: SoftDevice Controller build revision: 
I: e5 c7 9c d9 91 00 1d 66 |.......f
I: ea fb 6e 7b 98 2f 42 0d |..n{./B.
I: f1 60 93 c8             |.`..    
I: Starting CHIP task
I: Init Thread stack
D: 593[DL] CHIP task running
D: 594[DL] In DriveBLEState
I: 614[DL] CHIPoBLE advertising disabled because device is fully provisioned
D: 615[DL] OpenThread State Changed (Flags: 0x0100103d)
D: 616[DL]    Device Role: DETACHED
D: 617[DL]    Thread Unicast Addresses:
D: 618[DL]         fdb0:f51f:154a:11be:0:ff:fe00:f002/64 valid preferred rloc
D: 620[DL]         fdb0:f51f:154a:11be:2294:a147:3648:185d/64 valid preferred
D: 621[DL]         fe80::4b5:84fc:320f:d2/64 valid preferred
I: 830[DL] OpenThread ifconfig up and thread start
I: 832[DL] OpenThread started: OK
I: 832[DL] Setting OpenThread device type to MINIMAL END DEVICE
I: 834[ZCL] Using ZAP con

Upon reset, more details in the log with regard to SetupQRCode

RTT Log output after reset
I: nRF5 802154 radio initialized
I: 4 Sectors of 4096 bytes
I: alloc wra: 0, 9c0
I: data wra: 0, 885
*** Booting Zephyr OS build v2.4.99-ncs1-rc1  ***
I: Init CHIP stack
I: SoftDevice Controller build revision: 
I: e5 c7 9c d9 91 00 1d 66 |.......f
I: ea fb 6e 7b 98 2f 42 0d |..n{./B.
I: f1 60 93 c8             |.`..    
I: Starting CHIP task
I: Init Thread stack
I: 647[DL] OpenThread ifconfig up and thread start
I: 648[DL] OpenThread started: OK
I: 648[DL] Setting OpenThread device type to MINIMAL END DEVICE
I: 650[ZCL] Using ZAP configuration...
I: 651[ZCL] deactivate report event
I: 651[ZCL] Cluster callback: 6
I: 652[ZCL] Cluster callback: 8
I: 653[ZCL] Value: 255, length 1
D: 654[IN] TransportMgr initialized
I: 654[IN] local node id is lu

D: 655[IN] New pairing for device lu, key 112233!!
I: 657[SVR] Received a new connection.
I: 670[SVR] Network already provisioned. Disabling BLE advertisement
I: 672[SVR] Server Listening...
I: 672[DL] Device Configuration:
I: 682[DL]   Serial Number: (not set)
I: 682[DL]   Vendor Id: 9050 (0x235A)
I: 683[DL]   Product Id: 65279 (0xFEFF)
I: 693[DL]   Product Revision: 1
I: 702[DL]   Setup Pin Code: 12345678
I: 711[DL]   Setup Discriminator: 3840 (0xF00)
I: 721[DL]   Manufacturing Date: (not set)
I: 739[SVR] SetupQRCode:  [CH:I34DV*-00 0C9SS0]
I: 740[SVR] Copy/paste the below URL in a browser to see the QR Code:
I: 741[SVR]
D: 743[DL] CHIP task running
D: 744[DL] In DriveBLEState
I: 757[DL] CHIPoBLE advertising disabled because device is fully provisioned
D: 759[DL] OpenThread State Changed (Flags: 0x1100107d)
D: 760[DL]    Device Role: DETACHED
D: 761[DL]    Thread Unicast Addresses:
D: 762[DL]         fdde:ad00:beef:0:1e65:2162:2d83:6133/64 valid preferred
D: 763[DL]         fe80::2c53:1780:f20f:23ad/64 valid preferred

Example shell commands execution on the RTT

RTT shell commands and output
rtt:~$ ot masterkey


rtt:~$ kernel threads
Scheduler: 104 since last call
 0x200048e0 CHIP      
  options: 0x0, priority: -1 timeout: 536889700
  state: pending
  stack size 8192, unused 7104, usage 1088 / 8192 (13 %)

 0x20002e40 SDC RX    
  options: 0x0, priority: -10 timeout: 536882884
  state: pending
  stack size 1024, unused 832, usage 192 / 1024 (18 %)

 0x20002588 BT RX     
  options: 0x0, priority: -8 timeout: 536880652
  state: pending
  stack size 1024, unused 832, usage 192 / 1024 (18 %)
rtt:~$ ot panid 0x1234

D: 2488290[DL] OpenThread State Changed (Flags: 0x30008000)
D: 2488291[DL]    Network Name: ot_zephyr
D: 2488292[DL]    PAN Id: 0x1234
D: 2488293[DL]    Extended PAN Id: 0xDEAD00BEEF00CAFE
D: 2488294[DL]    Channel: 11
D: 2488295[DL]    Mesh Prefix: fdde:ad00:beef::/64

Running on ESP32 #

Comissioning #

Each device will generate a setup QR Code, in this case CH:I34DV*-00 0C9SS0 which is a sectret not to be shared for production devices.

QR code generators services are abundant, but for production devices, better not to use an online generator and rely on an offline one to minimize risks. In order to facilitate the creation, an url is provided where the string to be converted is passed as argument in the data= param to an app that cretates the QR code on the page :

using an Android App #

FAQ - Discussion #

If you need support, want to ask a question or suggest a different answer, you can join the discussion on the discord server

Is CHIP yet another invention to push consumers into buing new products ?
  • I do not think so. If existing devices have their own gateway and consumers already have them, there’s no need to update.
  • If a user now buys a new product with the new technology (CHIP, Thread), its integration should not require a vendor specific gateway, this is an advantage for the user. This dissolves the lockin to a particular device supplier which is also for the users benefit.
Will CHIP replace zigbee ?
  • For new products, I would expect more CHIP devices in the future than zigbee, although this is a bet that depends on how hard the transition is. Given that the underlying RF physical layer is the same 802.15.4, hardware suppliers have no excuses about hardware incompatibilities.
  • Software is not an easy task, for already deployed devices, this will depend on the reliability of the firmware update, and if old devices do have enough capacity for a bigger sw stack. For new devices, all of the software stack is available as opensouce and any startup or maker can use it as described in this page.
  • Even if new products would have CHIP exclusively, the provided solutions will have to allow cohabitation of CHIP/Thread and zigbee for a long time. This is possible through usage of different channels or even the same with different network ids.
  • Combining a multi protocol gateway for both Thread and Zigbee is an interesting idea that I have not see, but it could reduce the gateways that have to stay deployed. It would require multiple Radio Co Processors though to allow operation in different channels.