Command Line Example Application

Table of Contents

Introduction

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.

Hardware Prerequisites

Software Prerequisites

Functional Description

Software Overview

This section describes software components and the corresponding source file.

Application Files

Example Application

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.

Usage

This section describes how to set up and run the CLI Example Application.

Buttons

Display

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.

Setting up the Thread Network

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.


> channel 14
Done
> panid 0xface
Done
> ifconfig up
Done
> thread start
Done
> state
detached
> state
leader
>

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.


> scan
| J | Network Name     | Extended PAN     | PAN  | MAC Address      | Ch | dBm | LQI |
+---+------------------+------------------+------+------------------+----+-----+-----+
> | 0 | OpenThread       | dead00beef00cafe | face | 9e782c4394ca339f | 14 | -63 |  61 |
Done

> channel 14
Done
> panid 0xface
Done
> ifconfig up
Done
> thread start
Done
> state
child
>

Pinging between the CLI examples

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.

> ping ff03::1
> 8 bytes from fe80:0:0:0:f423:af0:300:b057: icmp_seq=1 hlim=64 time=37ms

>