NRF52 and timing - actual state and what functions to use? #nrf52-pca10040

Martin Kozusky

I understand that there are some problems because of 32768Hz RTC with NRF52832 as referenced here:  , there are some already merged PRs (like )  and some waiting to merge, so what is the actual state at 2.1.0?

I want to ask:

 1 - what is the best solution to call my function every 1ms (or will it be 1.007ms?), is it ok just to use k_timer? Is "next expiration time" calculated just by adding period to current time (that would make a big time diff after many calls)  or does it use k_uptime_get*number of expirations to calculate next expiration time?

 2 -  what is the best solution for most precise long-term time keeping?  Let's say i don't want more that 1 minute diff in 20 days. Can I just use k_uptime_get? I would like to make my HW design without aditional external RTC, which can be almost as expensive as another NRF52832 - is it even possible somehow? Or do you have any tip for some cheap low-power RTC?

 3 - would using external 16MHz/32MHz (or another frequency) oscilator solve anything?

 4 - as someone already wrote here:  would it be possible to use timer peripheral (with external osc.) to generate better timing (as I would normaly do with bare-metal sources)?


Join to automatically receive all group messages.