Showing posts with label ProjectCHIP. Show all posts
Showing posts with label ProjectCHIP. Show all posts

Thursday, August 4, 2022

How to setup and build Matter/CHIP EFR32 Lighting Example on Ubuntu 20.04.

The following steps show you how to setup and build Matter/CHIP EFR32 Lighting Example on Ubuntu 20.04.

1. Install necessary packages.

sudo apt-get install -y git gcc g++ pkg-config libssl-dev libdbus-1-dev libglib2.0-dev libavahi-client-dev ninja-build python3-venv python3-dev python3-pip unzip libgirepository1.0-dev libcairo2-dev libreadline-dev
 
2. Get Matter/CHIP source codes.

git clone --recurse-submodules https://github.com/project-chip/connectedhomeip
 

3. Enter Matter/CHIP source folder and build Matter/CHIP EFR32 Lighting Example


    3.1 run "cd connectedhomeip/"
 
    3.2 run "source scripts/activate.sh"
 
    3.3 run "./scripts/examples/gn_efr32_example.sh ./examples/lighting-app/efr32/ ./out/lighting-app BRD4161A"

 

4. Get chip-efr32-lighting-example.s37 under /connectedhomeip/out/lighting-app/BRD4161A to program it via Simplicity Flash Programmer or Commander.


5. You can see QR code on BRD4001A LCD and execute CLI command on serial console.

Tuesday, June 29, 2021

What does Matter (formerly Project CHIP) matter?

The Zigbee Alliance officially opened the Project Connected Home over IP (Project CHIP) Working Group on January 17, 2020 and is in the process of drafting the specification. Recently, Zigbee Alliance renames itself as Connectivity Standards Alliance (CSA) and Project CHIP as "Matter". From any perspective, it's ambitious to announce and developing such a big picture to provide an Unifying, Interoperable, Ecosystem-Flexible, Easy to Use, Secure,..etc. solution in IOT world. 

Here, I would like to share my thoughts about "Matter". 

First of all, "Matter" is not equal to Thread protocol. "Matter" is application protocol and Thread is wireless IPv6 network protocol. "Matter" can run on any TCP/UDP going through IPv6 network protocols which is not limited to Thread.

Next, let's go to some other points:

Unifying/Interoperable/Ecosystem-Flexible/Easy to Use: This is the most primitive of Matter and let's have a look at the following CHIP pyramid.

 

Basically, Matter is an application protocol and I would say it is unified/interoperable in application point of view. Since Matter can run on TCP/UDP going through IPv6, there are different physical protocols, such as Thread/802.15.4, WiFi, Ethernet, or even BLE to provide such IPv6 capability. Let's imagine you buy a Smart Home gadget which claims it's Matter certified but doesn't mention which physical network protocol it use or it just mentions using Thread protocol. I would say any generic user won't know much about how to add such gadget into an existing Smart Home system. 

My point is Matter might unify application protocol but interoperability might be still an issue if different Matter devices use different physical network connection. Don't mean to add confusion but you must know you still need something like border router to forward or routing everything together.

For different ecosystems such as Google Nest and Apple HomeKit, I still don't see a clear picture that Matter can work to each other smoothly and seamlessly. Hopefully, I will see how different ecosystems work together soon and how easy-to-use of this.

Secure: since Matter runs on TCP/UDP going through IPv6, it's no problem to leverage modern security practices and protocols such as TLS/DTLS. However, most of IOT devices don't use secure boot and secure element to provide hardware/firmware protection. From my personal point of view, secure boot and security vault, such as Silicon Labs EFR32 series 2 chip provides, would be necessary to provide complete protection not only from protocol side itself.

Federated: No single entity serves as a throttle or a single-point-of-failure for root of trust but I think this is more related to Thread Protocol instead of Matter (maybe I am wrong).

Low Overhead: The alliance claims the protocols are practically implementable on low compute-resource devices, such as MCUs. From personal perspective, the minimal RAM/Flash footprint and MCU computing power are still larger than other low power wireless protocols such as Zigbee and Z-Wave.

Pervasive: The protocols are broadly deployable and accessible, thanks to leveraging IP and being implementable on low-capability devices.But, I would say current low-capability devices is not such low capability as you imagine now. Current SOC for Thread/Matter is very powerful from my point of view. For your reference, Zigbee and Z-Wave devices still can run on 8051 based MCU until today.

In the end, this is about benefiting/improving user experiences for anyone using IOT/Smart Home gadgets. Matter reveals a respectful vision to developing and achieving it. Hopefully, we can see it soon on the market.

 

Wednesday, February 24, 2021

Project Connected Home over IP (ProjectCHIP) demonstration with EFR32 as ProjectCHIP node, Raspberry Pi as OTBR, and Ubuntu VM as chip-tool

 The follow steps show you how to setup Project Connected Home over IP (ProjectCHIP) demonstration with EFR32 as ProjectCHIP node, Raspberry Pi as OTBR, and Ubuntu VM as chip-tool like in the diagram.



