From 30aa221acc37441c79924da57f9129215b1b645f Mon Sep 17 00:00:00 2001 From: Slyke Date: Fri, 8 Nov 2024 04:43:22 -0800 Subject: [PATCH] Added basic readme for nrf52840 for Thread --- .templates/otbr/readme.md | 68 +++++++++++++++++++++ .templates/otbr/service.yml | 2 +- .templates/python-matter-server/service.yml | 6 +- 3 files changed, 72 insertions(+), 4 deletions(-) create mode 100644 .templates/otbr/readme.md diff --git a/.templates/otbr/readme.md b/.templates/otbr/readme.md new file mode 100644 index 00000000..7d0516b4 --- /dev/null +++ b/.templates/otbr/readme.md @@ -0,0 +1,68 @@ +# OTBR (Open Thread Border Router) + +The container will fail to show the WUI until IPv6 is enabled on the RPi. You can do so by running the following commands: +``` +$ sudo modprobe ip6_tables +$ sudo modprobe ip6table_filter +``` + +Save between reboots: +``` +$ echo "ip6_tables" | sudo tee -a /etc/modules +$ echo "ip6table_filter" | sudo tee -a /etc/modules +``` + +Open docker config `sudo nano /etc/docker/daemon.json`: +``` +{ + "ipv6": true, + "fixed-cidr-v6": "2001:db8:1::/64" +} +``` + +Then: +``` +$ sudo systemctl restart docker +``` + +I have this successfully working with a MakerDiary nrf52840 USB Thread radio node. It requires custom firmware flashed on it. + +You can flash the USB card with the `openthread/environment:latest` docker image. You only need to flash the firmware once to the USB radio, it has ran on every device I've tested running OTBR: baremetal, Docker, IOTstack, and Kubernetes (containerd). + +Run the following commands in it: +``` +$ git clone https://github.com/openthread/ot-nrf528xx.git +$ cd ot-nrf528xx/ +$ git submodule update --init +$ ./script/build nrf52840 USB_trans -DOT_BOOTLOADER=USB +``` + +After this, it depends on the type of nRF52840. If you are using aMakerDiary, mount it as a drive and drag the UF2 file into it, after converting it to a .hex file: +``` +$ arm-none-eabi-objcopy -O ihex build/bin/ot-cli-ftd ot-cli-ftd.hex +$ pip install --pre -U git+https://github.com/makerdiary/uf2utils.git@main +$ uf2conv -f 0xADA52840 -c -b 0x1000 -o build/bin/ot-cli-ftd.uf2 build/bin/ot-cli-ftd +``` + +Since I run Zigbee and zwave on the same device, I mounted the nRF52840 this way `compose-override.yml`: +``` +services: + otbr: + volumes: + - ./volumes/otbr/data:/var/lib/otbr + - ./volumes/otbr/wpantund:/etc/wpantund.conf + - ./volumes/otbr/config:/etc/otbr + - /dev/serial/by-id/usb-Nordic_Semiconductor_nRF528xx_OpenThread_Device_XXXXXXXXXXX-if00:/dev/ttyACM0 +``` + +Note the device serial number has been replaced with Xs. You can find yours by running: +``` +ls -ahl /dev +``` + +You need to have flashed it with the OTBR firmware before running this command, as it will have a different name if running the stock firmware. + +Links: +* https://openthread.io/guides/border-router/docker (OTBR running in docker) +* https://openthread.io/guides/build/index.md (Radio/Node/RCP binary compile and firmware flashing) +* https://openthread.io/guides/border-router/raspberry-pi (Running on RPi 3+ bare-metal) \ No newline at end of file diff --git a/.templates/otbr/service.yml b/.templates/otbr/service.yml index 05fe18a6..a0ada6e6 100644 --- a/.templates/otbr/service.yml +++ b/.templates/otbr/service.yml @@ -17,7 +17,7 @@ otbr: - ./volumes/otbr/wpantund:/etc/wpantund.conf - ./volumes/otbr/config:/etc/otbr ports: - - "80:8283" + - "8283:80" command: > --radio-url spinel+hdlc+uart:///dev/ttyX # Example diff --git a/.templates/python-matter-server/service.yml b/.templates/python-matter-server/service.yml index de71b6a4..57696595 100644 --- a/.templates/python-matter-server/service.yml +++ b/.templates/python-matter-server/service.yml @@ -7,9 +7,9 @@ python-matter-server: - apparmor=unconfined volumes: - ./volumes/python-matter-server/data:/data - ports: # For reference only. Matter requires these ports. - - "5580:5580" - - "5080:5080" + # ports: # For reference only. Matter requires these ports. + # - "5580:5580" + # - "5080:5080" command: > --storage-path /data