Closed 6v6gt-duino closed 2 years ago
Hi @6v6gt-duino, I fixed this issue that was caused by unexpected RTC reinitialization. I take the opportunity to fix other latent issue and simplify a bit the driver. Fell free to test this PR https://github.com/stm32duino/STM32RTC/pull/67
Thank you very much for responding. I grabbed the 4 files from your pull request #67 and tested these together with my application using a Bluepill (the same setup as in the original Issue). It appears to work for the tests I applied, that is synchronizing the time automatically with a known time source (DCF77), repeatedly resetting the device, then checking again a similarly accurate time source before the application again found the DCF77. I saw no noticeable loss of time on switch over to the RTC. I repeated the exercise 3 times. Further, I saw no compiler warnings from the new code. So, in summary, it does indeed appear to work. Many thanks for dealing with that. Please close the issue if you so wish.
@6v6gt-duino , thanks for the feedback. Issue will be closed automatically once PR will be merged.
I'm using the RTC of a Bluepill STM32F103C8T6. It has a supercap on VBat. The installed version of the STM32duino rtc library is 1.2.0. The STM32 Arduino Core is at version 2.2.0.
If I press the reset button on the Bluepill, the RTC appears to lose about 1 second on each press.
I am using the following code based on this example to demonstrate this problem: https://github.com/stm32duino/STM32RTC/blob/main/examples/SimpleRTC/SimpleRTC.ino
I have set the clock and taken a series of screen shots and have logged the results. The result is that the delta between local (PC) time and the Bluepill RTC time increases by about one second for each reset. These seconds are just lost.
As can be seen, the delta increases after each series of resets.
This appears similar to this case: https://community.st.com/s/question/0D50X00009XkgBWSAZ/stm32-rtc-loses-one-second-after-each-reset