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

nRF9160 Real Time Counter for timestamping

Hello guys,

We use nRF9160 and nRF Connect SDK v1.3.0. In our application, we need to keep track of time and timestamp some events. We can connect to the Cloud and get a timestamp in seconds since 1970 as an initial step. However, I wonder how we can keep track of time in our application after that? Our device is battery powered and will be most of the time in the deepest possible sleep mode periodically waking up to do some job and timestamp data taken from the sensors.

Can we use Real Time Counter with 1Hz clock for that purpose?

I came across this RTC sample that shows one use case of RTC peripheral. However, some of the threads say that the RTC counter is a 24-bit counter so it would be impossible to use it for keeping 32-bit timestamp. Also, I don't see a function that will set the value of RTC counter - I spotted only the functions for clearing RTC counter (nrfx_rtc_counter_clear()) and getting its value (nrfx_rtc_counter_get()). Am I missing something?

Thanks in advance for your time and efforts.

Sincerely,

Bojan.

Related