Build and Run a Thread Example¶
This section demonstrates how to build a Thread example (like OpenThread CLI) with the nRF5 SDK for Thread and run it.
Before you start building, remember to set up the Thread development environment first. See Setup the Thread SDK for details.
Building OpenThread CLI¶
You can find the source code and the project file of OpenThread CLI in the following folder: pitaya-go/examples/openthread/cli.
Navigate to the directory with the OpenThread Full Thread Device (FTD) CLI Makefile:
make to build the example:
Programming OpenThread CLI¶
If compiled successfully, the firmware is located in
openthread/cli/ftd/armgcc/_build with the name
While pushing the USER button, press the RESET button to enter the DFU (Device Firmware Update) mode. Then program the firmware using the nRF Connect for Desktop tool.
See Programming section for details about how to program your Pitaya Go.
Perform the following steps to test the OpenThread CLI:
screen /dev/cu.usbmodemD2E39D222D781 115200
Press Enter on the keyboard to bring up the OpenThread CLI
Generate, view, and commit a new Active Operational Dataset:
> dataset init new Done > dataset Active Timestamp: 1 Channel: 24 Channel Mask: 07fff800 Ext PAN ID: 57a7486ff74c8538 Mesh Local Prefix: fda9:4820:7a9c:66ba/64 Master Key: aa8da3931ffcbcb26c8b4b7c9b4114c1 Network Name: OpenThread-4d92 PAN ID: 0x4d92 PSKc: 22537a67d4040e34848d6d82ca2c313c Security Policy: 0, onrcb Done > dataset commit active Done
Bring up the IPv6 interface:
> ifconfig up Done
Start Thread protocol operation. Observe that the GREEN LED is lit.
> thread start Done
Wait a few seconds and verify that the device has become a Thread Leader:
> state leader Done
View IPv6 addresses assigned to the Thread interface:
> ipaddr fda9:4820:7a9c:66ba:0:ff:fe00:fc00 fda9:4820:7a9c:66ba:0:ff:fe00:8800 fda9:4820:7a9c:66ba:4d7b:9ef4:cbdf:8cd3 fe80:0:0:0:3c1d:5115:ccc5:6ba7 Done
Check out more OpenThread examples.
Build an OpenThread Network Sniffer to sniff packets on a Thread network.
Create an Issue¶
Interested in contributing to this project? Want to report a bug? Feel free to click here: