Skip to content
/ ot-nxp Public
forked from openthread/ot-nxp

Latest commit

 

History

History
285 lines (206 loc) · 7.53 KB

README.md

File metadata and controls

285 lines (206 loc) · 7.53 KB

OpenThread on NXP RW612 Example

This directory contains example platform drivers for the [NXP RW612] based on [RD-RW612-BGA] hardware platform, including all variants of devices. The example platform drivers are intended to present the minimal code necessary to support OpenThread. As a result, the example platform drivers do not necessarily highlight the platform's full capabilities.

Prerequisites

Before you start building the examples, you must download and install the toolchain and the tools required for flashing and debugging.

Toolchain

OpenThread environment is suited to be run on a Linux-based OS (Ubuntu OS for example), WSL (Ubuntu 20.04 on Windows) or Windows (command line). There are three tools that need to be installed:

  • CMake
  • ninja
  • the arm-non-eabi gcc cross-compiler

Depending on system used installing each tool done differently.

Linux-based

In a Bash terminal (found, for example, in Ubuntu OS), follow these instructions to install the GNU toolchain and other dependencies.

$ cd <path-to-ot-nxp>
$ git submodule update --init
$ ./script/bootstrap

WSL (Ubuntu 20.05 on Windows)

Open the WSL console and type the following.

$ sudo apt install ninja-build cmake gcc-arm-none-eabi

Windows

On this platform you have to install all the tools by downloading the installers:

  • For the CMake get the downloader from the official site and install it
  • For the ninja build system download the binary from the official site. Place it in a path accessible from the windows command window.
  • For the gcc-arm-non-eabi cross-compiler, download the installer from the official site and install it

Make sure that the paths of all these tools are set into the Path system variable.

Downloading the SDK

Download the NXP MCUXpresso git SDK and associated middleware from GitHub using the west tool:

$ cd <path-to-ot-nxp>/third_party/github_sdk/
$ west init -l manifest --mf west.yml
$ west update

Building the examples

To build for RW612_RD board:

  • OT CLI application :
$ cd <path-to-ot-nxp>
$ git submodule update --init
$ ./script/build_rw612 ot_cli
  • Border Router application with Wi-Fi:
$ cd <path-to-ot-nxp>
$ git submodule update --init
$ ./script/build_rw612 ot_br_wifi
  • Border Router application with Ethernet:
$ cd <path-to-ot-nxp>
$ git submodule update --init
$ ./script/build_rw612 ot_br_eth

To build ncp adapter support with specific interface such as UART(if use USB, SPI or SDIO interface, the OT_NXP_NCP_UART_INTERFACE should be replaced by OT_NXP_NCP_USB_INTERFACE, OT_NXP_NCP_SPI_INTERFACE or OT_NXP_NCP_SDIO_INTERFACE):

$ cd <path-to-ot-nxp>
$ git submodule update --init
$ ./script/build_rw612 ot_cli -DOT_NCP_RADIO=ON -DOT_NXP_NCP_UART_INTERFACE=ON

To build for a specific device revision such as A0:

$ cd <path-to-ot-nxp>
$ git submodule update --init
$ ./script/build_rw612 ot_cli -DOT_NXP_DEVICE_REVISION=A0

To build for RW612_FRDM board:

  • OT CLI application :
$ cd <path-to-ot-nxp>
$ git submodule update --init
$ ./script/build_rw612 ot_cli -DOT_NXP_BOARD_NAME=rw612_frdm
  • Border Router application with Wi-Fi:
$ cd <path-to-ot-nxp>
$ git submodule update --init
$ ./script/build_rw612 ot_br_wifi -DOT_NXP_BOARD_NAME=rw612_frdm
  • Border Router application with Ethernet:
$ cd <path-to-ot-nxp>
$ git submodule update --init
$ ./script/build_rw612 ot_br_eth -DOT_NXP_BOARD_NAME=rw612_frdm

After a successful ot-cli build, the elf and binary files are found in build_rw612/rw612_ot_cli/bin:

  • ot-cli-rw612 (the elf image)
  • ot-cli-rw612.bin (the binary)

