cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H5 RTC count through power cycles

jreina
Associate III

What is the expected RTC peripheral behavior through power cycles on VDD? We have a 3.3V system design with the STM32H562VGT6 right now.

Setup:

  • VDD = 3.3V from external supply
  • VBAT = 220mF supercap attached
  • RTC is enabled & counting, system is stable
  • LSE oscillation is active on the PC14/15 lines

Action:

  1. VDD = 0V for 1-2 sec (unplugged PSU)
  2. VDD = 3.3V restored (reconnected PSU)

Expected Behavior Through Power-Cycle:

  • RTC count maintains operation & counting (count increases)
  • LSE signal is oscillating at PC14/15 lines

Observed:

  • RTC count freezes when power is removed & resumes counting when power is restored

 

Is this expected? Is it possible to keep the RTC counter active & counting through power cycles?

 

11 REPLIES 11

Thank you for the detail and patience @STOne-32@unsigned_char_array, we were able to resolve the situation! Our project was using the LSI within the MSP - 

 

Solution:

 

 

void HAL_RTC_MspInit(RTC_HandleTypeDef* hrtc)
{
  RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
  if(hrtc->Instance==RTC)
  {
    /** Initializes the peripherals clock
    */
    PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC;
    PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;  // <- Originally 'RCC_RTCCLKSOURCE_LSI'
    if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
    {
      Error_Handler();
    }

    /* Peripheral clock enable */
    __HAL_RCC_RTC_ENABLE();
    __HAL_RCC_RTCAPB_CLK_ENABLE();
  }
}

 

 

 

 

 Our IOC file wasn't in-sync with our project; is it supposed to be? Here was the update to apply with the IOC - 

Clock Update Example.png

 

Thank you guys!

STOne-32
ST Employee

Hi @jreina 

 

Very Glad to see you are able to fix it ! well done.    Continue Releasing your Creativity using STM32 😉

Ciao

STOne-32.