Filter results by

Thread

Thread networking is designed to use the same wireless radio standard (IEEE 802.15.4) as ZigBee®, but uses different protocols that are designed to interact with Internet Protocol (IP) addressing and messaging. Using this methodology, IPv6-format messages pass throughout the system intact. Because these messages never need to be decrypted for conversion to an intermediate format, they stay secure throughout their travels.

All ARTIK modules with built-in IEEE 802.15.4 radios are programmable to support either Thread or ZigBee protocols.

  • ARTIK 5, 7, and 10 series modules include built-in IEEE 802.15.4 radios. These devices are designed for controller, hub, gateway, and border router applications.

  • The ARTIK 030 module of the ARTIK 0 series likewise uses the same, interoperable IEEE 802.15.4 radio. The ARTIK 030 processor is optimized for low-power, low-cost Thread router and end device applications.

Thread Application Tutorial

As Thread may be a fairly new technology to you, the best way to learn about it is to try it out! We present first an installation based on a pre-built image, so you won't need a software stack or compiler to get started.

The tutorial will use two ARTIK 030 boards, one configured as a Thread simple end device, the other as a Thread router-eligible end device (REED). Once the devices are joined on the network, they will be able to send messages to each other.

The time for completing the tutorial portion of this article is about 30 minutes, including the download and installation time for necessary software.

Prerequisites

  • Obtain two ARTIK 030 development kit boards

  • Install the Simplicity Studio® 4.0 software tool on your host PC.

Make sure you have your boards ready to plug in when you install the Simplicity Studio 4.0 software, so that they are automatically recognized and the appropriate drivers installed.

Thread Terminology

The following terms and roles are described in this Thread fundamentals document.

end device: Sends to and receives information from its connected router. May be battery-powered and is not required to stay connected.

router-eligible end device: Normally acts as an end device, but can act as a router if needed, in which case it must stay active and be fully powered.

commissioner, joiner, joiner router, Thread leader – different roles played by various Thread devices.

ulaUnique Local Address is a user-chosen value in the fdxx:xxxx:xxxx:: block for local site or private use. The address does not get directly routed outside the local network, but may be mapped to an IPv6 address through a border router.

Upload Image

You will first be uploading a single image to two different ARTIK 030 development boards. The initialization commands you send to each board later will determine whether that board becomes a simple Thread end device, or a Thread router-eligible end device (REED).

  1. Download a030_thread_tutorial_1.zip; unzip and save the thread_app_reed.s37 and bootloader.s37files on your PC (shown below saved in the c: root).

  2. Run the Simplicity Studio 4.0 program and go to the Simplicity IDE view.

  3. Connect both boards to your PC using their USB cables. The devices appear on the left of the screen with identifier numbers. You'll use these numbers to distinguish between router and end-device applications in the following steps.

  4. Upload the pre-built sample Thread image to both of the ARTIK 030 boards.

    a. Left-click to select one device, then shift-left-click on the other, selecting both.
    (For clarity, only one is shown selected below.)
    b. Right-click and choose Upload application… (see note below if not clickable)

    c. Browse to your downloads; select thread_app_reed.s37 as the main image.
    d. Click the "Bootloader" checkbox and select bootloader.s37 as its image.
    e. Click Erase chip so that the chip will be cleared before upload.
    f. Click OK.

  5. Open terminal emulator consoles to send commands and check status.
    a. Select both devices as you did above.
    b. Right-click and select Launch Console.

    Once you launch the console, Simplicity automatically connects over the J-Link serial bus. If you need to upload a different image later, hit Disconnect to again make the Upload application… selection clickable.

  6. The console windows default to a tabbed format where you can only see one at a time. Let's rearrange them and pre-select the active terminal tab we'll be using.

    • Click on and drag one of the tabs to the top, bottom, left, or right of the window; you'll see how it will split the window depending on where you release. A side-by-side view is helpful for our purposes.

    • Click on each main tab and select the Serial 1 sub-tab on each console window.

Configure as Router or End Device

With the pre-built image installed, both devices are now REED. We will now join REED to network using pre-commissioning – both devices are still REED, but one becomes ‘commissioner’ (router) and the other ‘joiner’ (end device).

Copy and paste the commands shown in blue to the command entry box at the bottom of the terminal windows. Substitute with parameters where indicated.

The command interpreter is unforgiving! Make sure your syntax is exactly as shown. Put master key and extended PAN ID in braces {..}, network ID and IP address strings in quotes "..", and PAN ID in hex (no quotes/braces).


Initialize Both

Start up each device the same way.

  1. Reset each device to clear any previous network information:
    network-management reset
    The command keyword can be shortened to network-man as we do hereafter.

  2. Set a private communications key for each device:
    network-man set-master-key { 00112233445566778899AABBCCDDEEFF}
    The key can be any sequence of sixteen hex numbers, but all must be specified.


Configure Router (Commissioner)

Use the terminal window of the device number you want to set as router. You will be enabling that device as a 'commissioner' that provides joining information to other devices.

  1. Form the network by copying in the command:
    network-man form 25 3 2 "PC1" "FD00:0DB8::"
    and you should see the message
      Form complete
  2. Request joining information by entering:
    info

That was it! You've enabled the unit as a Thread router.


In step 1, you specified:

_channel_ _power_ _node_type_ "_network_id_" "_ula_prefix_"

Step 2 returns that information, along with two "personal area network" (PAN) identifiers that the router itself generates for the current session:

