Maker.io main logo

Getting Started With Matter Using Silicon Labs Dev Boards

2023-05-15 | By ShawnHymel

License: Attribution Raspberry Pi

Matter is an open standard that allows different IoT devices to communicate with each other across different networking technologies. Amazon, Apple, GE, Google, Samsung, and others have all announced plans to begin creating Matter-capable devices. As a result, we should see fewer vendor-locked ecosystems in the future, and you should hopefully expect future devices to all talk to each other, regardless of the manufacturer.

Matter relies on network endpoints that consist of servers and clients. Servers can host attributes (stateful values that can change), events (records of past state transitions), and commands (functions that perform actions). Clients connect to servers to request actions or information. Such endpoints can talk to each other across a variety of network stacks, including WiFi, Ethernet, and Thread (with 802.15.4 + 6LoWPAN). Bluetooth Low Energy (BLE) is used for commissioning new devices that wish to connect to a Matter network.

See this tutorial if you would like to learn more about Thread.

I highly recommend watching this video to learn more about how Matter works:

 

This tutorial will walk you through the process of setting up a simple Matter network using two Silicon Labs (SiLabs) development boards and controlling an LED remotely across the network. You can read more about how this demo works in this readme.

Required Hardware

To complete this demo, you will need two Thread-capable development boards from Silicon Labs. Several boards using the EFR32MGxx chipset will work. You can see the list of supported boards here. That being said, I recommend using two SiLabs xG24-DK2601B boards. You will also need a Raspberry Pi 4.

BRD2601B and Raspberry Pi 4

Configure Simplicity Studio

To start, download and install Simplicity Studio from here: https://www.silabs.com/developers/simplicity-studio. Note that you will need to create an account on the Silicon Labs site. Accept all the defaults and agreements during the installation process.

When the installation is done, you will be prompted for your login credentials. As you needed to make an account to download the software, go ahead and enter your SiLabs username and password. This will cause the Studio to install drivers–accept all defaults and agree to install the drivers.

Once done, plug in one of your development kits to your computer. I’ll start with the first EFR32xG24 Dev Kit. You should see a pop-up that asks you to install the Device Inspector.

Install packages for the BRD2601B

Click Yes. Accept all defaults during the installation process.

You should see the Installation Manager window. If you do not see this pop-up, select Help > Update Software

Install device packages

With the board still plugged in, select Install by connecting device(s). You should see the Installation Manager ask you to select a product. For the EFR32xG24, you should have the EFR32xG24 Dev Kit Board option selected. Click Next. You should then be asked to select a package option.

Install packages

Select Auto and click Next. On the following screen, accept the agreements and click Next to install the software development kits (SDKs) for that particular board. When it is done, you will be asked to restart the Studio. Accept any license agreements you see after the restart.

Download Firmware

Head to https://github.com/SiliconLabs/matter/releases. Scroll down to Assets in the latest release (version 1.0.5-1.0 at the time of writing). Download bootloader_binaries_x.x.x-y.y.zip, matter_accessory_device_images_x.x.x-y.y.zip, openthread_rcp_binaries_x.x.x-y.y.zip for that particular release. Note that you can also download the source code if you wish to modify these demos. Unzip all of these files.

Flash the Matter Accessory Device (MAD)

The MAD is our Matter endpoint that acts as our remotely controlled light. This could be a light bulb, lamp, or any other simple on/off device that you want to control over the network. For this example, we will use one of our Thunderboard Sense 2 (BRD2601B) as a Thread-controlled MAD.

Start Simplicity Studio and plug in one of your development boards. Under Debug Adapters, right-click on the board name and select Upload application. In the pop-up window, click the folder icon by Application image path and select matter_accessory_device_images_x.x.x_y.y/BRD2601B/lighting-app-no-lcd-thread.s37 (note that the exact name of this binary may change depending on the version).

Click to select Bootloader image. Click the folder icon and select bootloader_binaries_x.x.x-y.y/bootloader_binaries/bootloader-storage-internal-single-512k-BRD2601B-gsdk4.1.s37.

Click to select Erase chip before uploading image. Leave everything else as default.

Select lighting app and bootloader for MAD

Click OK. With any luck, you should see [STATUS: OK] in the Console, which indicates that flashing was successful. If you see any error, unplug your board, plug it back in, and repeat the steps above to try flashing the device again.

Flashing lighting app to MAD

Flash the Radio Co-Processor (RCP)

The RCP is attached to the Raspberry Pi and acts as a radio interface for the Matter Hub to communicate over Thread.

In Simplicity Studio, plug in your other development board. Under Debug Adapters, right-click on the board name and select Upload application. In the pop-up window, click the folder icon by Application image path and select openthread_rcp_binaries_1.0.5-1.0/ot-rcp_bins/ot-rcp2601b.s37. You do not need to select a bootloader for the RCP.

Click to select Erase chip before uploading image. Leave everything else as default.

Select RCP firmware to flash to BRD2601B

Click OK. As with the MAD, you should see [STATUS: OK] in the Console.

Flash the Raspberry Pi Image

Near the top of the release notes on https://github.com/SiliconLabs/matter/releases, you should see a link to the documentation (e.g. https://docs.silabs.com/matter/1.0.5/matter-start/). Follow that link, and select Getting Started > Matter Prerequisites > Artifacts. You should see a link to download the Matter Hub Image. For 1.0.5, this is here: https://www.silabs.com/documents/public/software/SilabsMatterPi.zip. Download and unzip this file.