After a successful ot-br build, the elf and binary files are found in: build_rw612/rw612_ot_br_wifi/bin : for Wi-Fi configuration build_rw612/rw612_ot_br_eth/bin : for Ethernet configuration

  • ot-br-rw612 (the elf image)
  • ot-br-rw612.bin (the binary)

For border router features see dedicated README file.

Flash Binaries

To flash the binaries we use the JLink from Segger. You can download it and install it from https://www.segger.com/products/debug-probes/j-link. Once it is install to flash the images run JLink from the command line (either windows or linux):

$ JLink

You will be presented with a menu like:

JLink Prompt

Run the following commands:

J-Link> connect
Device> ? # you will be presented with a dialog -> select `CORTEX-M33`
Please specify target interface:
 J) JTAG (Default)
 S) SWD
 T) cJTAG
TIF> S
Specify target interface speed [kHz]. <Default>: 4000 kHz
Speed> # <enter>

If successfull you will see the following screen:

JLink Connection

At this point flash the image with the following command

J-Link> loadbin path/to/binary,0x08000400

Running the example

  1. Prepare two boards with the flashed CLI Example (as shown above).

  2. The CLI example uses UART connection. To view raw UART output, start a terminal emulator like PuTTY and connect to the used COM port with the following UART settings:

    • Baud rate: 115200
    • 8 data bits
    • 1 stop bit
    • No parity
    • No flow control
  3. Open a terminal connection on the first board and start a new Thread network.

    Note that setting channel, panid, and network key is not enough anymore because of an Open Thread stack update.

    We first need to initialize a new dataset. Using dataset command we visualize the newly generated dataset.

> dataset init new
Done
> dataset
Active Timestamp: 1
Channel: 25
Channel Mask: 0x07fff800
Ext PAN ID: 42af793f623aab54
Mesh Local Prefix: fd6e:c358:7078:5a8d::/64
Network Key: f824658f79d8ca033fbb85ecc3ca91cc
Network Name: OpenThread-b870
PAN ID: 0xb870
PSKc: f438a194a5e968cc43cc4b3a6f560ca4
Security Policy: 672 onrc 0
Done
>

To change network parameters use:

> dataset panid 0xabcd
Done
> dataset channel 25
Done

Then commit the new dataset:

> dataset commit active
Done
> ifconfig up
Done
> thread start
Done
  1. After a couple of seconds the node will become a Leader of the network.
> state
Leader
> dataset active -x
0e08000000000001000035060004001fffe0020842af793f623aab540708fd6ec35870785a8d0510f824658f79d8ca033fbb85ecc3ca91cc030f4f70656e5468726561642d623837300102b8700410f438a194a5e968cc43cc4b3a6f560ca40c0402a0f7f8000300000b
Done
>
  1. Open a terminal connection on the second board and attach a node to the network.
> dataset set active 0e08000000000001000035060004001fffe0020842af793f623aab540708fd6ec35870785a8d0510f824658f79d8ca033fbb85ecc3ca91cc030f4f70656e5468726561642d623837300102b8700410f438a194a5e968cc43cc4b3a6f560ca40c0402a0f7f8000300000b
Done
> ifconfig up
Done
> thread start
Done
  1. After a couple of seconds the second node will attach and become a Child.
> state
Child
  1. List all IPv6 addresses of the first board.
> ipaddr
fdde:ad00:beef:0:0:ff:fe00:fc00
fdde:ad00:beef:0:0:ff:fe00:9c00
fdde:ad00:beef:0:4bcb:73a5:7c28:318e
fe80:0:0:0:5c91:c61:b67c:271c
  1. Choose one of them and send an ICMPv6 ping from the second board.
> ping fdde:ad00:beef:0:0:ff:fe00:fc00
16 bytes from fdde:ad00:beef:0:0:ff:fe00:fc00: icmp_seq=1 hlim=64 time=8ms

For a list of all available commands, visit OpenThread CLI Reference README.md.