cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any way to disable the RTC reset on STM32F476

GJohn
Associate II

The HAL RTC initialization routines for the STM32F476 unconditionally reset the clock to

January 1, 2000. I have a battery backup for the clock and do not want the clock reset on initialization.

Has anybody found a way to do this within the CubeMX framework?

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

Within MX_RTC_Init, exit the function if the RTC is already configured

/**
  * @brief RTC Initialization Function
  * @param None
  * @retval None
  */
static void MX_RTC_Init(void)
{
 
  /* USER CODE BEGIN RTC_Init 0 */
  if (already configured and running) {
    return;
  }
  /* USER CODE END RTC_Init 0 */
  ...

.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

3 REPLIES 3
GJohn
Associate II

Sorry folks. I'm using a STM32F429, and NOT STM32F476.

TDK
Guru

Within MX_RTC_Init, exit the function if the RTC is already configured

/**
  * @brief RTC Initialization Function
  * @param None
  * @retval None
  */
static void MX_RTC_Init(void)
{
 
  /* USER CODE BEGIN RTC_Init 0 */
  if (already configured and running) {
    return;
  }
  /* USER CODE END RTC_Init 0 */
  ...

.

If you feel a post has answered your question, please click "Accept as Solution".
GJohn
Associate II

You're correct. I overlooked those user code blocks. Thanks.