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

RTC Time Keeping using app_timer with SD132

There are a few threads on here about this already, but I wasn't find the answer to the exact question I had.

I am using the nRF52832 with SD132 and SDK15.2 on a custom board with an external 32Khz XTAL. I am trying to implement a real time clock to keep time in FW. For this, I decided to use the app_timer module, since the SoftDevice already initializes the LF CLK source as the external LF XTAL. Going through my SDK_config file, I confirmed that the LF CLK source is correctly selected as LF XTAL, and the RTC prescaler is at 32768, which should give ~30uS resolution. Using the app timer, I just set up a repeated app timer with the "APP_TIMER_MODE_REPEATED" option, and APP_TIMER_TICKS(1000) to fire my handler that increments a variable that keeps epoch time in a uint32_t variable.

On my setup, I am seeing about 8 seconds of drift over ~12 hours, which is pretty excessive. My board is custom, and I don't know the quality or the accuracy PPM spec of the 32Khz XTAL on there, but I wanted to confirm that what I did in FW was sound. Does this sound like a good way of implementing an "accurate" (as accurate as it can be with the bottleneck being XTAL accuracy) RTC on a nRF52 device using a SoftDevice?

Thanks!

Related