cancel
Showing results for 
Search instead for 
Did you mean: 

RTC, big TimeGap between setting new Time and Availability

Nor Sch
Associate III
Posted on February 13, 2017 at 10:44

I simply use the normal Functions given by RTC-Lib from Cube, means I use these Calls:

uint32_t tFormat = RTC_FORMAT_BIN;
...
HAL_RTC_SetDate(&hrtc, &myDate, tFormat);
HAL_RTC_SetTime(&hrtc, &myTime, tFormat);
...
HAL_RTC_GetDate(&hrtc, &myDate, tFormat);
HAL_RTC_GetTime(&hrtc, &myTime, tFormat);�?�?�?�?�?�?�?�?�?�?�?�?

In a Thread I check every Second if the Hour + Minute is changed to show this in the Gui-Thread. But I have a strange Problem with this. After Setting the Time it needs sometimes only 2-3 Seconds, often 6-8 Seconds and sometimes even 30 Seconds until the GetTime delivers the new Value (seen with Traces in the relevant Functions). I could fasten up the Update with some (senseless) GetDate() + GetTime() directly after the SetDate() + SetTime(). But anyway the new Time is not immediately there. That's really ugly ...

Has anyone some suggestions?

1 REPLY 1
Nor Sch
Associate III
Posted on February 13, 2017 at 13:05

Found the Solution: I had forgotten that the Order of GetDate() and GetTime() is relevant for the internal Shadow Registers and by a Copy&Paste I switched them ... With first GetTime() and than GetDate() it works fine. Btw: For the SetDate/Time the Order is not relevant.