Skip to content

dresden-elektronik/openthread-r21

Repository files navigation

OpenThread-R21

An OpenThread Border Router firmware port for Atmel-R21 (Microchip samr21) based ConBee II and RaspBee II.
Note: the port is still in development, watch this repository to get notified when first beta test version is released.

For interested Useres

  • There will be a GCF-flashable firmware for the ConBeeII / RaspbeeII soon. Stay tuned!
  • This firmware will be flashed via the GCFFlasher in the same way as deCONZ and ZShark firmware is flashed.
  • The firmware will convert the ConBeeII / RaspBeeII into a Radio-Co-Processor (RCP) for a Thread Border-Router-Daemon running on a Host. This functions as a gateway between Thread-Devices and the local Network.
  • Thread forms the underlying technology for 802.15.4 based Matter-Devices
  • Any deCONZ settings stored in NVRAM will be preserved (in development, no guarantees, backup your data!).
  • The firmware is Thread-RCP only, it can not be used in parallel with Zigbee firmware (but switching the firmware is always possible).

For Developers

Build Guide (RCP-Firmware):

This Part describes how to build the openthread RCP-firmware from source. This will be obsolete once the .gcf image is available.

Prerequisites:

  • So Far you can only compile on a x86 Machine
  • I tested on Arch and Fedora. Debian based distros should also work.
  • You should at least have a working git package installed
  1. Clone this Repo:
git clone https://github.com/dresden-elektronik/openthread-r21
  1. cd into the directory and init the openthread and tinyusb submodule
cd openthread-r21
git submodule update --init openthread/
git submodule update --init third_party/tinyusb

#or

git submodule update --init --recursive --depth 1
  1. execute the bootstrap script (This will install necessary dependencies and download the arm-none-eabi-gcc x86 Toolchain)
bash script/bootstrap.sh

If your are on an unsupported Platform, you will have to manually install the following dependencies: automake, g++, libtool, make, cmake, ninja-build, shellcheck

  1. build the RCP-Firmware
bash script/build.sh
  1. Done! You will find the linked Firmware (.elf Format) at /openthread/out/build/ot-rcp

Flash Firmware via OpenOCD and GDB

This Part describes how to flash the previously build RCP-firmware onto the samr21 ROM-Flash by using a OpenOCD compatible Debugging Tool.

  1. Install OpenOCD (This Step may be skipped on debian and fedora based Systems, bootstrap.sh should install OpenOCD via apt or dnf )

  2. Find the Open-OCD configuration file for your Debugger (Checkout eLinux-Page where to find your config File)

A Configuration for the ATMEL-ICE and the ATSAMR21ZLL-EK are provided in script/openocd_config/. You can also use them as a Template for your config

  1. Start an OpenOCD-Server (Do this in a seperate Terminal, this may require sudo-rights) Make Sure Your Devices are Powered!
#For Atmel-ICE
(sudo) openocd -f script/openocd_config/ATMEL-ICE-OpenOCD-samr21e18a.cfg

#Generic Debugger
(sudo) openocd -f <yourDebuggerConfigFile>.cfg

If everything goes well, you should see the following Output:

Info : Listening on port 3333 for gdb connections
  1. Start the GDB-Debugger, Connect to the OpenOCD-Server and flash the Firmware-File
gcc-arm-none-eabi/bin/arm-none-eabi-gdb \
    --init-eval-command='target extended-remote localhost:3333' \
    ./out/build/bin/ot-rcp \
    --eval-command='load'
  1. Reset the MCU (via gdb shell)
(gdb) r
  1. Exit GDB by pressing CTRL + C and typing quit into the GDB Shell:
(gdb) quit
  1. Done! The Firmware on your Device is ready to act as an Openthread-RCP Dongle

Install-Guide OpenThread Border-Router Daemon (Program running on the Host Side)

This Part describes how to prepare a host Platform to operate as a Openthread Border Router in conjunction with the connected RCP-Device. It is strongly advised to follow the Guide on the Official Openthread Website.

Tested on Debian11/Ubuntu22.04LTS/RaspberryPiOS(32Bit)

  1. Start with a fresh OS-Installation on whatever Platform you are planning to Use (Like RaspberryPi, VM, NUC).

    The OpenThread Border Router works best with debian based Platforms

  2. On your desired Host-Platform clone into the Openthread-Borader-Router-repository

git clone https://github.com/openthread/ot-br-posix
  1. cd into the repository and run the bootstrap script
cd ot-br-posix
(sudo) bash script/bootstrap
  1. Install the Border Router Daemon and specify the interface used to communicate with the local network
#Raspberry Pi on Ethernet
(sudo) bash INFRA_IF_NAME=eth0 ./script/setup

#Raspberry Pi on Wifi
(sudo) bash INFRA_IF_NAME=wlan0 ./script/setup
  1. Check if the serial connection got initialized correctly
ls /dev/ | grep tty*

should return something like

ttyACM0

or

ttyACM1
  1. Modify the otbr-agent settings to use the expected serial-device for communication with the RCP
(sudo) nano /etc/default/otbr-agent

The Device will likely aper as /dev/ttyACM0 but you should double check that with something like dmesg. You should modify your config-file according to your system. Some examples:

WIFI and RCP mapped to /dev/ttyACM0

OTBR_AGENT_OPTS="-I wpan0 -B wlan0 spinel+hdlc+uart:///dev/ttyACM0 trel://wlan0"

Ethernet and RCP mapped to /dev/ttyACM1

OTBR_AGENT_OPTS="-I wpan0 -B eth0 spinel+hdlc+uart:///dev/ttyACM1 trel://eth0"
  1. After modifying the otbr-agent config-file you should reboot your Host.
sudo reboot now
  1. After Reboot you should be able to reach the Openthread Border Router Web-Interface by typing http://YOURHOSTADDR/ into your Web-Browser

About

OpenThread Border Router for R21 based ConBee II and RaspBee II

Resources

License

Stars

Watchers

Forks

Packages

No packages published