Skip to main content
Visitor II
July 21, 2025
Solved

RTC not maintaining the date and time as expected

  • July 21, 2025
  • 5 replies
  • 444 views

I am experiencing issues with the VBAT pin on the STM32H753ZI Nucleo board. Specifically, the VBAT pin is not responding properly. I am using a CR2032 CMOS battery for RTC backup, but it is not maintaining the date and time as expected. When the power supply is off, the RTC does not hold and run correctly, but it resumes running once the power supply is restored. battery positive connected to VBAT and negative to GND. i have removed SB52.

Ematic_0-1753077475445.png

 

I have attached the IOC and main file for your reference.

    This topic has been closed for replies.
    Best answer by ######

    Hello,

    I think you are using the internal oscillator?

     RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_LSI;
     RCC_OscInitStruct.HSIState = RCC_HSI_DIV1;
     RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
     RCC_OscInitStruct.LSIState = RCC_LSI_ON;

     

    I'm not sure this is part of the battery backed domain? I seem to remember reading that its only the Low Speed External that is part of the battery domain on some micro's. 

    Edit: see https://community.st.com/t5/stm32-mcus-products/rtc-and-lsi-in-vbat-operation/td-p/516998

    If this is the case, then the clock would only probably advance once main power is on, but keep its value according to the battery backup?

    Cheers.

    5 replies

    Super User
    July 21, 2025

    > When the power supply is off, the RTC does not hold and run correctly, but it resumes running once the power supply is restored.

    What does this mean exactly? Does RTC reset to 1.1.2000, revert to some other particular date, or does it continue but the clock is late? How do you observe that?

    JW

    ######Answer
    Graduate II
    July 21, 2025

    Hello,

    I think you are using the internal oscillator?

     RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_LSI;
     RCC_OscInitStruct.HSIState = RCC_HSI_DIV1;
     RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
     RCC_OscInitStruct.LSIState = RCC_LSI_ON;

     

    I'm not sure this is part of the battery backed domain? I seem to remember reading that its only the Low Speed External that is part of the battery domain on some micro's. 

    Edit: see https://community.st.com/t5/stm32-mcus-products/rtc-and-lsi-in-vbat-operation/td-p/516998

    If this is the case, then the clock would only probably advance once main power is on, but keep its value according to the battery backup?

    Cheers.

    Super User
    July 21, 2025

    > I think you are using the internal oscillator? [LSI]

    > I'm not sure this is part of the battery backed domain?

    Good catch. It is not.

    JW

    Graduate II
    July 21, 2025

    One more thing to add...

    in my experience using the LSI is terrible to accurately drive the RTC due to frequency inaccuracy etc. Much better to have a better external oscillator anyway.

    Cheers.

    EmaticAuthor
    Visitor II
    July 29, 2025

    Seems Clock source is the issue. thanks for the help. @######@waclawek.jan