Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
312 views
in Technique[技术] by (71.8m points)

c - How to modify the TI SensorTag Firmware to advertise indefinitely?

When the side button of the TI SensorTag is pressed, pairing with a device is possible for approx. 2-3 minutes. How do you modify the SensorTag's firmware so that it advertises forever and pressing the side button is not necessary every time?

And how do you upload the firmware with an iOS device, so without using CC-debugger?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

How I did it, with help of Chris Innanen (thanks!!)

You will need a Windows virtual machine if you do it on a Mac.

  1. Download IAR Embedded Workbench for 8051 (http://supp.iar.com/Download/SW/?item=EW8051-EVAL). Make sure to take the 30-day evaluation copy and not the 4k limited.

  2. Download BLE-STACK from Texas Instruments (http://www.ti.com/tool/ble-stack) and install it on a Windows (virtual) machine. By default, the installer will install here: "C:Texas InstrumentsBLE-CC254x-1.4.0ProjectsleSensorTagCC2541DBSensorTag.eww".

  3. Open this SensorTag.eww file with IAR Embedded Workbench.

  4. Select "CK2541DK-Sensor-OAD-ImgA" in the dropdown menu in the "workspace" section on the left

  5. To prevent a compiling error later on: go to Project -> Options... and change the value for "Number of virtual registers" from 16 to 8.

  6. Find "SensorTag.c" in the filetree in the workspace section on the left: "SensorTag - CK2541DK-Sensor-OAD-ImgA/APP/SensorTag.c"

  7. Search for GAP_ADTYPE_FLAGS_LIMITED and change it to GAP_ADTYPE_FLAGS_GENERAL to enable indefinit advertising

  8. Make the build with Project -> Make. Wait until it's done

  9. By default, the new firmware image (.bin file) is now in "C:Texas InstrumentsBLE-CC254x-1.4.0ProjectsleSensorTagCC2541DBCC2541DK-Sensor-OAD-ImgAExe" (Make sure to place it somewhere you can reach it from Mac OS X later, if you use a virtual machine)

  10. Repeat steps 4 to 10, but now for "CC2541DK-Sensor-OAD-ImgB"

  11. Now get the app to upload the new firmware over the air. Get it here: https://itunes.apple.com/us/app/ti-sensortag/id552918064?mt=8

  12. Open iTunes in Mac OS X and open your iOS device, go to the 'Apps' section, scroll to the bottom to see the apps with filesharing possibilities. "SensorTag" should be in that list. Click on it and add the two new firmware files, both Image A and B.

  13. If that's done, open the SensorTag app on your iOS device and connect it to the SensorTag. Then in the bottom of the app tap "Update FW" -> "Select FW file" -> Shared Files > And then tap Image B and upload it. It takes a few minutes. A firmware with type A is already on your SensorTag by default. Because you've put a B Image on it just now, with any new changes you would need to upload an Image A.

Good luck!

Additional: changing the signal strength

1) Find "HCI_EXT_ClkDivOnHaltCmd" and you'll add a new line (and optional comment) after it: // ADDITION Adjust TX power level HCI_EXT_SetTxPowerCmd( HCI_EXT_TX_POWER_0_DBM );

1b) You can change "_0_DBM" to "_4_DBM" or "_MINUS_6_DBM" or "_MINUS_23_DBM" as well

2) Find "GAP_ADTYPE_POWER_LEVEL" and change the value on the next line to match the above power level


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...