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

Integrating RTC with with SoftDevice(current Time Service) to generate time stamps

Hello,

I am trying to integrate the calendar example(using RTC 2), with a current time service(CTS) client and and custom service server on a nRF52940 DK.

I want to use the time data received from the phone as a reference for the on-board RTC to generate timestamps locally. The timestap frequency needed is quite low (>10 seconds per stamp)

Until now I have been able to receive timestamps from the CTS and also advertise sensor data to the phone using the custom service. But I haven't been able to use the local RTC to sync with time data from CTS and generate local timestamps using RTC interrupts.

Any advice on the best strategy to accomplish my task?

I read this on the forum. So does that mean I shouldn't use a RTC COMPARE event with SoftDevice?

Thanks

  • "Until now I have been able to receive timestamps from the CTS and also advertise sensor data to the phone using the custom service. But I haven't been able to use the local RTC to sync with time data from CTS and generate local timestamps using RTC interrupts."

    You need to share exactly what it is that you're trying to do and what fails, as I have no idea what you're trying to do and what does not work other than the fact that you're trying to synchronize an RTC timer over BLE and failing at it. 


    "I read this on the forum. So does that mean I shouldn't use a RTC COMPARE event with SoftDevice?"
    That issue is about the higher execution priority of the SoftDevice blocking the CPU from toggling a pin. What that uses should have done is to use the GPIOTE peripheral with PPI in order to toggle the output pin directly from the RTC COMPARE event instead of waiting for the interrupt that the RTC COMPARE event can generate. 

    For the calendar library this is not really an issue as the RTC COMPARE event only happens once a second, and the SoftDevice will not block execution for a whole second. As long as the RTC's ISR is service before the next RTC COMPARE event you're good. 

Related