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.
See the following table for the overview of the available CLI example configurations.
Configuration | Description | Stack variant used | Available for |
---|---|---|---|
FTD UART | Uses the UART communication and SEGGER J-Link as a UART-USB converter. | Thread FTD | PCA10056 |
FTD USB | Uses the USB peripheral that is available in nRF52840 and communicates as a native USB CDC device. | Thread FTD | PCA10056, PCA10059 (with bootloader, see nRF52840 Dongle) |
MTD UART | Uses the UART communication and SEGGER J-Link as a UART-USB converter. | Thread MTD | PCA10056, PCA10068 with nRF52811 |
MTD USB | Uses the USB peripheral that is available in nRF52840 and communicates as a native USB CDC device. | Thread MTD | PCA10056, PCA10059 (with bootloader, see nRF52840 Dongle) |
If the native USB CDC connectivity is used on hosts running on Windows XP or Windows 7, you must manually install the nordic_cdc_acm.inf
driver that is located at <InstallFolder>\examples\usb_drivers
.
Hosts running on Windows 8 (and later) will automatically pick the correct driver (usbser.sys
).
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\cli
.
To test the example:
panid
, ifconfig
, and thread
commands). Be sure to set the same PAN ID on both devices.