Getting Started with OpenThread¶
Overview¶
This section describes how to quickly run an OpenThread example without going through the complete toolchain installation.
There is no need to build any firmware for running it, as it uses the pre-built firmware of OpenThread CLI. This application demonstrates a minimal OpenThread application that exposes the OpenThread configuration and management interfaces via a basic command-line interface.
Hardware Requirements¶
A minimal OpenThread Mesh network requires at least two nodes. Before starting to work, prepare the following parts:
- Two or more Pitaya Go boards
- A macOS, Linux or Windows computer
Flashing the OpenThread CLI¶
Before running the OpenThread CLI application, you need to flash the boards. The pre-built firmware is located in pitaya-go/firmware/openthread/cli folder.
-
Connect one Pitaya Go board to your PC using the USB-C cable.
-
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.
-
Label the board Node#1 so that later you don't confuse the boards.
-
Program the other board by repeating steps as described above. Label them Node#2
Tip
See Programming section for details about how to program your Pitaya Go.
Running the OpenThread CLI¶
You can access the OpenThread CLI by using a serial terminal like screen or PuTTY.
Start Node#1¶
-
Open a terminal window and run:
wherescreen /dev/cu.usbmodemD2E39D222D781 115200
/dev/cu.usbmodemD2E39D222D781
is the port name of the board. Replace it with your owns. -
Press Enter on the keyboard to bring up the OpenThread CLI
>
prompt. -
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 Node#1's 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
Start Node#2¶
-
Start another terminal window and enter the CLI.
-
Configure Thread Master Key and PAN ID from Node#1's Active Operational Dataset:
> dataset masterkey aa8da3931ffcbcb26c8b4b7c9b4114c1 Done > dataset panid 0x4d92 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 Node#2 has become a Thread Child or Router:
> state child Done
Ping Node#1 from Node#2¶
In the CLI of Node#2, ping Node#1:
> ping fda9:4820:7a9c:66ba:4d7b:9ef4:cbdf:8cd3 16 bytes from fda9:4820:7a9c:66ba:4d7b:9ef4:cbdf:8cd3: icmp_seq=1 hlim=64 time=87ms
Observe that the LEDs on Node#1 will blink when receiving the ping request.
Next Steps¶
Congratulations! You have built a simple OpenThread Mesh network with two Pitaya Go boards.
You may use the CLI to change network parameters, other configurations, and perform other operations. See the OpenThread CLI Reference README.md to explore more.
Follow the Setup the Thread SDK section to set up the Thread development environment on your system.
Check out the Build and Run a Thread example guide to build a Thread example.
Create an Issue¶
Interested in contributing to this project? Want to report a bug? Feel free to click here: