rfWsnConcentratorDmOad Example
Example Summary
The WSN Dual Mode Concentrator example illustrates how to implement a sub-1GHz Wireless Sensor Network Concentrator device which listens for packets from other nodes. This example is meant to be used together with the WSN Dual Mode Node example to form a one-to-many network where the nodes send messages to the concentrator. Both the Nodes and Concentrator can be configured to also send BLE beacons.
The Dual Mode Concentrator receives sensor data from the Dual Mode Nodes and displays the sensor reading on UART and LCD. The concentrator can also be configured by a button press to also send out BLE advertisements (beacons) packets, the beacon then contain sensor data from one of the nodes. The concentrator effectivly acts as a relay for the sub-1GHz sensor data to the BLE beacon packet.
This examples showcases the use of several Tasks, Semaphores and Events to receive packets, send acknowledgements and display the received data on the LCD. For the radio layer, this example uses the EasyLink API which provides an easy-to-use API for the most frequently used radio operations.
Peripherals Exercised
LCD
- When the concentrator receives data from a new node, it is given a new row on the LCD/UART and the reveived value is shown. If more than 7 nodes are detected, the device list rolls over, overriding the first. The supported LCD is the MSP430-SHARP96 boosterpack.UART
- The information displayed on the LCD is also replicated on the UART incase the LCD is not fitted.Board_PIN_LED1
- Toggled when Sub1-GHz data is received over the RF interface.Board_PIN_LED2
- Toggled when a BLE beacon is sent over the RF interface.Board_PIN_BUTTON0
- Selects the device which BLE data is forwarded for. Selected device is indecated by a ’*’next to the device on te LCD and UARTBoard_PIN_BUTTON1
- Selects the BLE beacon type used;- Manufacturer Specific (MS) + Eddystone URL. This is the default.
- MS
- Eddystone URL + TLM
- Eddystone UID + TLM
None
Whenever an updated value is received from a node, it is updated on the LCD display.
Resources & Jumper Settings
If you’re using an IDE (such as CCS or IAR), please refer to Board.html in your project directory for resources used and board-specific jumper settings. Otherwise, you can find Board.html in the directory <SDK_INSTALL_DIR>/source/ti/boards/<BOARD>.
Fields left blank have no specific settings for this example.
Example Usage
- Run the example. On another board (or several boards) run the WSN Dual Mode Node example. The LCD will show the discovered node(s). To create a sub-1GHz only device, without the capability to send BLE beacon, one can use the Wireless Sensor Network examples also.
*Use the buttons to select a node and beacon type and use any smarthone application that decodes the Eddystone beacons to view the beacon data. To view MS beacon, use the TI SensorTag smartphone app.
The example also support Over The Air Update (OAD), where new FW can be loaded over OAD. The must be an OAD Server, which is included in the concentrator, and an OAD client which is included in the sensor.
Generating the required binary images
For generating the images the following tools are required:
CCSv7
https://processors.wiki.ti.com/index.php/Download_CCSsimplelink_cc13x0_sdk_1_31_00_xx
https://www.ti.com/tool/simplelink-cc13x0-sdkPython 2.7
Python intelhex-2.1
Python crcmod-1.7
The prebuilt BIM binary is generated from the BLE SDK projects:
- CCS:
<SDK_DIR>\examples\rtos\CC1350_LAUNCHXL\blestack\util\bim_extflash\tirtos\ccs
- IAR:
<SDK_DIR>\examples\rtos\CC1350_LAUNCHXL\blestack\util\bim_extflash\tirtos\iar
The python intelhex merge utility is used to combine the BIM and App into one hex file that can be downloaded with SmartRF Studio:
cd <SDK_DIR>/examples/rtos/CC1310_LAUNCHXL/easylink/hexfiles/oad
python /usr/bin/hexmerge.py -o rfWsnNodeOad_CC1310LP_all.hex "--overlap=error" rfWsnNodeOad_CC1310LP_app.hex bim_extflash_cc1350lp_bim.hex
An OAD image can then be created from the application image with the oad_image_tool.py:
python ../../../../../../tools/easylink/oad_image_tool.py -v 0x[major version:minor version] -i app rfWsnNodeOad_CC1310LP_app.hex -ob rfWsnNodeOad_CC1310LP_app.bin -m 0x1000
Where major version (XX) and minor version (YY) must be of the format 0xXXYY, for example 2.3 would be 0x0203.
Using the OAD example
To be safe when using for the first time the external flash of the Concentrator and the Node should be wiped. Program both LP boards with bin/CC1350LaunchPad_ExtFlashErase.hex. The program will flash the LED’s while erasing and once finished the LED’s will stop flashing. Allow the application to run until the external flash has been erased and the LED’s stop flashing.
The wipe flash FW can be found in below lacation and should be downloaded with Uniflash programmer: <SDK_DIR>/hexfiles/native_oad/CC1350LaunchPad_ExtFlashErase.hex
The Concetrator OAD Server and Node OAD Client FW must then be loaded in to the LP’s using the Uniflash programmer:
- Load
\examples\rtos\CC1310_LAUNCHXL\easylink\hexfiles\oad\rfWsnConcentratorOad_CC1310LP_all.hex into a CC1310LP/CC1350LP - Load
\examples\rtos\CC1310_LAUNCHXL\easylink\hexfiles\oad\rfWsnNodeOad_CC1310LP_all.hex into a CC1310LP/CC1350LP
The Concetrator will display the below on the UART terminal:
Nodes Value SW RSSI
0x0b 0887 0 -080
0xdb 1036 0 -079
0x91 0940 0 -079
*Action: Update available FW
Info: Available FW unknown
cmd:
The node OAD image can be loaded into the external flash of the Concentrator over the UART with the oad_wrtie_bin.py script. The action must first be selected using BTN-2. Press BTN-2 until the Action is set to Update available FW
, then Press BTN-1 and Press BTN-2 to execute the action.
When “Available FW” is selected and BTN-2 is pressed the terminal will display:
Waiting for Node FW update...
The UART terminal must first be closed to free the com port. Then the python script run:
python ../../../../../../tools/easylink/oad/oad_wrtie_bin.py /dev/ttyS28 rfWsnNodeOad_CC1310LP_app.bin
After the download the UART terminal can be re-opened and the “Available FW” will be updated to reflect the new FW.
The current FW version running on the node can be requested using the Send FW Ver Req
action. This is done by pressing BTN-1 until Action
is selected. Then press BTN-2 until the Action is set to Update available FW
, The Press BTN-1 until intended device is selected. Press BTN-2 to execture the action.
The next time the node sends data it will respond and the FW version will be displayed:
Nodes Value SW RSSI
0x0b 0887 0 -080
0xdb 1036 0 -079
*0x91 0940 0 -079
Action: Update available FW
Info: Node 0x91 FW v1.0
The FW running on the nodes can now be updated to the available fw on the concentrator. The Action
must first be selected using BTN-1. The Press BTN-2 until the Action is set to Update node FW
, and Press BTN-1 until the intended device is selected. Press BTN-2 to execture the action.
The next time the node sends data it will respond and the FW update request and start requesting OAD blocks, which will be displayed:
Nodes Value SW RSSI
0x0b 0887 0 -080
0xdb 1036 0 -079
*0x91 0940 0 -079
Action: Update available FW
Info: OAD Block 14 of 1089
Once the OAD has completed the node will reset (if not yo may need to do a manual reset).
Building an OAD hex
The following steps talk through how to use CCS or IAR to create an OAD hex file which can be used to create the OAD biniaries as described in previous sections
Building the hex file in CCS
- Import the CCS porject into CCS(for more information conslt the Examples Users Guide in the proprietary-rf documentation)
- Exclude the ccfg.c file from the project.
- Enable hex file conversion in Project->Properties Arm Hex Utility
- Set memory width to 8 in General options
- Set output format to intel hex.
- Make a code change, for testing this can just be updating the nodeFwVersion string in NodeTask.c
- build
- copy hex from the projects Debug dir to the bin folder
Building the hex file in IAR
- Create a new IAR workspace
- Creae a new Empty IAR projectect and save it as rfWsnNodeOad
- Select Project -> “Add Project Connection” and add C:\ti\simplelink_cc13x0_sdk_1_xx_xx_xx\examples\rtos\CC1350_LAUNCHXL\easylink\rfWsnDmNodeOad\tirtos\iar\rfWsnDmNodeOad.ipcf
- Remove the ccfg.c file from the project.
- Enable hex file conversion in Project->Option Arm Hex Output Converter
- Check “Generate additional output”
- Set output format to Intel Extended hex.
- Make a code change, for testing this can just be updating the nodeFwVersion string in NodeTask.c
- build
- copy hex from the projects Debug dir to the bin folder
Building the hex file in CCS with GCC Compiler
- Import the GCC porject into CCS (for more information conslt the Examples Users Guide in the proprietary-rf documentation)
- Exclude the ccfg.c file from the project.
- Enable hex file conversion in Project->GNU Objcopy Utility
- In Edit flags add the following:
-O ihex --remove-section .vtable --remove-section .dmaSpi0RxControlTableEntry --remove-section .dmaSpi0TxControlTableEntry --remove-section .dmaSpi1RxControlTableEntry --remove-section .dmaSpi1TxControlTableEntry --gap-fill 0xff
- Make a code change, for testing this can just be updating the nodeFwVersion string in NodeTask.c
- Build
- copy hex from the projects Debug dir to the bin folder
Application Design Details
This examples consists of two tasks, one application task and one radio protocol task.
The Dual Mode ConcentratorRadioTask handles the radio protocol. This sets up the EasyLink API and uses it to always wait for packets on a set frequency. When it receives a valid packet, it checks to see if a BLE beacon should be sent and sends an ACK and then forwards it to the ConcentratorTask. By defuat the Dual Mode ConcentratorRadioTask does not send BLE beacons. Board_PIN_BUTTON0 and Board_PIN_BUTTON1 should be used to configure the beacons.
The ConentratorTask receives packets from the ConcentratorRadioTask and displays the data on the LCD.
RadioProtocol.h can also be used to change the PHY settings to be either the default IEEE 802.15.4g 50kbit, Long Range Mode or custom settings. In the case of custom settings, the smartrf_settings.c file is used. This can be changed either by exporting from Smart RF Studio or directly in the file.
For SensorTags there is a pin conflict, so either the DEVPACK-DEBUG or the DEVPACK-WATCH must be used and
BOARD_DISPLAY_EXCLUDE_UART
must be added to the global precompiler defines in order to use LCD.
For IAR users using any SensorTag(STK) Board, the XDS110 debugger must be selected with the 4-wire JTAG connection within your projects’ debugger configuration.
References
- For more information on the EasyLink API and usage.