This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Update timer speed once connected

I have a custom Characteristic in my GATT that is sending data in Notify mode every 30ms.

In my firmware I use timer to do this with something like this :


#define RTC1_TICK_DURATION		31
	
#define TIMER_ONE_DURATION   		33 // 30ms																/**<(deflt:1000)[ms] sending/measurement cycle duration for 1s cycled characteristics*/
#define TIMER_ONE_TICKS_NB 		(TIMER_ONE_DURATION * 1000 / RTC1_TICK_DURATION)


err_code = app_timer_start(m_TimerOne_id, (uint32_t)TIMER_ONE_TICKS_NB, NULL);


Everything is working great but sometimes, randomly, my app using BLE or my laptop using Web BLE (so two different device with two different source code with the same behavior) are unable to retrieve value for this Characteristic. They are able to connect to my device but no Characteristic value is send.

I tried to change the interval from 30ms to 90ms and so far I am not able to reproduce this issue so it lead me to think that the speed can be the source of the issue.

How would you deal with that ? Is it possible to notify at a low pace, then one second after a connection is made, increase the speed ? Or better, when someone subscribe to the Notifying Characteristic increase speed, when it disconnect decrease speed ?

Thanks !

Parents
  • Hi

    It should be fine having set the connection interval to 7.5ms, however this is on the peripheral side, which the central side doesn't have to "agree" with. Are you able to find the central side connection intervals? If you have a log with timestamps for example, you'll be able to see how long the device actually uses to connect.

    For most Android phones the minimum connection interval is 25ms or so (30ms for iPhones), which is cutting it close to your notification interval of 30ms. I suspect you might have to increase the notification interval somewhat to make this compatible to any device.

    Best regards,

    Simon

Reply
  • Hi

    It should be fine having set the connection interval to 7.5ms, however this is on the peripheral side, which the central side doesn't have to "agree" with. Are you able to find the central side connection intervals? If you have a log with timestamps for example, you'll be able to see how long the device actually uses to connect.

    For most Android phones the minimum connection interval is 25ms or so (30ms for iPhones), which is cutting it close to your notification interval of 30ms. I suspect you might have to increase the notification interval somewhat to make this compatible to any device.

    Best regards,

    Simon

Children
Related