project-chip / connectedhomeip

Matter (formerly Project CHIP) creates more connections between more objects, simplifying development for manufacturers and increasing compatibility for consumers, guided by the Connectivity Standards Alliance.
https://buildwithmatter.com
Apache License 2.0
7.58k stars 2.05k forks source link

Matter Linux Bridge example - Thread commissioning #31869

Open FHFS opened 10 months ago

FHFS commented 10 months ago

Hello everyone,

I am trying to get the Matter Linux Bridge example to run with a Thread radio.

GitHub hash of the SDK that was being used: commit from last week: 9bde93872fbd16174fdf07c893f56992fdc00352

RCP Version: OPENTHREAD/thread-reference-20200818-2475-g7c5dca178; NRF52840; May 17 2023 17:04:40

Platform: Raspberry Pi 4 with Ubuntu 22.04

I can build the example using: ./scripts/examples/gn_build_example.sh examples/bridge-app/linux out/debug/bridge-app chip_enable_openthread=true

I modified the chip-cirque-device-base Dockerfile to use Ubuntu 22.04 as a base image and included bluez and bluetooth in the apt install command.

The chip-cirque-device-base image is used as a base for the Matter Linux Bridge Dockerfile. For the Matter Linux Bridge image I modified the entrypoint.sh:

#!/bin/bash

service dbus start
sleep 1
service avahi-daemon start
sleep 1
bluetoothd &
sleep 1

echo -e 'OTBR_AGENT_OPTS="-I wpan0 -B eth0 spinel+hdlc+uart:///dev/ttyUSB0 trel://eth0"\nOTBR_NO_AUTO_ATTACH=0' > /etc/default/otbr-agent
service otbr-agent start

sleep 1
ot-ctl panid 0x1234
ot-ctl ifconfig up
ot-ctl thread start

chip-bridge-app --thread

I can start the container with the command: docker run -v /dev/ttyACM0:/dev/ttyUSB0 -v /dev/ttyAMA0:/dev/ttyAMA0 --privileged --net=host matterbridge:latest

From inside the container I confirmed Bluetooth is working using bluetoothctl. The otbr-agent service is running and with ot-ctl I can scan for networks.

However after I successfully commission the device, the openthread radio is not configured. The openthread state is even disabled. Commissioning logs: MatterBridge.txt

How do I make sure the OpenThread Radio gets configured during commissioning?

FHFS commented 10 months ago

I've added some variables to args.gni

chip_enable_openthread = true
chip_openthread_ftd = true
chip_config_network_layer_ble=true
chip_enable_openthread=true
chip_device_config_thread_ftd=true
chip_device_uses_otbr_posix_dbus=true
chip_enable_ble=true
chip_openthread_border_router=true

Only when I added the last one chip_openthread_border_router the OpenThread radio was commissioned onto the thread network.

Is it possible to commission the thread radio without being a border router?