Skip to content

DynamicDevices/openthread-border-router-block

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deploy to Balena

balena deploy button

The default device variables setup from balena.yml should be correct but these work

image

Overview

This repository provides a container for the OpenThread Border Router.

NOTE: It takes about 90s to come up as we wait for some underlying host OS dependencies such as DBUS to come up which I haven't worked out how to add a specific dependency on yet.

We build it using a modified Dockerfile taken from the OTBR repository here

  • This is to ensure we have control over the settings we use for the build.

We also include the MQTT-SNGateway based on the block here

  • TODO: This is because I haven't yet worked out how to route IPv6 packets successfully between containers to make them available to the mesh on interface wpan0. Reading around it may not be possible with Docker to route IPv6 multicast between containers (?)

See the MQTT-SNGateway README for details on default environment variable settings.

In addition you need to set RUN_MQTT_SNGATWAY=1 to start up the gateway process.

Then the OpenThread Border Router web interface will run up on port 80 and you can Form or Join a network.

NOTE: For the "Toplogy" view in the WebUI you need access to port 8081 which runs the OTBR rest API. If you aren't seeing anything look at the web developer console in your browser to work out what requests are failing

Use the settings in this image to conform to the MQTT-SN publication CLi example you can use here

  • PAN 0x4444
  • Extended PAN 3333333344444444
  • Network Key (used to be called Master Key) 33334444333344443333444433334444
  • Channel 15

If you want to automatically form a network you can set Balena Device Variables

Variable Description Default
AUTO_FORM_NETWORK Automatically form on startup 1
THREAD_CHANNEL 15
THREAD_PAN_ID 0x4444
THREAD_EXT_PAN_ID 3333333344444444
THREAD_NETWORK_NAME INST
THREAD_NETWORK_KEY 33334444333344443333444433334444
THREAD_IPV6_PREFIX: fd11:22::/64 pasor

image

Build & Flash RCP for Nordic nRF52840

The OTBR needs an RCP device to access the OpenThread 802.15.4 network. We expect this to be a Nordic nRF52840 USB dongle appearing on the host as /dev/ttyACM0. Other devices are supported by the OTBR but we haven't tried them out. For details see here

For the Nordic nRF52840 RCP build you can use the instructions here

It is a bit fiddly but this should work for the dongle RCP build

git clone --recursive https://github.com/openthread/ot-nrf528xx
cd ot-nrf528xx
./script/bootstrap
./script/build nrf52840 USB_trans -DOT_BOOTLOADER=USB -DOT_JOINER=ON -DOT_RCP_RESTORATION_MAX_COUNT=0 -DOT_LOG_LEVEL=WARN -DOT_UPTIME=ENABLED
arm-none-eabi-objcopy -O ihex build/bin/ot-rcp ot-rcp.hex

Then use the nRF Connect for Desktop to run up the Programmer Tool.

Insert the nRF52840 dongle and put it into programming mode by pressing the "tiny little horizontal button" not the big one and the RED LED should fade in and out slowly. Then it will appear on the Programmer Connections. If not you may need to install udev rules here

Reboot and it should come up as an RCP device e.g.

Bus 001 Device 003: ID 1915:0000 Nordic Semiconductor ASA Thread Co-Processor

Building MQTT-SN CLI test firmware for Nordic nRF52840

Until we have multicast advertising and SEARCHGW working properly you will need to go to the container and look at ifconfig to work out the IP address

Here we can take the IP address of the wpan0 interface

image

Then compile the MQTT-SN enabled CLI publishing example as follows

$ git clone https://github.com/DynamicDevices/ot-nrf528xx.git

image

$ ./script/build nrf52840 USB_trans -DOT_BOOTLOADER=USB -DOT_MQTT=ON -DOT_JOINER=ON -DOT_RCP_RESTORATION_MAX_COUNT=0 -DOT_LOG_LEVEL=WARN -DOT_UPTIME=ENABLED -DUDP_FORWARD=ON
$ arm-none-eabi-objcopy -O ihex build/bin/ot-cli-ftd-mqttsn-publish build/bin/ot-cli-ftd-mqttsn-publish.hex
$ arm-none-eabi-objcopy -O ihex build/bin/ot-cli-ftd-mqttsn-searchgw build/bin/ot-cli-ftd-mqttsn-searchgw.hex

Then use the Nordic programmer to program your dongle with the hex file

Running the ot-cli-ftd-mqttsn-searchgw CLI code against the OTBR running the MQTT-SN Gateway results in serial logs like this

image