1. Install VirtualBox and Ubuntu 20.04 on your Desktop. Remember select "Bridged Adapter" in your network settings of VirtualBox/Ubuntu.

2. Setup environment (run the following commands in Ubuntu terminal) for building CHIP examples on Ubuntu VM.

    2.1 sudo apt-get install git gcc g++ python pkg-config libssl-dev libdbus-1-dev libglib2.0-dev libavahi-client-dev ninja-build python3-venv python3-dev unzip

    2.2.1 cd ~
    2.2.2 git clone https://github.com/SiliconLabs/sdk_support.git
    2.2.3 cd sdk_support
    2.2.4 git checkout ff45be117a5a1a20d27296628b0632523f65c66a

    2.3.1 cd ~
    2.3.2 git clone https://github.com/project-chip/connectedhomeip.git
    2.3.3 cd connectedhomeip
    2.3.4 git checkout 122da92801fd38f49b8fe3db397ccaa4eb0e4798
    2.3.5 source scripts/activate.sh
    2.3.6 gn gen out/host
    2.3.7 ninja -C out/host

3. Build and download CHIP lock-app for EFR32 (In my examples, I use BRD4180A with BRD4001A to act as Thread node running CHIP protocol)

    3.1 cd ~/connectedhomeip/examples/lock-app/efr32
    3.2 git submodule update --init
    3.3 source third_party/connectedhomeip/scripts/activate.sh
    3.4 export EFR32_SDK_ROOT=~/sdk_support
    3.5 export EFR32_BOARD=BRD4180A
    3.6 gn gen out/debug --args="efr32_sdk_root=\"${EFR32_SDK_ROOT}\" efr32_board=\"${EFR32_BOARD}\""
    3.7 ninja -C out/debug
    3.8 Using Simplicity Studio Commander to download chip-efr32-lock-example.s37 under out/debug folder into BRD4180A.

4. Refer to "Running OpenThread Border Router and device with Raspberry Pi and Silicon Labs EFR32 Kits" to setup OpenThread Border Router on Raspberry Pi.

5. Run the following commands in OpenThread Border Router terminal to setup Thread network for commission.

    5.1.1 sudo ot-ctl dataset init new
    5.1.2 sudo ot-ctl dataset channel 13
    5.1.3 sudo ot-ctl dataset panid 0xface
    5.1.4 sudo ot-ctl dataset extpanid face1111face2222
    5.1.5 sudo ot-ctl dataset networkname OpenThreadYKTest
    5.1.6 sudo ot-ctl dataset masterkey 00112233445566778899aabbccddeeff
    5.1.7 sudo ot-ctl dataset commit active

    5.2.1 sudo ot-ctl prefix add 2001:db8::/64 pasor
    5.2.2 sudo ot-ctl ifconfig up
    5.2.3 sudo ot-ctl thread start
    5.2.4 sudo ot-ctl netdata register
    5.2.5 sudo ot-ctl state
    5.2.6 sudo ot-ctl ipaddr


    5.3.1 sudo ip addr add dev eth0 2002::2/64

 
6. Run the following commands on terminal of EFR32 CHIP lock-app device (build and download in step 3)

    6.1 factoryreset
    6.2 dataset channel 13
    6.3 dataset panid 0xface
    6.4 dataset masterkey 00112233445566778899aabbccddeeff
    6.5 dataset commit active
    6.6 ifconfig up
    6.7 thread start
    6.8 ipaddr

7. Try to ping EFR32 CHIP lock-app device from Raspberry Pi border router to make sure it respond.


8. Add route (enp0s3 might be different on your VM) on Ubuntu VM to access to EFR32 CHIP lock-app device

    8.1 sudo ifconfig enp0s3 inet6 add 2002::1/64
    8.2 sudo ip route add 2001:db8:0:0::/64 via 2002::2
    8.3 sudo ip route add fd38:117c:3b66::/64 via 2002::2


     8.4Try to ping EFR32 CHIP lock-app device from Ununtu VM terminal this time to make sure it respond.

 


9. Build and run chip-tool on Ubuntu VM

    9.1 cd ~/connectedhomeip/examples/chip-tool
    9.2 git submodule update --init
    9.3 source third_party/connectedhomeip/scripts/activate.sh
    9.4 gn gen out/debug
    9.5 ninja -C out/debug

    9.6 run "./chip-tool onoff on 2001:DB8::C6CC:14E9:E7D1:A3EA 11097 1" to send onoff command on Ubuntu VM terminal to control EFR32 CHIP lock-app device

 


    9.7 Using J-link RTT Viewer to check if EFR32 CHIP lock-app device receives CHIP command.


P.S. This demostartion is based on steps in https://www.silabs.com/documents/public/training/wireless/chip-connected-home-over-ip-lab.pdf. However, there are some typo and ambiguous in the document and here I share the whole steps again according to my test.