Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SensorTag 2 CC2650 advertising indefinately firmware

I want to use a SensorTag 2 so that it is sitting there broadcasting it's data (and, critically connectable over bluetooth) from when it's turned on to when\if I ever turn it off. Out of the box, the tag is set to only advertise over Bluetooth for a few mins which means that when the connection eventually fails or when the device connected to the tag boots etc etc you can't connect again without physically visiting the tag and resetting it.

I see there is firmware that the myWeatherCenter people have created that lets the tag work as a weather station by basically setting it to advertise indefinitely... frustratingly though their firmware is only the sensortag version 1 :-(

I've researched on and off for months and months now and nothing coming back.. suggesting either nobody else wants this, there is a really simple solution everyone one else knows about or ...? I can't even see anyone else asking this question really... which is worrying. Does anyone have a firmware file that sets this setting for the sensortag 2 or know how to modify the firmware to set this setting?

like image 905
TimBrighton Avatar asked Jun 26 '16 20:06

TimBrighton


1 Answers

It is definitely possible to change the SensorTag 2/CC2650 platform so that its behavior suits your use case. I - for example - currently use a custom firmware doing pre-processing of sensor readings on the SensorTag and sending data directly in the advertisement message indefinitely (of course you have to tweak intervals and payload to get a decent battery life).

I assume you have CCS and the sources (SensorTagApp and SensorTagStack) at hand?

I recommend flashing the current SensorTagStack first, if not done yet (though I'm not yet on 2.2 myself).

In the SensorTagApp project under Application you find SensorTag.c. In there you should change:

#define DEFAULT_DISCOVERABLE_MODE             GAP_ADTYPE_FLAGS_LIMITED

to

#define DEFAULT_DISCOVERABLE_MODE             GAP_ADTYPE_FLAGS_GENERAL

This is the usual advise and might already do the trick.

In my firmware I also changed (in SensorTag.c, in the SensorTag_init function):

uint16_t advertOffTime = 0;

to

uint16_t advertOffTime = 1;

Please try these changes and get back to me. If that wasn't enough I will do a more thorough comparison of the stock firmware and my custom firmware. I also recommend the more specific ti Bluetooth low energy forum.

like image 165
Frederic Klein Avatar answered Nov 14 '22 13:11

Frederic Klein