rfWsnNodeIntFlashOadClientUApp


Project Setup using the System Configuration Tool (SysConfig)

The purpose of SysConfig is to provide an easy to use interface for configuring drivers, RF stacks, and more. The .syscfg file provided with each example project has been configured and tested for that project. Changes to the .syscfg file may alter the behavior of the example away from default. Some parameters configured in SysConfig may require the use of specific APIs or additional modifications in the application source code. More information can be found in SysConfig by hovering over a configurable and clicking the question mark (?) next to it's name.

EasyLink Stack Configuration

Many parameters of the EasyLink stack can be configured using SysConfig including RX, TX, Radio, and Advanced settings. More information can be found in SysConfig by hovering over a configurable and clicking the question mark (?) next to it's name. Alternatively, refer to the System Configuration Tool (SysConfig) section of the Proprietary RF User's guide found in <SDK_INSTALL_DIR>/docs/proprietary-rf/proprietary-rf-users-guide.html.

Example Summary

The WSN Node Internal Flash OAD Client example illustrates how to create a Wireless Sensor Network Node device which sends sensor data to a Sub-1GHz WSN Concentrator OAD Server and also allows the device to wirelessly update its firmware through an OAD (Over the Air Download).

This examples showcases the use of several Tasks, Semaphores and Events to get sensor updates and send packets with acknowledgement from the concentrator. For the radio layer, this example uses the EasyLink API which provides an easy-to-use API for the most frequently used radio operations. This example builds upon the existing WSN Node; adding the ability to communicate with the OAD server using the OAD protocol. The Agama on-chip OAD client is split between two separate applications, the User App and the Persistent App.

The User App (U-App) is a limited functionality version of the OAD Client. It contains the ability to respond to firmware version requests, and can recognize OAD reset commands. Any other OAD protocol packets are not supported. When it is time to perform a firmware update the U-App will store the node and server addresses to NVS, and will invalidate its image header so that the BIM (Boot Image Manager) will skip over it during the boot sequence.

Peripherals Exercised

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>.

Example Usage

The example also supports Over The Air Download (OAD), where new FW can be transferred from the concentrator to the node. There must be an OAD Server, which is included in the concentrator project, and an OAD client, which is included in the node project.

Performing an OAD Image Transfer

To be safe the external flash of the Concentrator should be wiped before running the example. To do this, program both LP boards with erase_storage_offchip_cc13x2lp.hex. The program will flash the LEDs while erasing the external flash. Allow the application to run until the LEDs stop flashing indicating the external flash has been erased.

The FW to erase the external flash can be found in below location and should be loaded using Uniflash programmer: <SDK_DIR>/examples/rtos/CC1352R1_LAUNCHXL/easylink/hexfiles/offChipOad/erase_storage_offchip_cc13x2lp.hex

OAD with Easylink

The Concentrator OAD Server and Node OAD Client FW should each be loaded into a CC1312R1LP/CC1352R1LP using the Uniflash programmer:

The Concentrator 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

Use the node display to identify the corresponding node ID:

Node ID: 0x91
Node ADC Reading: 1196

The node OAD image can be loaded into the external flash of the Concentrator through the UART with the oad_write_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 BTN-2 simultaneously to execute the action.

When "Available FW" is selected the terminal will display:

    Waiting for Node FW update...

The UART terminal must be closed to free the COM port before the script is run. Then the python script can be run using the following command:

    python <SDK>/tools/easylink/oad/oad_write_bin.py /dev/ttyS28 <SDK_DIR>/examples/rtos/CC1352R1_LAUNCHXL/easylink/hexfiles/onChipOad/rfWsnNodeIntFlashOadClientUApp_CC1352R1_LAUNCHXL_app_v2.bin

After the download the UART terminal can be re-opened and the "Info" menu line will be updated to reflect the new FW available for OAD to a node.

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 the desired node is selected (indicated by the *), then pressing BTN-2 until the Action is set to Send FW Ver Req. To execute the action, press BTN-1 and BTN-2 simultaneously.

The next time the node sends data to the concentrator, the FW version of the selected node will appear in the Info section.

