Skip to main content
George.P
Associate III
June 22, 2015
Question

HAL_RTC_SetTime Timeout

  • June 22, 2015
  • 1 reply
  • 1001 views
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

    This topic has been closed for replies.

    1 reply

    George.P
    George.PAuthor
    Associate III
    June 22, 2015
    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.