cancel
Showing results for 
Search instead for 
Did you mean: 

Wakeup from standby with RTC is causing losing time accuracy

CYesi.1
Associate II

Hello,

I am using STM32L073V8T MCU, STM32CubeIDE.

My application needs low power consumotion. When some events occurs, MCU move to standby. Than it waits new event for waking up. In other words, my application periodically check new event. After going standby, MCU wakes up with about 23 seconds period and check new events. If there isnt event, MCU contuniue stay standby mode.

There is not any problem about going to standby or waking from standby. But, periodically sleeping and waking is causing losing time accuracy.

In my test condition, I setted device time according my PC. Than, I let device in standby mode during 1 day period. And, there was a 10 minutes difference from my PC time. In addition, in same conditions without standby there is about 2 second accuracy lose. (2 sec is not problem for my case)

void wakeupWithRTC(void)

{

  HAL_RTCEx_DeactivateWakeUpTimer(&hrtc);

 HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, 0x63BA50, RTC_WAKEUPCLOCK_RTCCLK_DIV16);

  __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);

}

void pwr_lowPowermode(void)

{

  dbg_printf("standby\n\r");

  wakeupWithRTC();

  GPIO_low_power();

  __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU); */

   HAL_PWR_EnterSTANDBYMode();

}

11 REPLIES 11

Read out and check content of the RTC registers just before you go to sleep.

You may want to compare them to the "working" case.

JW

Was there any solution to this problem?

JW