Sensor and Collector - TI 15.4-Stack#

Introduction#

TI 15.4-Stack is an IEEE 802.15.4e/g RF communication stack. It is a main part of the SimpleLink Software Development Kits (SDKs), and provides support for star-topology networks for a Sub-1 GHz application or a 2.4 GHz application. TI 15.4-Stack runs on MCUs from TI’s SimpleLink microcontroller (MCU) family of devices. The Sub-1 GHz implementation offers several key benefits such as longer range in FCC band and better protection against in-band interference by implementing frequency hopping. This complete stack offering provides an accelerated time to market with a complete end-to-end node-to-gateway solution.

In this lab, we will run a pair of examples based on the complete TI 15.4-Stack, one sensor and one collector - creating a star network of sensor node(s) sending data to a collector.

  • The collector example application implements the PAN-Coordinator, or the central node in the network. This application starts the network, allows devices to join the network, and configures the joining devices on how often to report the sensor data. It then sends periodic tracking request messages (to which it expects tracking response messages) to determine whether or not the sensor nodes are alive in the network.

  • The sensor example application implements the networked device, which joins the network started by the collector. The sensor periodically sends sensor data reports at the report interval configured by the collector and responds to the tracking messages it receives.

The purpose of this lab is to familiarize the reader with the TI 15.4-Stack and with tools such as Code Composer Studio, by importing existing examples into the IDE. The lab contain several tasks:

Task 1: Building and loading the collector example.

Task 2: Building and loading the sensor example.

Task 3: Using the collector and sensor.

Task 4: Updating the sensor’s reporting rate.

Further reading#

This lab is the recommended first step for getting started with the TI 15.4-Stack, it is intended to teach you to quickly bring up a working network. As such, many useful features in TI 15.4-Stack are not discussed here. To learn more about features such as beacon vs. non-beacon mode, frequency hopping and more, please see the TI 15.4-Stack User’s Guide

Technical support

For any questions you may have, please consult the relevant E2E forum, TI Sub-1 GHz E2E Forum.

Supported Devices#

For a list of devices supported by the TI 15.4-Stack, please see the TI 15.4-Stack Release Notes. The instructions in this lab should apply to all supported devices.

Prerequisites#

Background#

  • Basic TI-RTOS and CCS knowledge

  • Some basic familiarity with embedded programming.

Software#

Hardware#

  • 2 x Compatible LaunchPads, refer to the Supported Devices/SDKs section

  • 2 x USB Cables

Note

Some screenshots in this lab may have been taken with an older version of the SDK or tool, so your actual screen may look a bit different, however the functionality and overall look and feel should be the same.

Group training additional requirements#

Hint

Channel allocation

If you are part of a group training, the instructor should give each student a dedicated channel to avoid interference. For example, give each student a unique number. In this lab, each student uses a designated channel matching their student number: Student #1 should use channel 1, Student #2 should use channel 2, and so on.

Make sure to always use your designated channel, to avoid interfering with other students’ operations.

Task 1: Building and loading the collector example#

  1. Label one LaunchPad as “sensor” and the other as “collector”. These labels will be referred to throughout this lab. It is recommended to use a non-permanent marking for this (e.g. sticky notes), as these labels may only be relevant for this specific lab.

  2. In CCS, open the resource explorer (viewResource Explorer)

  3. Expand the folders and select as in the following capture, then click Import To IDE: (Note: make sure to select the appropriate collector project for your platform. E.g. if you are using CC2652, select the CC2652 collector project.)

../../../_images/Figure3.png

Resource Explorer#

  1. Load the collector project onto the “collector” LaunchPad.

  2. If you are using a 2.4 GHz project, skip to step 7. Otherwise select your PHY as explained below.

Selecting the right PHY

The regulations in different parts of the world require the use of different frequency bands. A rough version is:

  • 915 MHz in the US

  • 868 MHz in Europe

  • 433 MHz in China

