You can use either CCS desktop or cloud version to modify SensorTag firmware.

If using the desktop version, remember to backup the BLE-STACK folder before modifying and set the workspace to the Projects folder.

Debugger DevPak and SensorTag

SensorTag and Debugger

To connect the debugger into the SensorTag, remove a small piece needs from the SensorTag case. Or we can use the SensorTag without its case.

SensorTag and Debugger

  • Connect the USB cable to the debugger first and plug it to the SensorTag.
  • Wait for the driver to be installed. It may take some time to complete.

Do not remove the battery from the SensorTag, or CCS will talk to the debugger (trying to upgrade its firmware) and not the SensorTag itself. Moreover, do not plug in the debugger to the SensorTag without the battery or it may damage the debugger.

Import the firmware project

For CCS desktop

The firmware for the SensorTag is in the BLE SDK installation $BLE_INSTALL$\Projects\ble\SensorTag. It is possible to set the CCS workspace to the Projects folder and then import the SensorTag project.

For CCS cloud

  • Open https://dev.ti.com
  • Select Resource Explorer
  • Search for CC2650 Bluetooth Smart SensorTag and import the SensorTag example to the CCS cloud.
  • Two projects will be imported into the CCS cloud workspace: SensorTag and its dependency, SensorTagStack.

Modify the firmware

  • Open SensorTag\Application\SensorTag.c.
  • Save as this file into a new folder called MyApp in SensorTag folder.
  • Exclude the original file from build process: Right click and select Exclude from Build.
  • Modify the file in the MyApp folder.
  • Built and flash the firmware. It may require to install TI Cloud Agent Application if using CCS cloud and update the firmware.

How to build the firmware from source

Although I followed the instruction here, something need to update for it to work correctly.

Download Python first as you’ll need it to run a script to merge three hex files into a single one. Then, I’ll need the hexmerge.py script, see here or here. Unzip this file and in command window, run

> python setup.py install

In order to rebuild the firmware, I used CCS desktop version as the CCS cloud version still cannot be used.

  • Import BIM_ExtFlash (required for CCS) from ti/simplelink/ble_cc26xx_2_xx/Projects/ble/util/
  • Import SensorTag and SensorTagStack from ti/simplelink/ble_cc26xx_2_xx/Projects/ble/SensorTag/

So, there are now three projects in the CCS workspace, you’ll need to run some commands to build it correctly.

Enable ARM Hex Utility in all three projects’ properties. Run

"${CG_TOOL_HEX}" -order MS --memwidth=8 --romwidth=8 --intel -o "${ProjName}.hex" "${ProjName}.out"

This allows generating the hex files in Intel format. Or you can put this command as a Post-build step in Project Properties -> Build -> Steps.

In Project Properties -> General, notice the Variant, Connection and Compiler version. For the BIM_ExtFlash project, the Variant need to be CC2640F128, otherwise, the compilation will fail with the error "unresolved symbol ResetISR".

Connection in Device section should be XDS110 USB Debug Probe.

Compiler version: TI v5.2.6.

If building SensorTag project fails with the error as cannot find files in the ti/drivers/ folder, add these folders to ARM Compiler -> Include Options using Path Variables, for example TI_RTOS_BOARD_BASE, TI_RTOS_DRIVERS_BASE/packages, which can be found in Resource -> Linked Resources.

Merging the three output hex files into a single hex file can be done using a command in Post-build steps, which found in Project Properties -> Build -> Steps

python "C:/Python27/Scripts/hexmerge.py" -o "${PROJECT_LOC}/FlashOnlyOAD/OAD_IMAGE_FULL.hex" -r "000:1FFFF" --overlap=error "${PROJECT_LOC}/FlashOnlyOAD/${ProjName}.hex":0000:1EFFF "${PROJECT_LOC}/../${ProjName}Stack/FlashROM/${ProjName}Stack.hex" "${PROJECT_LOC}/../../../../util/BIM_extflash/CC26xx/CCS/FlashOnly/BIM_ExtFlash.hex":1F000:1FFFF

Use Flash Programmer 2 to flash the final hex file OAD_IMAGE_FULL.hex to the SensorTag.

Issues

Error connecting to the target…

Description The CCS cloud could flash the SensorTag several times, then an error dialog appeared saying "Error connecting to the target…"

Error connecting to the target: (Error -151 @ 0x0) One of the FTDI driver functions used during the connect returned bad status or an error. The cause may be one or more of: invalid XDS100 serial number, blank XDS100 EEPROM, missing FTDI drivers, faulty USB cable. Use the xds100serial command-line utility in the ‘common/uscif’ folder to verify the XDS100 can be located. (Emulation package 6.0.14.5)

However, it seems to work again after doing these steps, not sure which one

  • Close the CCS cloud tab and reopen.
  • Unplug and re-plug the debugger.
  • Flash SensorTag project again.

Flasing SensorTagStack project seems causing this issue.

Solution The issue caused by a wrong setting in the debugger connection. Right click on the SensorTagStack project and change the Connection from "Texas Instruments XDS100v3 USB Debug Probe" to "Texas Instruments XDS110 USB Debug Probe".

Rebuild the firmware and flash it to the SensorTag stops it from working

Description It appeared that I need to rebuild all three projects and merge three hex files into a single file. Still don’t know if it is possible to flash required pages only.

Solution See above, or in this post.

References

  1. SimpleLink SensorTag
  2. Wiki
  3. Software Developer’s Guide
  4. Designing a Product with SimpleLink CC26xx or CC13xx Wireless MCUs
  5. 43oh
  6. SensorTag User’s Guide