2019-06-07 08:08 PM
Hi,
I'm using STM32L452, and i need to get the time and date from RTC. The RTC works fine, but when i enter in standby and check the time after wake up (via RTC), the RTC only incrment durring the waked time, and doesn't count the time durring standby. It seems that during standby mode, the RTC stops increment the time/date.
So my question is: can i use the RTC to wake up from standby and to keep track the time at the same time, or it isn't possible to do that?
Anyone have this same issue?
2019-06-07 08:23 PM
Are you using LSI or LSE ?
2019-06-11 02:35 AM
HI,
I'm using LSE
2019-06-11 03:53 AM
How exactly is VBAT powered during standby?
JW
2019-06-11 06:27 AM
VBAT is powered by VDD_MCU +3V3. The problem seems to be the use of the RTC interrupt to wake up from Standby.
2019-06-11 08:11 AM
So there is no change in the supply during Standby?
What's in that interrupt, then, and what's after WFI?
What is the timing, how often is Standby entered and how long does it last?
Try reducing the program to absolute minimum functional piece to demonstrate the problem.
JW
2019-06-13 01:27 PM
I've figured out the problem.
In the HAL_RTCEx_SetWakeUpTimer_IT() function, i've changed the WakeUpCounter from RTC_WAKEUPCLOCK_RTCCLK_DIV16 to RTC_WAKEUPCLOCK_CK_SPRE_16BITS and now it works fine, without any issues.
Thank's everyone.
2019-06-13 01:32 PM
Oh, and could you please explain the cause and remedy in terms of the mcu registers, for the benefit of those who don't Cube?
Thanks,
JW
2021-04-17 04:49 PM
I followed your suggestion and it seemed to fix my problem, the RTC is now counting during standby. However, the issue now is every time cycle power, it seems to loose about 1 sec. I think it is because of the sub-seconds is lost. In my project, I do not have the RTC_RFIN so I don't know how to recover the sub-seconds. Do you have an suggestion?
2021-04-18 02:39 AM
> However, the issue now is every time cycle power, it seems to loose about 1 sec. I think it is because of the sub-seconds is lost.
https://community.st.com/s/question/0D50X00009XkgBW/stm32-rtc-loses-one-second-after-each-reset
JW