3 years, 11 months ago.

RTC doesnt work after microcontroller wakes up from low power 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.


Be the first to answer this question.