Thread_Cli_Cmd Application Description

How to control the Thread stack via Cli commands.

Keywords

Connectivity, 802.15.4 protocol, Thread, CLI

Hardware and Software environment

  • This example runs on STM32WBA52xx devices.

  • This example has been tested with an STMicroelectronics STM32WBA55CGA_Nucleo board and can be easily tailored to any other supported device and development board.

How to use it?

The Cli (Command Line Interface) commands are sent via an UART from an HyperTerminal (PC) to the STM32WBA55xx Nucleo Board.

    ___________________________ 
  |                           |     
  |           ________________|                       _____________________________________
  |          |USART1          |                      |     HyperTerminal 1                 |
  |          |                |                      |=> Used to ctrl the stack via Cli Cmd|
  |          |                |                      |                                     |
  |          |                |                      |                                     |
  |          |                |______________________|                                     |
  |          |                |______________________| ST_Link virtual port                |
  |          |                |     ST_Link Cable    |                                     |             
  |          |                |                      |                                     |
  |          |                |                      |                                     |
  |          |                |                      |                                     |             
  |          |________________|                      |_____________________________________|          
  |                           |                       
  |           _______________ |                       ______________________________________
  |          |USART2          |                      |     HyperTerminal 2 (Optional)       |
  |          |                |                      |=> Used to display traces             |   
  |          |                |                      |                                      |
  |          |CN4 (Pin37) RX  |______________________|TX                                    | 
  |          |                |                      |                                      |
  |          |                |     RS232 Cable      |                                      |             
  |          |                |                      |                                      |
  |          |CN4 (Pin35) TX  |______________________|RX                                    |          
  |          |                |                      |                                      |           
  |          |________________|                      |______________________________________|          
  |                           |                                                
  |                           |                      
  |                           |                      
  |_STM32WBA55xx_Nucleo_______|                      
                 

  • Through the Cli commands, it is possible to control and configure the Thread stack.
  • On the HyperTerminal, the user can type the command ‘help’ in order to display the list of all available cli commands. Additional information can be found looking at the OpenThread web site: https://openthread.io/guides/

  • As an example, the user can play the following scenario in order to properly initiate the Thread mesh network by typing the following commands:
  >panid 0x1234
   Done
  >channel 12
   Done
  >ifconfig up
   Done
  >networkkey 00112233445566778899AABBCCDDEEFF
  >thread start
   Done

At this point, the user can check the state of its device by using the cli command ‘state’:

   >state
   leader
   Done

Note: With MTD config, we have only Child role.

  • When running on two STM32WBA55xx Nucleo boards the same Thread_Cli_Cmd application, and by playing the same scenario as described above on both boards, the first board should reach the state ‘leader’, while the second one should reach the state ‘child’.

Note: The application needs to ensure that the SysTick time base is always set to 1 millisecond to have correct HAL operation.

Traces

  • To get the traces you need to connect your Board to the Hyperterminal (through the STLink Virtual COM Port).

  • The UART must be configured as follows:

    BaudRate = 115200 baud
    Word Length = 8 Bits
    Stop Bit = 1 bit
    Parity = none
    Flow control = none
    Terminal “Go to the Line” : LF