This directory contains example platform drivers for the NXP JN5189 based on JN5189-DK006 hardware platform.
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.
Before you start building the examples, you must download and install the toolchain and the tools required for flashing and debugging.
OpenThread environment is suited to be run on a Linux-based OS.
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>
$ ./script/bootstrap
For signing, several Python packages are required:
$ sudo apt-get install python3-pip
$ pip3 install pycrypto
$ pip3 install pycryptodome
- Download and install the MCUXpresso IDE.
- Download JN5189 SDK 2.6.3. Creating an nxp.com account is required before being able to download the SDK. Once the account is created, login and follow the steps for downloading SDK_2.6.3_JN5189DK6. The SDK Builder UI selection should be similar with the one from the image below.
$ cd <path-to-ot-nxp>
$ export NXP_JN5189_SDK_ROOT=/path/to/previously/downloaded/SDK
$ third_party/jn5189_sdk/mr3_fixes/patch_jn5189_mr3_sdk.sh
$ ./script/build_jn5189
After a successful build, the elf
files are found in
build_jn5189/openthread/examples/apps/cli
and include FTD (Full Thread
Device), MTD (Minimal Thread Device) and variants of CLI appliations.
If only flashing is needed then DK6 Flash Programmer can be used. Otherwise, if also debugging capabilities are needed then MCUXpresso IDE should be used.
Connect to the DK6 board by plugging a mini-USB cable to the connector marked with FTDI USB. Also, make sure that jumpers jp4/JP7 are situated in the middle position (JN UART0 - FTDI).
DK6 Flash Programmer can be found inside the SDK at path
tools/JN-SW-4407-DK6-Flash-Programmer
. This is a Windows application that can
be installed using the .exe file. Once the application is installed, the COM
port for JN5189 must be identified:
C:\nxp\DK6ProductionFlashProgrammer>DK6Programmer.exe --list
Available connections:
COM29
Once the COM port is identified, the required binary can be flashed:
C:\nxp\DK6ProductionFlashProgrammer>DK6Programmer.exe -s COM29 -p ot-rcp.bin
Connect to the DK6 board by plugging a mini-USB cable to the connector marked with TARGET. Also, make sure that jumpers JP4/JP7 are situated in the leftmost position (LPC-JN UART0).
In order to flash the application for debugging we recommend using MCUXpresso IDE (version >= 11.0.0).
- Import the previously downloaded NXP SDK into MCUXpresso IDE. This can be done by drag-and-dropping the SDK archive into MCUXpresso IDE's Installed SDKs tab:
- Import OpenThread repo in MCUXpresso IDE as Makefile Project. Use none as Toolchain for Indexer Settings:
File -> Import -> C/C++ -> Existing Code as Makefile Project
- Configure MCU Settings:
Right click on the Project -> Properties -> C/C++ Build -> MCU Settings -> Select JN5189 -> Apply & Close
- Configure the toolchain editor:
Right click on the Project -> C/C++ Build-> Tool Chain Editor -> NXP MCU Tools -> Apply & Close
- Create a debug configuration:
Right click on the Project -> Debug -> As->MCUXpresso IDE LinkServer (inc. CMSIS-DAP) probes -> OK -> Select elf file
- Set the Connect script for the debug configuration to QN9090connect.scp from the dropdown list:
Right click on the Project -> Debug As -> Debug configurations... -> LinkServer Debugger
- Set the Initialization Commands to:
Right click on the Project -> Debug As -> Debug configurations... -> Startup
set non-stop on
set pagination off
set mi-async
set remotetimeout 60000
##target_extended_remote##
set mem inaccessible-by-default ${mem.access}
mon ondisconnect ${ondisconnect}
set arm force-mode thumb
${load}
- Set the vector.catch value to false inside the .launch file:
Right click on the Project -> Utilities -> Open Directory Browser here -> edit *.launch file:
<booleanAttribute key="vector.catch" value="false"/>
- Debug using the newly created configuration file:
-
Prepare two boards with the flashed
CLI Example
(as shown above). Make sure that the JN4 jumper is set to RX and the JN7 jumper is set to TX, connecting the LPC and JN UART0 pins. -
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
-
Open a terminal connection on the first board and start a new Thread network.
> panid 0xabcd
Done
> ifconfig up
Done
> thread start
Done
- After a couple of seconds the node will become a Leader of the network.
> state
Leader
- Open a terminal connection on the second board and attach a node to the network.
> panid 0xabcd
Done
> ifconfig up
Done
> thread start
Done
- After a couple of seconds the second node will attach and become a Child.
> state
Child
- 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
- 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.