get time in us using RTC

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support。We’ll be fixing bugs / optimising the searching and tagging over the coming days.
2 posts / 0 new
Last post
gbmej
Offline
Last seen:2 years 4 months ago
Joined:2017-09-13 15:16
get time in us using RTC

Hello

I am trying to get a time in us using the RTC. I have used the function available in RTC application note "DA1468x_RTC_concept_tutorial_v1_00.pdf":uint64_t sw_rtc_convert_lp_to_time(uint64_t
lp_clocks)
。我在“LP_CLK_RCX”模式(/* Check whether the lp clock source is the internal RCX */) and this function uses the global variablercx_clock_period:


/*
* Use the variable named [rcx_clock_period] to get the
* current RCX period in usec. Please note that this value
* is multiplied by [1024 * 1024]
*/
time = (lp_clocks * (uint64_t)rcx_clock_period);
time = (time >> 20); // divide with (1024 * 1024)

Inidlemode, the time returned is always higher than the previous time got 50ms before.
Inextended sleepmode, the time is sometimes smaller than the previous time got 50ms before. So I return to the past.

This is due to the auto-re-calibration when exiting extended sleep mode ofrcx_clock_period
Do you have an idea about this use case?

Best regards,
Guillaume B.

Keywords:
RTC
Device:
PM_Dialog
Offline
Last seen:3 days 19 hours ago
Staff
Joined:2018-02-08 11:03
Hi gbmej,

Hi gbmej,

It is strongly recommended to use the XTAL32K as RTC instead of the RCX. The RCX is unstable and it need frequent calibration. Keep in mind that the RCX is software implemented and XTAL32K is hardware implemented. So, the most stable configuration is to use the XTAL32K, with an external 32KHz crystal oscillator.

Thanks, PM_Dialog