Nodes   Value   SW    RSSI
 0x0b    0887    0    -080
 0xdb    1036    0    -079
*0x91    0940    0    -079
Action: Send FW Ver Req
Info: Node 0x91 FW sv:0001, bv:01

Where: * sv is the FW version number * bv is the version number of the BIM

The node FW can now be updated to the image stored on the external flash of the concentrator. Press BTN-1 until the desired node is selected, then press BTN-2 until the Action is set to Update node FW. To execute the action, press BTN-1 and BTN-2 simultaneously.

The next time the node sends data, the OAD sequence will begin. As the node requests each image block from the concentrator the Concentrator display is updated to show the progress of the image transfer.

Nodes   Value   SW    RSSI
 0x0b    0887    0    -080
 0xdb    1036    0    -079
*0x91    0940    0    -079
Action: Update node FW
Info: OAD Block 14 of 1089

The node display also updates to show the status of the image transfer.

Node ID: 0x91
Node ADC Reading: 3093
OAD Block: 14 of 1089
OAD Block Retries: 0

Once the OAD has completed, the concentrator will indicate that the transfer has finished with an OAD Complete status. The node will reset itself with a new node ID. If the device does not reset itself a manual reset may be necessary.

Nodes   Value   SW    RSSI
 0x0b    0887    0    -080
 0xdb    1036    0    -079
*0xe2    0940    0    -079
Action: Update node FW
Info: Node 0xe2 FW Unknown

A firmware version request can then be performed to verify the new image.

Generating OAD Images

For generating the images the following tools are required: - Code Composer Studio -- Download the latest version from https://www.ti.com/tool/CCSTUDIO - Simplelink CC13X2 SDK -- Download the latest version from https://www.ti.com/tool/SIMPLELINK-CC13X2-26x2-SDK - Python 2.7 - Python intelhex-2.1 - Python crcmod-1.7

Creating the Application Hex Image

To generate the application hex file, the project should be imported and built with the desired compiler. To change the FW version, update the following string in oad/native_oad/oad_image_header_app.c

#define SOFTWARE_VER            {'0', '2', '0', '1'}

where the above would correspond to v2.01 for the software version.

Creating the Application Binary Image

Add the following post build step. In Code Composer Studio, navigate to Project → Properties → Build, then clicking the Steps tab. In IAR Embedded Workbench, navigate to Options → Build Actions and appending the new step with a semicolon separator.

${COM_TI_SIMPLELINK_CC13X2_SDK_INSTALL_DIR}/tools/common/oad/oad_image_tool  --verbose <compiler> ${PROJECT_LOC} 7 -hex1 ${ConfigName}/${ProjName}.hex -o ${ConfigName}/${ProjName}

Make sure to replace <compiler> with the appropriate compiler (ccs, gcc, or iar).

If the application was built with the SECURITY flag then the OAD image tool needs an extra option -k plus the path to a generated private key. In order to generate a key go to /tools/common/oad/keys and run key_generate.py.

${COM_TI_SIMPLELINK_CC13X2_SDK_INSTALL_DIR}/tools/common/oad/oad_image_tool  --verbose <compiler> ${PROJECT_LOC} 7 -hex1 ${ConfigName}/${ProjName}.hex -o ${ConfigName}/${ProjName} -k ${COM_TI_SIMPLELINK_CC13X2_SDK_INSTALL_DIR}/tools/common/oad/keys/private.pem

* Note The OAD binary will be generated in the Debug dir in the project. The .out file can be used for debugging through CCS without any changes to the BIM. However, if the .out file is flashed to the device the JTAG_DEBUG compiler flag must be defined in the BIM project. *

* Note If building the BIM project only, make sure that either the Debug_unsecure or Release_unsecure build configurations are selected *

Application Design Details

Internal Flash Layout

|----------------------| 0x58000
|         BIM          |
|----------------------| 0x56000
|                      |
|                      |
|        P-App         |
|                      |
|                      |
|----------------------| 0x44000
|         NVS          |
|----------------------| 0x42000
|    Unused Space      |
|----------------------| 0x40000
|                      |
|                      |
|                      |
|        U-App         |
|                      |
|                      |
|                      |
|----------------------| 0x00000

References