STMicroelectronics / STM32CubeWL

STM32Cube MCU Full FW Package for the STM32WL series - (HAL + LL Drivers, CMSIS Core, CMSIS Device, MW libraries plus a set of Projects running on boards provided by ST (Nucleo boards)
Other
107 stars 54 forks source link

RTC Accuracy issue #56

Closed PG430 closed 1 year ago

PG430 commented 1 year ago

[@ALABSTM] (https://github.com/STMicroelectronics/STM32CubeH7/issues/url) we are working on new release of STM32WL "STM32Cube_FW_WL_V1.3.0". release has introduced changes in RTC driver which we believe is fixed for the issue (RTC loosing time issue https://github.com/STMicroelectronics/STM32CubeH7/issues/24 ) But, after running RTC overnight we have seen RTC issue is still persist in different manner this time RTC is increasing time

Test Start time : 17:55:56, UTC time 1670415956 Test End Time: 9:48:00, UTC time 1670473080, (57124 Seconds) Difference of UTC time should be : 57124 (1670473080 - 1670415956)

But, From attached logs we can see Test End time is 9:48:00 and total seconds are 57135s837 (check last line in logs). RTC had generated 57135s837 seconds instead of 57124 Seconds.

So, 57135 - 57124 = 11 Seconds are increased in actual time

RTCTestLogs.txt RTC Driver.zip Driver files are also attached for more details

Can you please explain what exactly is happening after RTC fix is applied? how to fix this?

ALABSTM commented 1 year ago

Hi @PG430,

Thank you to have reported. We'll check from our side and get back to you after.

With regards,

PG430 commented 1 year ago

Hello @ALABSTM,

Thank you for the quick reply. Any finding on this issue? if not, is it possible for you to take this on priority? we require RTC in multiple projects and we are stuck due to this problem. Appreciate your support on this matter.

kaunomedis commented 1 year ago

This bug was detected MANY years ago and no official solution.

qkrwogur commented 1 year ago

I hope you can solve this problem soon. If the time doesn't match, it's not a timer. Come up with a solution quickly!

ALABSTM commented 1 year ago

Hi @PG430,

First of all, please excuse this late reply.

The fix applied prevents from entering the initialization mode when executing HAL_RTC_Init() function in case the RTC is already initialized. Indeed, while in the initialization mode, the RTC's calendar (i.e., time and date) are frozen, causing the loss of seconds.

Regarding your case, I might advise the following, if not yet done:

Now, as nothing is perfect, the RTC offers "fine-tuning" mechanisms, mainly:

Both mechanisms and more are presented in the AN4759 application note.

I hope this helps. Please do not hesitate otherwise.

With regards,

ALABSTM commented 1 year ago

Hi @PG430,

I hope you are fine. I also hope the clues provided in my previous comment helped you get the accuracy you are looking for. Please allow me to close this thread.

With regards,