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.

Regards,
Krzysztof

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

Hi,
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: https://github.com/zephyrproject-rtos/zephyr/issues/9904   there are some already merged PRs (like
https://github.com/zephyrproject-rtos/zephyr/pull/16782 )  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:
https://lists.zephyrproject.org/g/users/topic/28021125  would it be possible to use timer peripheral (with external osc.) to generate better timing (as I would normaly do on bare-metal)?


Thanks.

Join users@lists.zephyrproject.org to automatically receive all group messages.