Skip to main content
JStraw
Associate
June 8, 2019
Question

RTC stops during standby mode.

  • June 8, 2019
  • 7 replies
  • 2298 views

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?

This topic has been closed for replies.

7 replies

Tesla DeLorean
Guru
June 8, 2019

Are you using LSI or LSE ?

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
JStraw
JStrawAuthor
Associate
June 11, 2019

HI,

I'm using LSE

waclawek.jan
Super User
June 11, 2019

How exactly is VBAT powered during standby?

JW

JStraw
JStrawAuthor
Associate
June 11, 2019

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

waclawek.jan
Super User
June 11, 2019

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
JStrawAuthor
Associate
June 13, 2019

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. 

TPham.4
Associate
April 17, 2021

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?

waclawek.jan
Super User
June 13, 2019

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

waclawek.jan
Super User
April 18, 2021

> 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