3 years, 10 months ago.

STM32L062K8Tx RTC doesnot work after wakeup from sleep mode

Hello everyone,

I am using this function to set time set_time(ui32UTC);

I check and it works fine with this function: time_t seconds = time(NULL);

Then, i am using these two commands to put my controller in low power mode (Standby Mode):

HAL_RTCEx_SetWakeUpTimer_IT(sCfgData.RtcHandle, 5, RTC_WAKEUPCLOCK_CK_SPRE_16BITS);

/ Put MCU in Standby Mode*/ HAL_PWR_EnterSTANDBYMode();

where 1st function wakes up microcontroller after every 5 seconds.

Now the problem is that when i use these command after wakeup again time_t seconds = time(NULL); the seconds is a large negative value, what changes I need to do that it keeps the time even in standby mode.

Thanks

Be the first to answer this question.