cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_RTC_SetTime Timeout

George.P
Associate III
Posted on June 22, 2015 at 11:33

Hello,

HAL_RTC_SetTime

fails when trying to set new values on the RTC due to 

RTC_EnterInitMode

timeout.

while((hrtc->Instance->ISR & RTC_ISR_INITF) == (uint32_t)RESET)

{

if((HAL_GetTick() - tickstart) >  RTC_TIMEOUT_VALUE)

{       

return HAL_TIMEOUT;

}

During init (

MX_RTC_Init

)

HAL_RTC_SetTime

is successful.

STM32L151RD

CubeMX 4.8.0

L1 Library 1.2.0

LCI RC @ 37kHz configured by 

SystemClock_Config()

Any clues?

Thanks!

George

1 REPLY 1
George.P
Associate III
Posted on June 22, 2015 at 14:16

After some time I figured out that the the RTC Backup domain must be unlocked.

HAL_PWR_EnableBkUpAccess 

must be called before calling any RTC set functions.