The Thread CLI example demonstrates a minimal OpenThread application that enables user interaction through built-in command line interface (CLI). It can be used as a base for more sophisticated applications. This example has similar functionality as the CLI example available in the official OpenThread repository but has been adopted to use with the nRF5 SDK. For additional information about the example, refer to OpenThread CLI Example.
The CLI example is provided in two configurations - UART and USB. The former one uses UART communication and SEGGER J-Link as a UART-USB converter. The latter one uses the USB peripheral that is available in nRF52840 and communicates as a native USB CDC device.
If native USB CDC connectivity is used on Windows XP/7 hosts, you must manually install the driver that is located in the example directory:
Windows 8 (and later) hosts will pick the correct driver (usbser.sys) automatically.
The CLI application starts in disconnected state and remains so until appropriate commands are issued by the user. These commands can be issued by using a serial line connection with a terminal application like PuTTy.
Network state is indicated by BSP_LED_0. When the device is not connected to a network, the LED blinks at a 200 ms period. Once the device connects to a network, either as a Child or as a Leader, the LED stops blinking and remains turned on.
When the application starts, you can configure the network using the following commands:
Once the device is connected, you can check its role using the state
command:
The actual state may differ, depending on when the device joined the network.
To obtain the IP addresses of a device, run the following command:
Once there are two or more devices in the network, you can ping one from another with the ping command:
For a complete list of CLI commands, run the help
command. For complete CLI documentation, refer to OpenThread CLI Reference.
You can find the source code and the makefile in the following folder: <InstallFolder>\examples\thread\experimental\cli
To test this example, you need at least two nRF52840 Development Kits.
panid
, ifconfig
, and thread
commands). Be sure to set the same PAN ID on both devices.