For each of the frequency bands above, TI 15.4-Stack provides selection between operation modes:

  • A faster default mode (50kbps data rate)

  • LRM - long-range mode (5kbps data rate over a longer range)

  • A high speed mode (200kbps data rate)

For this lab, please select the 50 kbps mode of the required frequency band. After finishing the official lab content, you may also experiment with the other modes.

  1. Locate the file collector.syscfg in the project explorer, and open it by double-clicking it.

../../../_images/syscfg_location.png

Resource Explorer#

  1. You are responsible to select the right PHY, according to the region of operation and the desired range. This is done by modifying the value of Sub-1 Ghz frequency under the Radio Tab with one of the values from the drop down list.

../../../_images/PHY_Selection.png

Resource Explorer#

  1. The stack can be configured to enable any of the supported channels. If more than one channel is enabled, the best (“most quiet”) channel is selected by the collector when starting the network. When the sensor looks for a network to join, it scans all the enabled channels until it finds the collector.

    In a group, each student should update their channel map such that only their designated channel is enabled, and all other channels are disabled.

    To enable the required channel and disable the other channels, you will need to edit the channel mask definition under the Network Settings in the collector.syscfg file. This configuration item is a bitmask representing all the available channels, this is represented as a drop down menu and you can select the channels you want transmit on by checking the box.

Available Channels

The number of supported channels may be limited, depending on the frequency band being used. Please make sure to select a channel within the supported range:

  • 2.4 GHz band - channels 11 to 26 - total of 16 channels

  • 915 MHz band - channels 0 to 128 - total of 129 channels

  • 868 MHz band - channels 0 to 33 - total of 34 channels

  • 433 MHz band - channels 0 to 6 - total of 7 channels

Multiple ways to prevent conflicts

In this lab, each student uses a different channel in order to avoid conflicts. Using TI 15.4-Stack, there is another way to avoid conflicts, which allows using the same channels by everyone. This method involves pre-assigning the same PAN-ID to every device in the intended network, and different PAN-IDs to different networks. The stack will automatically filter and accept only the packets targeted for its PAN. The downside of this would be that in a large classroom with many setups this could lead to channel congestion and a high rate of dropped packets.

  1. Connect the “collector” LaunchPad to your PC

  2. Build the project and download it to the LaunchPad by selecting the collector project in the project explorer and clicking the green bug (or hitting F11)

  3. When programming is finished, terminate the debug session by clicking the red square (or select RunTerminate).

Task 2: Building and loading the sensor example#

  1. Repeat Task 1, but this time select the sensor project when importing and building and use the “sensor” LaunchPad.

Warning

Make sure you did not forget to change the radio settings and the channel mask for the sensor project as well.

Task 3: Using the Collector and Sensor#

  1. Close CCS and make sure no terminal program is running.

  2. Disconnect, then reconnect both LaunchPads to your PC. Otherwise the LaunchPads’ Application UART may not be available.

  3. Open two instances of the terminal program. Connect each to a different LaunchPad’s COM port - these ports should have the word ‘UART’ in their names. For example, in the following image, the you should select COM111 and COM114:

../../../_images/Figure4.png

Resource Explorer#

  1. Configure the UARTs as follows:

  • Baud rate: 115200

  • Data: 8 bit

  • Parity: none

  • Stop: 1 bit

  • Flow control: none.

  1. Reset each of the LaunchPads to Factory New state by pressing and holding BTN-2, and then pressing the Reset button (while BTN-2 is held down).

Observe and Understand

The collector terminal should look like this:

../../../_images/Figure5.png

Collector terminal#

The sensor terminal like this:

../../../_images/Figure7.png

Sensor terminal#

  1. Press BTN-1 on the collector to start the network. The red LED on the collector should turn on after a short while, and the LEDs on the sensor should both remain off. The red LED on the collector means that it has successfully created a network. The collector terminal will now also say “Started–Mode=NBCN, Addr=0xaabb, PanId=0x0001, Ch=x, PermitJoin=Off”, where x will be the number of the actual channel that was selected.

  2. Press BTN-2 on the collector to allow new devices to join the network. The red LED will start blinking, meaning that the network is now open for joining, and the collector’s terminal will say “PermitJoin=On”.

  3. Press BTN-1 on the sensor to start looking for a network to connect to.

