I wanted to be able to run the Matter chip-tool on Windows. Mostly so I could learn about commissioning and binding.

As I was starting to tinker with Matter devices like Light Switches, I needed the chip-tool. This is because some devices need “binding”, which I can’t do in Home Assistant or iOS home.

Whilst I had success working the esp-matter SDK on WSL2, the chip-tool won’t work because WSL2 doesn’t include Bluetooth. Bluetooth is used when commissioning devices into the Matter network.

Thankfully, espressif provide a guide on what to do

https://docs.espressif.com/projects/esp-matter/en/latest/esp32/using_chip_tool.html#:~:text=The%20CHIP%20Tool%20(chip%2Dtool,actions%2C%20such%20as%20cluster%20commands.

Compiling

The problem with WSL2 is that the Ubuntu kernel provided doesn’t support Bluetooth. This is vital for Matter commissioning.

Following the steps in the guide, I got to the point where I needed to compile my own Linux kernel.

After Adding Bluetooth, I tried to run the compile step and just got a bunch of errors

This was a Saturday morning and, whilst it would probably have been educational to figure this out, I quit.

This was getting far too deep into the weeds for me. I just wanted to run the chip-tool and for that I just needed Linux.

Using Raspian

I have a little Raspberry Pi 4 running on my desk, which runs a few things, like my Shelly Failsafe and OTBR

Maybe it would run the chip-tool?

I found this guide and started:

https://github.com/project-chip/connectedhomeip/blob/master/docs/guides/BUILDING.md

Immediately I ran into problem.

All of the Github paths to the repository where for SSH, not HTTP, so I had to tweak them!

So, the original command:

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

became

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

I ran this but unfortunately, ran out of space on my SD card!!

No space!!

Thankfully, I have an external drive connected to my Raspberry Pi. I used this when I was logging the RTT output.

I kicked off the git clone operation on the external drive.

After it was all pulled down, I moved to the activate.sh step and saw this familiar screen

So far, so good!

This step completed successfully and then I moved onto the compiling the chip-tool!

 ./scripts/examples/gn_build_example.sh examples/chip-tool ~/matter_tools/chip-tool

After about 45 minutes, the compilation error’d out 😦

The compilation process failed

This is the error message

fatal error: Killed signal terminated program cc1plus

I googled it and all signs pointed to a lack of memory.

I was using an older Pi 4 with 4GB of RAM. This seemed insufficient for compiling the chip-tool.

I tried adding a larger swapfile, but that didn’t help.

Using Snapd

Whilst googling this problem, I came across an obvious solution; use a precompiled version!

There is something called Snapd, which is like a store for Linux applications. I never heard of it before today, but you can download the chip-tool from it.

https://snapcraft.io/chip-tool

To use it, I first installed it on my Pi

sudo apt install snapd

I rebooted and then installed chip-tool

sudo snap install chip-tool
Successful installation using Snapd

I then ran it to see if it *actually* worked….

chip-tool up and running!

Success!

Summary

Having to use a different “machine” for the chip-tool isn’t ideal, but it was the most practical way to set it up.

Once you find yourself deep in the bowels of Linux kernel work, it’s never going to be straight-forward! And besides, I just SSH into the Raspberry Pi anyway, so it’s basically the same as using WSL!

Support

If you found this blog post useful and want to show your appreciation, you can always buy me a coffee or subscribe to my Patreon. Thanks!!

Buy Me a Coffee at ko-fi.com

Be sure to check out my YouTube channel.

3 responses

  1. […] As the chip-tool runs on Linux and needs Bluetooth, I run mine on a Raspberry Pi. It can be run on Window’s WSL2, but involves custom Linux kernels and stuff. RPi is easier. You can see my setup here. […]

  2. […] the previous post. This means it’s already past of my Thread network and under the control of my chip-tool. I can flash the new code, without needing to re-commission […]

  3. […] I knew my time with the chip-tool, that 2 was the NodeId that had the given permission. Of course, there was nothing with a NodeId of 2 in my code. And that lead me to this line of code: […]

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.