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

    First, I want to say that development without the possibility to debug is very hard, and ill advised, and you should avoid this in the future.

    Next, what you should look at are return values from the ble_service_on_value_change() function, to see how are you updating your firmware? By using a debugger or bootloader? If you do have a debugger you could use the RTT logger, to read these return values. If not you should test this on a development kit first, before implementing it into your product.

    I don't think this is a race condition per say, but maybe an interrupt from some process with a higher priority. Again, debugging is the correct way of finding out what is happening, as me guessing what the issue is, is really inefficient.

    Best regards,

    Simon

  • Hi

    This problem is not a very big for us because it's working 90% of the time or otherwise I can bypass it by deconnecting and reconnecting, this is why we have already some product assembled but I would still like to fix it.

    I will have other board not assembled shortly so I will be able to do proper debug.

    I will take a look at the return of ble_service_on_value_change but so far, what I know is that I never enter the if statement after it is called.

    About my firmware update process, I use DFU with nRF Connect or nRF Toolbox.

    I will let you know here what I found !

    Thanks

Reply
  • Hi

    This problem is not a very big for us because it's working 90% of the time or otherwise I can bypass it by deconnecting and reconnecting, this is why we have already some product assembled but I would still like to fix it.

    I will have other board not assembled shortly so I will be able to do proper debug.

    I will take a look at the return of ble_service_on_value_change but so far, what I know is that I never enter the if statement after it is called.

    About my firmware update process, I use DFU with nRF Connect or nRF Toolbox.

    I will let you know here what I found !

    Thanks

Children
No Data
Related