Observe and Understand

The sensor will join the network after a short while, indicated by the sensor red LED turning on. The collector’s terminal will say “Joined: 0xX” where 0xX is the sensor ID, and the sensor’s terminal will say “Status: Joined–Mode=NBCN, Addr=0xX, PanId=0x0001, Ch=x” (0xX is the sensor ID), indicating successful network connection.

Error

If the sensor does not join after a short while, please reset it using the reset button.

  1. To close the network from allowing new devices to join, press the collector’s BTN-2 again. The collector red LED will stop blinking and remain on.

Observe and Understand
  • The collector’s terminal will say “Device Status: Sensor - Addr=0xX, Temp=x, RSSI=-x” when a sensor reading is received from the sensor node.

  • Whenever a reading is sent from the sensor or received by the collector, the green LED will toggle on the sensor / collector respectively.

  • Readings are sent from the sensor periodically. By default, the period configured by the collector is 3 seconds. If the sensor fails to receive the configuration from the collector, it will send the readings every 3 seconds.

  • Commands from the collector to the sensor can be sent only when the sensor is polling for data. These poll requests are sent by the sensor periodically, the sensor is allowed to sleep in the meantime. The default sensor poll rate is 2 seconds. This poll rate can be changed by the collector as part of the configuration message.

  1. Toggle command: By pressing BTN-1 on the collector, you can toggle the red LED on the sensor. Try this a few times. Notice that the LED state may take up to 6 seconds to change, since the collector can only send the toggle command following a poll request from the sensor.

Warning

Note that if more than one sensor is connected to the same collector, the toggle command will only be sent to sensor #1 (the first to join the collector).

Task 4: Updating the sensor’s reporting rate#

Now let’s make the reporting and the polling rate higher, to get a more responsive demo. All values below are in milliseconds.

  1. Open CCS, using the same workspace you used before

  2. Open collector.syscfg and sensor.syscfg, navigate to TI 15.4 Stack, open the Network settings and scroll down to the Application tab.

  3. Update the reporting interval of the sensor: In sensor.syscfg set Reporting Interval(ms) to 1500 (instead of 3000). (Do not change the polling interval in this file.)

  4. Update the reporting interval that the collector will request from the sensor: In collector.syscfg, set Reporting Interval to 1500 (instead of 3000)

  5. In the same file, Update the polling interval that the collector will request from the sensor - set CONFIG_POLLING_INTERVAL to 1000 (instead of 2000)

  6. Rebuild the collector and sensor projects, and program the LaunchPads with the new builds, by following the next steps for each of the two projects:

  • Select the project in Project Explorer

  • Build and download to target by clicking the green bug icon

  • Stop the debug session by clicking the red square icon once it becomes available

  1. Reset both devices to Factory New (press the Reset button while holding BTN-2) and have the sensor connect to the collector as explained in the previous task.

Observe and Understand

See how the changes you made affect the sensor operation:

  • As soon as the sensor connects to the network, the reporting rate is 1500 ms.

  • After about 2 seconds, the sensor polls for data and the configuration message is sent from the collector.

  • Reporting rate is changed to 1 second.

  • After a few more seconds, when the existing polling timer expires, the polling rate is increased to 1000 ms - as evident by the high responsiveness of the sensor’s red LED when pressing the collector’s BTN-1 (i.e when sending the Toggle command).

References#

TI 15.4-Stack User’s Guide – Available here.

TI Sub-1 GHz E2E ForumTI Sub-1 GHz E2E Forum

CC13xx/CC26xx Software Overview – Available at https://www.ti.com/tool/SIMPLELINK-LOWPOWER-SDK.