Thread_Coap_Generic_ThreadX Application Description

How to build Thread application based on Coap messages.

Keywords

Connectivity, 802.15.4 protocol, Thread, COAP

Hardware and Software environment

How to use it?

In order to make the program work, you must do the following:

Note: when LED1, LED2 and LED3 are toggling it is indicating an error has occurred on application.

If you want to control this application, you can directly send and retrieve Cli commands connecting an HyperTerminal with the FTDI cable as following :

In a Thread network, nodes are split into two forwarding roles: Router or End Device.
The Thread Leader is a Router that is responsible for managing the set of Routers in a Thread network.
An End Device (or child) communicates primarily with a single Router.

In our Application which uses two devices, one device will act as a Leader (Router) and the other one will act as an End Device(mode child).

After the reset of the 2 boards, one board will be in Leader mode (Green LED2 ON).
The other one will be in Child mode (Red LED3 ON).

Let’s name indifferently one board A and one board B.

Same COAP commands can be sent from board B to board A.

    
  ___________________________                       ___________________________
  |  Device A               |                       | Device B                |
  |_________________________|                       |_________________________|  
  |                         |                       |                         |
  |                         |                       |                         |
  |                SW1 -->  |======> COAP =========>| BLUE LED TOGGLE (ON/OFF)|
  |                         | Resource "light"      |                         |
  |                         | Mode: Multicast       |                         |
  |                         | Type: Non-Confirmable |                         |
  |                         | Code: Put             |                         |
  |                         |                       |                         |
  |                         |                       |                         |
  |                SW2 -->  |=====> COAP ==========>|-------->                |
  |                         | Resource "light"      |         |               |
  |                         | Mode: Multicast       |  CoapRequestHandler()   |
  |                         | Type: Confirmable     |         |               |
  |                         | Code: Put             |         |               |
  |                         |                       |         v               |
  |                         |                       |  CoapSendDataResponse() |
  |                         |                       |         |               |
  |                         |                       |         v               |
  | CoapDataRespHandler()<--|<===== COAP <==========| <-------                |
  |                         |                       | BLUE LED TOGGLE (ON/OFF)| 
  |                         |                       |                         |  
  ---------------------------                       ---------------------------
  | Role : Child            |                       | Role : Leader           |
  |                         |                       |                         |
  | LED : Red               |                       | LED : Green             |
  |                         |                       |                         |
  |_________________________|                       |_________________________|

  

Traces