cancel
Showing results for 
Search instead for 
Did you mean: 

Stuck in RTC_EnterInitMode

DS.4
Senior II

After connecting to a X-NUCLEO-LPM01A board for power consumption test , RTC init will not end.

Stuck in this while loop:

 

  tickstart = HAL_GetTick();
    /* Wait till RTC is in INIT state and if Time out is reached exit */
    while ((hrtc->Instance->ISR & RTC_ISR_INITF) == 0U)
    {
      if ((HAL_GetTick()  - tickstart) > RTC_TIMEOUT_VALUE)
      {
        return HAL_TIMEOUT;
      }
    }

 

 Current solution: I have to program some example using stm32wbIDE, only that fixes it and I can now use my FW.

 

 

5 REPLIES 5
STea
ST Employee

Hello @DS.4 ,

Make sure the RTC APB clock is enabled by checking the RTCAPBEN bit field , this could be due to some missing steps in the configuration of RTC and its clock source . This is just a guess if this does not resolve your issue i need further details on your configuration to help you solve this problem.

BR 

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

I will check that, 

Weird thing is even after aligning my init process to that of the example, it still won't work.

I still have to program the example and later my code.

DS4_0-1706026129683.png

Please see attached system viewer, RTCAPBEN is EN

Hello @DS.4 ,

Note that The RTC Initialization mode is write protected,you need to  use 

__HAL_RTC_WRITEPROTECTION_DISABLE() before calling this function.

BR

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Thanks, but I am actually doing that, ( the HAL is doing that for me to be precise)

DS4_0-1706044160471.png

i haven't changed the HAL functions, and using HAL_RTC_Init as is.

 

Any other flags that might be of help?