Building a Thread Router Eligible End Device Application (with Silicon Labs Thread 2.7.1) Part 2.
09/256/2018 | 01:21 AM
A step-by-step guide to creating, building, and running your own Router Eligible End Device (REED) application based on the Silicon Labs Thread stack. Before tackling this tutorial, please checkout "Building a Thread Router Eligible End Device Application" tutorial first.
This tutorial expands on Part 1 by adding a handler for a received CoAP message.
I. Updating Configuration for REED
1. Go back to the ISC configuration file we created in the previous exercise (ThreadReed271EFR32.isc).
2. Navigate to the "Plugins" tab:
a. Select "CoAP Dispatch".
b. Remove "CoAP Debug" as there are some conflicts.
3. Under the "Other" tab:
a. Add a CoAP Dispatch item.
i. Change Method to POST.
ii. Change URI Path to "reed/toggle".
iii. Change Handler to "reedToggleHandler".
4. Click "Generate". AppBuilder will ask you to validate the generation to make sure which files can be overwritten. Make sure thread-callbacks.c is unchecked. Click OK.
5. In the "Generation successful" window click OK.
6. Save the ISC file.
II. Add Code and Build Projects in Simplicity Studio IDE
1. In thread-callbacks.c add the following code to have the node respond to CoAP messages. This Handler will respond to "reed/toggle" URI, toggle an LED on the WSTK, and print a statement to the console.
2. Build your project and ensure that it completes with zero errors.
III. Load Application to All WSTKs
1. In Network Analyzer perspective, click on a node for your application and disconnect from the device (for the EFR32). Then select "Flash/Upload".
2. Upload only the updated application. This time DO NOT erase the chip because we want to keep the network parameters saved in non-volatile memory.
3. Repeat for all nodes.
IV. Bringing Nodes Back Into the Network
1. In Network Analyzer perspective, navigate to the node's console and use the resume command
network-management resume
2. Do this for all nodes.
V. Sending CoAP messages
1. In the console send a CoAP POST message to your neighbor using their IP address and unique URI to toggle the LED. This CoAP POST message will toggle LED0 on the WSTK and print out "Toggle LED" on the receiving node.
coap post <destination> <uri> <body>
Example:
coap post "fd00:db8::d9dd:b493:143b:9cbc" "reed/toggle" "1"
Building a Thread Router Eligible End Device Application (with Silicon Labs Thread 2.7.1) Part 2.
A step-by-step guide to creating, building, and running your own Router Eligible End Device (REED) application based on the Silicon Labs Thread stack. Before tackling this tutorial, please checkout "Building a Thread Router Eligible End Device Application" tutorial first.
This tutorial expands on Part 1 by adding a handler for a received CoAP message.
Requirements:
Software:
Hardware:
I. Updating Configuration for REED
1. Go back to the ISC configuration file we created in the previous exercise (ThreadReed271EFR32.isc).
2. Navigate to the "Plugins" tab:
a. Select "CoAP Dispatch".
b. Remove "CoAP Debug" as there are some conflicts.
3. Under the "Other" tab:
a. Add a CoAP Dispatch item.
i. Change Method to POST.
ii. Change URI Path to "reed/toggle".
iii. Change Handler to "reedToggleHandler".
4. Click "Generate". AppBuilder will ask you to validate the generation to make sure which files can be overwritten. Make sure thread-callbacks.c is unchecked. Click OK.
5. In the "Generation successful" window click OK.
6. Save the ISC file.
II. Add Code and Build Projects in Simplicity Studio IDE
1. In thread-callbacks.c add the following code to have the node respond to CoAP messages. This Handler will respond to "reed/toggle" URI, toggle an LED on the WSTK, and print a statement to the console.
2. Build your project and ensure that it completes with zero errors.
III. Load Application to All WSTKs
1. In Network Analyzer perspective, click on a node for your application and disconnect from the device (for the EFR32). Then select "Flash/Upload".
2. Upload only the updated application. This time DO NOT erase the chip because we want to keep the network parameters saved in non-volatile memory.
3. Repeat for all nodes.
IV. Bringing Nodes Back Into the Network
1. In Network Analyzer perspective, navigate to the node's console and use the resume command
2. Do this for all nodes.
V. Sending CoAP messages
1. In the console send a CoAP POST message to your neighbor using their IP address and unique URI to toggle the LED. This CoAP POST message will toggle LED0 on the WSTK and print out "Toggle LED" on the receiving node.
Example:
VI. Expanding application
The third part of this tutorial adds functionality to the sending node.