thread> network status: 0x03
eui64: >AEAB54E66FFF6F4A
network id: PC1
node type: 0x02
extended pan id: >6314FACA447EFA23
pan id: 0xBEFB
channel: 25
radio tx power: 3 dBm 
ula prefix: fd00:db8::
local ip 0: fd00:db8::312f:5adc:8a68:2468
local ip 1: fe80::acab:54e6:6fff:6f4a

PAN identifiers allow "shorthand" addressing of Thread devices, instead of using the full IPv6 address each time. Each end device you set up will need them.


Configure End Device (Joiner)

Use the other terminal window to configure a simple end device. You will be pre-commissioning that device as a joiner to already know the network it wants to run on.

  1. Commission the end device with the PAN data you got from the router:
    network-man commission 25 0 "PC1" "FD00:0DB8::" { _extended_pan_id_ } { 00112233445566778899AABBCCDDEEFF} pan_id

    If the PAN information were from our example above, the entry would be:
    network-man commission 25 0 "PC1" "FD00:0DB8::" {6314FACA447EFA23} { 00112233445566778899AABBCCDDEEFF}  0xBEFB

  2. Join the network of the router you identified:
    network-man join-commissioned 3 2
    and you should see the message
      Join complete

That was it! You've enabled the unit as a Thread end device.


In step 1, you specified

_channel_ _power_ _node_type_ "_network_id_" "_ula_prefix_" 

just as you did for the router, but then you added

 "_extended_pan_id" { _master_key_} "_pan_id"

Why? Sharing the PAN identifiers, you have set up a "shorthand" means of communication within the local Thread network. Only an abbreviated address is used between the router and end device. Yet any other IPv6 network device in the world will see a full IPv6 address at your end device, allowing data to stay encrypted and secure end-to-end.

Communicate between Devices

If you saw the "Join complete" message in the previous section, your first Thread network is up and running. You can now communicate between your devices to check connectivity.


ICMP

Use info to find the IP address on one device, and then type a "ping" request into the terminal of the other device.
icmp ping "_local_ip_0"

For example, from the router console in the example above, we can see its full IPv6 address. We can then send it this ping request from the end-device console.

  icmp ping "fd00:db8::312f:5adc:8a68:2468"

You should see activity on both consoles:

Router:     ICMP ECHO_REQUEST [ABCD1234]
End Device: ICMP ECHO_REPLY [ABCD1234]


CoAP

Use info to find the IP address on one device, and then type a CoAP CLI command into the terminal of the other device.

coap post " _local_ip_0_ " "read/notice" "1"

For example, from the router console in the example above, we can see its full IPv6 address. We can then send it this CoAP post request from the end-device console.

coap post "fd00:db8::312f:5adc:8a68:2468" "read/notice" "1"

You should see activity on both consoles.

Router:

thread> CoAP RX: s=fd00:db8::701e:38ed:cdca:b0a0 POST u=read/notice t=99B6 p=31

End Device:

CoAP CLI: ACKED EMPTY


Custom Applications

We presented a simple introduction above to familiarize you with using the ARTIK 030 device in a Thread environment.

To begin developing your own Thread applications, you must install the IAR Systems compiler environment. Go now to the IAR Workbench® IDE section to get the software download underway.

Developing Router and End Device Applications

Once you have the IAR Embedded Workbench installed, a good way to start developing is to regenerate the source project for the tutorial we provided earlier.


Open New Project

  1. Run Simplicity Studio 4.0 and select the Simplicity IDE perspective.
  2. File -> New -> Project and select Silicon Labs AppBuilder Project
  3. Select Thread for Application.
  4. Click Start with a blank application and click Next.
  5. Provide a project name and click Next.
  6. Click Finish on the next screen.

Configure Functionality

Before we generate source code, we need to set up the functionality (for example, router capability) that we will want. Make the changes shown below, saving your work along the way using File –> Save or Ctrl-S.

  1. General tab. Click the Device type: button and add EFR32, SoC, and Router. You've just added the plugin options for the device types we intend to enable.

  2. Plugins tab. Select CoAP Debug and ICMP Debug, and un-select Heartbeat. These debug options let us test communications during the tutorial.

  3. Callbacks tab. To generate the framework code for callbacks we'll be wanting to write code for, select:

	emberFormNetworkReturn
	emberJoinNetworkReturn
	emberResetNetworkStateReturn
	emberResumeNetworkReturn

Remember to save your changes!


Generate and Build

To generate source code from your preconfigured selections, click Generate. * Make a note of the location of the .eww file -

In the Project Explorer window on the left, under your project name, you'll find all the source code files generated. We're going to add in some event debug messages, the same way the tutorial did. Except this time, we will add some punctuation so that you can see that your modifications took place.

  1. Locate and open the thread-callbacks.c file.

  2. In each of the callbacks you enabled above, paste in this code:

    boolean success = (status == EMBER_SUCCESS);
    emberSerialPrintf(APP_SERIAL, "\n_XXXX_ %s\n", success ? "complete!" : "failed...");

    replacing _XXXX_ with Form, Join, Reset, or Resume respectively.

  3. Save your changes.

Now you're ready to build. Click the Build icon.

You're done! Go back now to the Upload Image section to load your newly created image. While bootstrap loader will still be the same one you selected previously, the main image will be in a different location now. If you chose all the default file locations, it will most likely be here:

     C:/Users/_your_name_/SimplicityStudio/v4_workspace/thread_app_reed/IAR ARM - Debug/thread_app_reed.s37


Last updated on: