![]() |
![]() |
|
TI-OpenThread
1.05.00.20
|
This document discusses how to use the Command Line Example Application.
The CLI example is the basic introduction to the Thread Stack. This example allows the user to explore the inner workings of the OpenThread stack. This example will allow you to form and join a network. The walk-through below will setup a basic ad-hoc Thread network between two CLI examples.
This section describes software components and the corresponding source file.
main.c: The main entry point for the example. Creates and starts the tasks for operating the OpenThread stack and CLI example.cli.c: Instantiation of command line object and heartbeat LED loop.otstack.c: OpenThread stack instantiation and processing.task_config.h: Defines RTOS task priorities and call stack sizes.tiop_config.[ch]: Contains OpenThread stack configurations. If using a SysConfig-enabled project (see the Configuration with SysConfig section below), these files are generated and configured through the SysConfig GUI. If using a non-SysConfig project, the files are a part of the project and parameters can be directly modified.This application provides a simple debugging interface to the OpenThread stack. This application is used as the certification interface for the OpenThread stack to Thread test harness, but is also useful as an exploration tool.
Following is information on how to setup a simple network between two CLI examples. For a more in-depth explanation of the commands available, refer the README.md in the OpenThread source directory at <SDK_ROOT>/source/third_party/openthread/src/cli/README.md.
SysConfig is a GUI configuration tool that allows for TI driver and stack configurations. In order to configure projects using SysConfig, use the SysConfig-enabled version of the Thread examples located in <SDK_ROOT>/examples
To configure using SysConfig, import the SysConfig-enabled project into CCS. Double click the *.syscfg file from the CCS project explorer, where * is the name of the example project. The SysConfig GUI window will appear, where Thread stack and TI driver configurations can be adjusted. These settings will be reflected in the generated files tiop_config.[ch].
The example project comes with working default settings for SysConfig. It is not recommended to change the default driver settings, as any changes may impact the functionality of the example. The Thread stack settings may be changed as required for your use case.
One important note about TI-OpenThread SysConfig is how SysConfig settings and non-volatile storage settings are applied. If the LaunchPad non-volatile holds a valid Thread dataset, SysConfig settings will not be applied on boot. SysConfig settings are only applied when non-volatile storage does not hold a valid Thread dataset. To guarantee SysConfig settings are applied, perform a factory reset of the non-volatile storage, as described below.
This section describes how to set up and run the CLI Example Application.
BTN-2 at boot: A factory reset of the non-volatile storage is performed. This must be pressed at the start of the OtStack_task function.The command line interface will present on the device's UART, and can be displayed through a serial terminal emulator. To enable the serial terminal in CCS press Ctrl + Shift + Alt + T, select Serial Terminal under Choose terminal, select 115200 for Baud Rate and click OK.
This section describes how to set up a Thread network between two CLI devices. Program two LaunchPads with the CLI image and follow the steps below. One of the CLI examples must be a Full Thread Device (FTD).
On the first CLI example, press Enter to see a prompt >. Then use the channel command to set the desired channel. Use the panid command to set the current running PAN. Finally use the commands ifconfig up and thread start to start the Thread stack. Below is an example of bringing up a device on channel 14 and PANID 0xface.
On the second CLI example, press Enter to see a prompt >. Then use the scan command to make sure that this LaunchPad can see the first one. The following prompt may be swallowed up by the output of the scan, press Enter to get the prompt again. Then use the channel and panid commands as in the first example to set the same channel and PANID. Finally, use the ifconfig up and thread start commands to start the Thread stack. The second example will connect to the first example as a child.
Once you have setup the network as above, you can ping between the two nodes. Here we ping the IPv6 relm-local all nodes multicast address, and get a response from our leader's link local address.