cancel
Showing results for 
Search instead for 
Did you mean: 

RTC stops during standby mode.

JStraw
Associate II

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?

9 REPLIES 9

Are you using LSI or LSE ?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
JStraw
Associate II

HI,

I'm using LSE

How exactly is VBAT powered during standby?

JW

VBAT is powered by VDD_MCU +3V3. The problem seems to be the use of the RTC interrupt to wake up from Standby.

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

JStraw
Associate II

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. 

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

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?

> 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