Skip to content

Latest commit

 

History

History
270 lines (190 loc) · 7.5 KB

README.md

File metadata and controls

270 lines (190 loc) · 7.5 KB

OpenThread on NXP K32W061 Example

This directory contains example platform drivers for the [NXP K32W0x1][k32w0x1] based on [K32W0x1-DK006][k32w0x1-dk006] hardware platform, including all variants of devices like K32W041 and K32W061.

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.

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

Tools

Download the K32W0 SDK using the west tool.

$ cd third_party/k32w0_sdk/repo
$ west init -l manifest --mf west.yml
$ west update

In case there are local modification to the already installed git NXP SDK. Use the west forall command instead of the west init to reset the west workspace before running the west update command. Warning: all local changes will be lost after running this command.

$ cd third_party/k32w0_sdk/repo
$ west forall -c "git reset --hard && git clean -xdf" -a

Some files permission need to be changed to executable :

$ chmod +x <path-to-ot-nxp>/third_party/k32w061_sdk/repo/core/tools/imagetool/sign_images.sh
$ chmod +x <path-to-ot-nxp>/third_party/k32w061_sdk/repo/core/middleware/wireless/zigbee/tools/ZPSConfig/Source/ZPSConfig
$ chmod +x <path-to-ot-nxp>/third_party/k32w061_sdk/repo/core/middleware/wireless/zigbee/tools/PDUMConfig/Source/PDUMConfig

Building the examples

$ cd <path-to-ot-nxp>
$ ./script/build_k32w061

After a successful build, the elf files are found in build_k32w061/openthread/examples/apps/cli and include FTD (Full Thread Device), MTD (Minimal Thread Device) and variants of CLI appliations.

Flash Binaries

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.

Using DK6Programmer

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_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 K32W061 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

Using MCUXpresso IDE

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).

DK6_BOARD_FTDI

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:

Installed_SDKS

  • 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 K32W061 -> Apply & Close

MCU_Sett

  • Configure the toolchain editor:
Right click on the Project -> C/C++ Build-> Tool Chain Editor -> NXP MCU Tools -> Apply & Close

MCU_Sett

  • Create a debug configuration:
Right click on the Project -> Debug -> As->MCUXpresso IDE LinkServer (inc. CMSIS-DAP) probes -> OK -> Select elf file

debug_1

  • 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

connect

  • 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}

init

  • 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:

debug

Running the example

  1. 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.

  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.

> panid 0xabcd
Done
> ifconfig up
Done
> thread start
Done
  1. After a couple of seconds the node will become a Leader of the network.
> state
Leader
  1. Open a terminal connection on the second board and attach a node to the network.
> panid 0xabcd
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.