Use the Raspberry Pi Imager software to flash the .img file found in that .zip.

Try the Demo

Plug the MAD into your host computer. We really just need to provide power to the device. However, if you would like to view the debug logs, you can connect to the MAD using the J-Link RTT Viewer application.

Plug the RCP into your Raspberry Pi, insert the SD card, and connect a keyboard, mouse, and monitor (if you know your Raspberry Pi’s IP address, you can also connect via SSH instead). I highly recommend connecting your Raspberry Pi to your home router using an Ethernet cable, as WiFi can be buggy with the Matter image.

Log in once the Raspberry Pi boots up. As of 1.0.5-1.0, use the following default credentials:

Copy Code
username: ubuntu
password: ubuntu

You will be asked to change the password on the first login. After you have logged in, ensure you have internet access by checking the interface and pinging Google’s DNS server:

Copy Code
ifconfig
ping 8.8.8.8

You should see successful ping responses.

Successful pings to Google DNS server

If you cannot access the Internet, you may need to add IPv6 DHCP (dhcp6) to /etc/netplan/50-cloud-init.yaml. See here for more information: https://askubuntu.com/questions/1029531/how-to-setup-a-static-ip-on-ubuntu-server-18-04.

When you run ifconfig, you should see an entry for wpan0. This is your RCP’s address. If you do not see wpan0, you should run:

Copy Code
sudo ifconfig wpan0 up
ifconfig

With that, you should see an entry for wpan0. Don’t worry if it has not been assigned an address yet: that should be assigned in the next step.

View wpan0 interface with ifconfig

Next, we’ll use the SiLabs mattertool, which is a wrapper for some chip-tool functions. This will allow us to create a new Thread network, commission the MAD onto the Thread network, and send our basic on/off commands to the MAD over Thread.

Start by running:

Copy Code
mattertool startThread

You should not see any errors after this completes.

Initializing Thread network on Raspberry Pi

Next, hold btn0 on the MAD for at least 6 seconds to factory reset the device. For the next few minutes after a factory reset, the MAD will accept BLE connections. Just after performing the factory reset, run the following on the Pi:

Copy Code
mattertool bleThread

You should see that the MAD has been commissioned.

mattertool bleThread success

This should use the Pi’s Bluetooth radio to connect to the MAD and commission it onto the Thread and Matter networks. From there, you can run the following commands to control the LED on the MAD.

Copy Code
mattertool on
mattertool off

BRD2601B Matter demo LED on

At this point, you should have full control over your remote LED using Matter and Thread! Note: on the BRD2601B, the green LED is controlled over Matter, and it shares the same RGB LED package as the red status LED. As a result, the red LED will turn yellow if the demo works correctly.

Troubleshooting

If you run into any of the following errors, it usually means that the Bluetooth on your Raspberry Pi cannot communicate with the MAD:

Copy Code
CHIP:IN: BleConnection Error: ../../examples/chip-tool/third_party/connectedhomeip/src/platform/Linux/BLEManagerImpl.cpp:63: CHIP Error 0x00000032: Timeout
Copy Code
CHIP:SC: PASESession timed out while waiting for a response from the peer. Expected message type was 33
Copy Code
CHIP:TOO: Secure Pairing Failed
Copy Code
CHIP:TOO: Pairing Failure: ../../examples/chip-tool/third_party/connectedhomeip/src/protocols/secure_channel/PASESession.cpp:245: CHIP Error 0x00000032: Timeout

Try the following:

Copy Code
sudo systemctl disable hciuart.service
sudo reboot

Once the reboot is done, you will need to bring the hciuart service back up on every reboot from now on. Reconnect to your Raspberry Pi and enter the following:

Copy Code
sudo systemctl restart hciuart.service
sudo systemctl status hciuart.service
sudo systemctl restart bluetooth.service
sudo systemctl status bluetooth.service
sudo btmgmt -i hci0 power off
sudo btmgmt -i hci0 bredr off
sudo btmgmt -i hci0 power on

This will restart your hciuart and bluetooth services followed by disabling the Basic Rate/Enhanced Data Rate (BR/EDR) protocols for your Bluetooth interface (meaning that you can only use BLE).

Now, perform a factory reset on the MAD (hold btn0 for at least 6 seconds). Enter the following to scan for BLE devices in discovery mode:

Copy Code
bluetoothctl
# scan le
# exit

Finally, you should be able to run the mattertool commands to create a Thread network, commission the MAD, and turn the LED on and off:

Copy Code
mattertool startThread
mattertool bleThread
mattertool on
mattertool off

If you are still running into Bluetooth connection issues, try the following:

  • Restart the Pi
  • Try a different USB port for the RCP

You can read about all the troubles I had while trying to get this to work: https://community.silabs.com/s/question/0D58Y00009z7FomSAE/mattertool-matter-hub-with-rcp-cannot-connect-to-endpoint-device-running-light-over-thread-matter-application?language=en_US 

Recommended Reading

If you would like to learn more about Matter and the SiLabs Matter Hub, see the following documentation:

制造商零件编号 XG24-DK2601B
EVAL BOARD FOR ST25DV64KC
Silicon Labs
¥651.42
Details
制造商零件编号 SC0194(9)
RASPBERRY PI 4 B 4GB
Raspberry Pi
¥447.69
Details
Add all DigiKey Parts to Cart
TechForum

Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.

Visit TechForum