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

Chruściński, Krzysztof

Hi Martin,

Nrf52832 has 3 RTC's. RTC0 is used for Bluetooth, RTC1 for system clock and RTC2 is usually available for application. You can use RTC2 with counter driver API (see counter.h). Then you can schedule absolute alarms at tick precision.


-----Original Message-----
From: <> On Behalf Of Martin Kozusky [newsgroups] via Lists.Zephyrproject.Org
Sent: Sunday, January 5, 2020 9:59 AM
Subject: [Zephyr-users] NRF52 and timing - actual state and what functions to use?

I understand that there are some problems because of 32768Hz RTC (I am now using NRF52-DK and want to use NRF52832 in my new HW) as referenced
here:   there are some already merged PRs (like )  and some waiting to merge.

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 on bare-metal)?


Join to automatically receive all group messages.