Building a Thread Router Eligible End Device Application (with Silicon Labs Thread 2.7.1) Part 1.
01/01/2018 | 01:59 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 Thread Sample Applications" tutorial first.
I. Launch Simplicity Studio and start a blank application
1. Make sure at least two nodes are present with EFR32s under Devices.
2. Go to File -> New -> Silicon Labs AppBuilder Project.
3. Select Silicon Labs Thread 2.7.1.
4. Check on "Start with a blank application". Click Next.
5. Name your project. For example ThreadReed271BRD4162A.
6. In next window (Project Setup), check if Simplicity Studio detected correct board, part, and toolchain. In this example we're using BRD4162A, EFR32MG12P332F1024GL125, and IAR ARM 7.80.
II. Configuring REED
1. Under the "General" tab:
a. Update the "Device name" to project's name (ie ThreadReed271BRD4162A).
b. Open "Device type" dialog:
i. Select EFR32 and add device to "Selected devices and plugins".
ii. Select SoC and add device to "Selected devices and plugins".
iii. Select Router and add device to "Selected devices and plugins".
iv. Close dialog by clicking OK.
2. Under the "HAL" tab:
a. Set Bootloader to Application type.
b. Set to Use Hardware Configurator.
3. Open Hardware Configurator
a. Under DefaultMode Peripherals tab
i. Check on GPIO, set SWO pin to PF2
ii. Check on Serial, set Port to USART0
iii. Check on Virtual COM Port, set enable pin to PA5
4. Save HWCONF file by going to File -> Save and go back to your project's ISC file.
5. Under the "Printing" tab:
a. Make sure "Enable debug printing" is checked.
b. Make sure under functional area Core and Application are checked in both "Compiled in" and Enabled at startup".
6. Under the "ZCL over IP" tab, we do not have anything to add.
7. Under the "Plugins" tab:
a. Add CoAP Debug under the Common section. This will give us CoAP debug output in the console.
b. Add ICMP Debug under the Common section. This will give us ICMP debug output in the console.
c. Add Serial Plugin (if not already added), and set port to USART0.
d. Add Debug JTAG and remove Debug JTAG stub.
e. Add Radio Coexistence to cover dependencies in HAL library.
8. Under the "Callbacks" tab:
a. Select emberFormNetworkReturn - check "Is Used"; Stub should be check automatically.
b. Select emberJoinNetworkReturn.
c. Select emberResetNetworkStateReturn.
d. Select emberResumeNetworkReturn.
9. Under the "Other" tab, we do not have anything to add.
10. Click "Generate". Notice project appeared in Project Explorer. Click OK.
11. Save ISC file.
III. Add Code and Build Projects
1. Go to Simplicity IDE perspective. In Project Explorer, expand your Reed project.
2. Add the following ifdef to thread-callbacks.c to enable debug printing.
3. Add the following code to thread-callbacks.c file. The functions should already be available after generating the project through AppBuilder. This will give us some useful output in serial console.
4. Compile your project by right-clicking on project name and using "Build project" option.
5. Make sure your build is successful and the compiled binary is located in project directory tree under "IAR ARM - Default" folder.
IV. Load Application and Bootloader to EFR32MG module on WSTK
1. As described in "Building Thread Sample Applications" section 7. Load the Reed application and bootloader to two available devices.
(To build a specific bootloader check out UG266 and AN1048.)
V. Adding nodes to a network using pre-commissioning
1. In Network Analyzer perspective, in the Devices view, right-click on a node and select "Connect" then right-click again and select "Launch Console".
a. Navigate to "Serial 1" tab and press the return key a few times to get a prompt.
b. Find out the state of your device using the "Info" command. The output should output network status of 0x00 (EMBER_NO_NETWORK).
c. If your device has an ip address, reset the network parameters by issuing the command:
network-management reset
2. For the first device on the network we will need to form the network
a. Set the master key issuing command:
network-management form <channel:1> <power:1> <node type:1> [<network id:0--16> [<ula prefix>]
Example:
network-management form 25 3 2 "Honey Badger" "FD00:0DB8::/64"
c. Check network status using the info command. Network status should be 0x03 (EMBER_JOINED_NETWORK_ATTACHED).
3. For the second node (or any node after)
a. In the "Serial 1" console make sure the node is not already in a network.
b. Set Commissioning information for the device. Note the PAN ID, Extended PAN ID, and Network ID are set by the Leader (our first node on the network). Use the info command on the Leader node to get proper parameters for the network. Gather the channel, channel mask (0x0C00), network id, ula prefix, extended pan id, master key (from above command), and pan id.
This tutorial doesn't work on custom designs. It would be nice to have a tutorial or at least a document about custom designs programming. I'm happy i can work with S.L. demo boards but after that i have to program my custom design. I can't get any info about the bootloader option on the thread stack configuration GUI, can i choose "None" for example? After choosing "Local storage" and after compiling the gecko bootloader for internal flash how can i upload the bootloader to the MGM12 module? I tried with the flash programmer but it doesn't seem to work, the .s37 file is flashed but then i can't debug the Thread Server example project.
Building a Thread Router Eligible End Device Application (with Silicon Labs Thread 2.7.1) Part 1.
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 Thread Sample Applications" tutorial first.
This KBA works with:
I. Launch Simplicity Studio and start a blank application
1. Make sure at least two nodes are present with EFR32s under Devices.
2. Go to File -> New -> Silicon Labs AppBuilder Project.
3. Select Silicon Labs Thread 2.7.1.
4. Check on "Start with a blank application". Click Next.
5. Name your project. For example ThreadReed271BRD4162A.
6. In next window (Project Setup), check if Simplicity Studio detected correct board, part, and toolchain. In this example we're using BRD4162A, EFR32MG12P332F1024GL125, and IAR ARM 7.80.
II. Configuring REED
1. Under the "General" tab:
a. Update the "Device name" to project's name (ie ThreadReed271BRD4162A).
b. Open "Device type" dialog:
i. Select EFR32 and add device to "Selected devices and plugins".
ii. Select SoC and add device to "Selected devices and plugins".
iii. Select Router and add device to "Selected devices and plugins".
iv. Close dialog by clicking OK.
2. Under the "HAL" tab:
a. Set Bootloader to Application type.
b. Set to Use Hardware Configurator.
3. Open Hardware Configurator
a. Under DefaultMode Peripherals tab
i. Check on GPIO, set SWO pin to PF2
ii. Check on Serial, set Port to USART0
iii. Check on Virtual COM Port, set enable pin to PA5
4. Save HWCONF file by going to File -> Save and go back to your project's ISC file.
5. Under the "Printing" tab:
a. Make sure "Enable debug printing" is checked.
b. Make sure under functional area Core and Application are checked in both "Compiled in" and Enabled at startup".
6. Under the "ZCL over IP" tab, we do not have anything to add.
7. Under the "Plugins" tab:
a. Add CoAP Debug under the Common section. This will give us CoAP debug output in the console.
b. Add ICMP Debug under the Common section. This will give us ICMP debug output in the console.
c. Add Serial Plugin (if not already added), and set port to USART0.
d. Add Debug JTAG and remove Debug JTAG stub.
e. Add Radio Coexistence to cover dependencies in HAL library.
8. Under the "Callbacks" tab:
a. Select emberFormNetworkReturn - check "Is Used"; Stub should be check automatically.
b. Select emberJoinNetworkReturn.
c. Select emberResetNetworkStateReturn.
d. Select emberResumeNetworkReturn.
9. Under the "Other" tab, we do not have anything to add.
10. Click "Generate". Notice project appeared in Project Explorer. Click OK.
11. Save ISC file.
III. Add Code and Build Projects
1. Go to Simplicity IDE perspective. In Project Explorer, expand your Reed project.
2. Add the following ifdef to thread-callbacks.c to enable debug printing.
3. Add the following code to thread-callbacks.c file. The functions should already be available after generating the project through AppBuilder. This will give us some useful output in serial console.
4. Compile your project by right-clicking on project name and using "Build project" option.
5. Make sure your build is successful and the compiled binary is located in project directory tree under "IAR ARM - Default" folder.
IV. Load Application and Bootloader to EFR32MG module on WSTK
1. As described in "Building Thread Sample Applications" section 7. Load the Reed application and bootloader to two available devices.
(To build a specific bootloader check out UG266 and AN1048.)
V. Adding nodes to a network using pre-commissioning
1. In Network Analyzer perspective, in the Devices view, right-click on a node and select "Connect" then right-click again and select "Launch Console".
a. Navigate to "Serial 1" tab and press the return key a few times to get a prompt.
b. Find out the state of your device using the "Info" command. The output should output network status of 0x00 (EMBER_NO_NETWORK).
c. If your device has an ip address, reset the network parameters by issuing the command:
2. For the first device on the network we will need to form the network
a. Set the master key issuing command:
b. Set network parameters for the network.
Example:
c. Check network status using the info command. Network status should be 0x03 (EMBER_JOINED_NETWORK_ATTACHED).
3. For the second node (or any node after)
a. In the "Serial 1" console make sure the node is not already in a network.
b. Set Commissioning information for the device. Note the PAN ID, Extended PAN ID, and Network ID are set by the Leader (our first node on the network). Use the info command on the Leader node to get proper parameters for the network. Gather the channel, channel mask (0x0C00), network id, ula prefix, extended pan id, master key (from above command), and pan id.
Example for a node joining pan id 0x6F29 on channel 12:
4. Join the pre-commissioned device to the network.
a. Use the following command
Example for radio tx power set to 1dBm on a router:
5. Check the status of the node by using the info command. Network status should be 0x03 (EMBER_JOINED_NETWORK_ATTACHED).
VI. Sending Messages
1. In the Console ping one of the devices in the network, for example ping the Leader's IP address using:
Example:
2. In the Console send a CoAP POST message
Example:
VII. Expanding Application
The second part of the tutorial adds functionality to the receiving node.
Please can you tell me specifically wherew the following is added. Thanks, Gary.
Hello,
This tutorial doesn't work on custom designs. It would be nice to have a tutorial or at least a document about custom designs programming. I'm happy i can work with S.L. demo boards but after that i have to program my custom design. I can't get any info about the bootloader option on the thread stack configuration GUI, can i choose "None" for example? After choosing "Local storage" and after compiling the gecko bootloader for internal flash how can i upload the bootloader to the MGM12 module? I tried with the flash programmer but it doesn't seem to work, the .s37 file is flashed but then i can't debug the Thread Server example project.
Leonardo