Skip to main content
Visitor II
June 18, 2024
Solved

VBAT & RTC Issues on Circuit - STM32H563ZIT6

  • June 18, 2024
  • 4 replies
  • 14997 views

I am experiencing issues with the VBAT pin on the STM32H563ZIT6 microcontroller. 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.

I have attached the circuit diagram for your reference. Could you please provide a clear explanation of the potential issues and offer guidance on how to resolve them? Expert advice on this matter would be greatly appreciated.

 

VBAT & CMOS : 

VBAT_CKT.png

CMOS Battery.png

 

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

    As per your instructions, the problem was solved. We checked it a few times, each for a duration of 5 to 10 minutes, over the last few days. If any issues occur in the future, I will call you back. Thank you for your support and guidance.

    4 replies

    Super User
    June 18, 2024

    > When the power supply is off, the RTC does not hold and run correctly,

    How do you know?

    JW

    Visitor II
    June 18, 2024

    We are encountering issues with live date and time printing on our ODM development board using the attached circuit. Below are the details of the tests conducted:

    Test 1:

    • Initially, we set the current live date and time to 15/Jun/2024, 3:15 PM.
    • The system ran for 5-10 minutes, printing the date and time as expected (e.g., 15/Jun/2024, 3:25 PM).
    • This test was repeated four times with 5-minute intervals.

    Observations Before Power Off:

    • Set Date and Time: 15/Jun/2024, 4:25 PM

    • Live Date and Time: 15/Jun/2024, 4:25 PM

    • Printed Date and Time: 15/Jun/2024, 4:25 PM

    • After running for 5 minutes:

      • Live Date and Time: 15/Jun/2024, 4:30 PM
      • Printed Date and Time: 15/Jun/2024, 4:30 PM

    Observations After Power Off:

    • The power was turned off on the DB, and after 5 minutes, we turned it back on. The system then printed the date and time as it was when the power was turned off, continuing from that point.

    • Set Date and Time: 15/Jun/2024, 4:25 PM

    • Live Date and Time: 15/Jun/2024, 4:40 PM

    • Printed Date and Time: 15/Jun/2024, 4:40 PM

    • After 5 minutes of power being off:

      • Live Date and Time: 15/Jun/2024, 4:45 PM
      • Printed Date and Time: 15/Jun/2024, 4:40 PM

    Additional Tests:

    • Similar behavior was observed during tests at different live times: 6 PM, 7 PM, 8 PM, and the next morning at 10 AM.

    We conducted this test 4-6 times with consistent results. It seems that the printed date and time do not update correctly after power restoration.

    Please check the attached circuit and provide guidance on potential issues and corrections needed.

    Visitor II
    July 30, 2024

    Hi Bharath Kumar 

    In my project i was also working on the RTC.

    We are also got the issue which you got, which the rtc does not getting updated during the power OFF. Please help me to solve the issue 

    Graduate II
    June 18, 2024

    No files are attached so I don't know what you did wrong.

    You can check out this topic which might contain the solution that works for you:
    https://community.st.com/t5/stm32-mcus-products/stm32h5-rtc-count-through-power-cycles/m-p/671611#M243435
    You need to enable LSE instead of the internal clock.

     

    Visitor II
    June 18, 2024

    Please check one more time

    Graduate II
    June 18, 2024

    R5 is discharging the battery to GND with 15mA. That's a lot and I don't see a need for discharging a backup battery.
    RJ1 is also discharging the battery by having the battery supply current to the entire circuit, it also prevents the circuit from powering off. Internally VBAT is bypassed when VCC is present, so you do not need VCC connected to VBAT at all. Remove these resistors. You don't need the diode, it just ads voltage drop. C14 is redundant because of C55 and it is behind a diode, you only need one, look at the guidelines for what capacitor value is recommended. Extra components potentially add a small leakage current.

    Have you checked LSE like I told you? If you use LSE as a clock source it won't run when powered by VBAT so the value will freeze like you observed. Additionally you will see very inaccurate time keeping.Have you checked the crystal to see if it is oscillating?

    Visitor II
    June 20, 2024

    I have checked the issue as per our previous conversation, but the same problem is still occurring. I am unable to trace the cause.

    As per your instructions, I have made the following changes:

    • Removed RJ1.
    • Cut the 3.3V supply.
    • Removed D2 IN4007 and replaced it with a 0-ohm resistor.
    • Removed R5 and C14 & C55.
    • Replaced the old CR2032 battery with a new one in the VBAT CMOS holder. Before replacement, I checked with a multimeter and confirmed the voltage is 3.3V.

    Despite these changes, the main problem persists, and I am unable to track down the root cause. Could there be a software issue, driver problem, or something related to the crystal that needs to be enabled? If there are any other hardware or software requirements, I will discuss them with the software team.

    Please share the protocols for VBAT setup for both hardware and software, and any relevant references.

     

    Graduate II
    June 20, 2024

    Please upload your .ioc-file so we can check your configuration.

    Graduate II
    June 22, 2024

    As I suspected LSE is disabled. So your crystal will never oscillate.

    unsigned_char_array_0-1719042425511.png

    unsigned_char_array_1-1719042672605.pngAnd you don't use LSE as clock source either.

     

    Drive strength depends on the MCU family and used crystal. Higher drive strength consumes more current. Too low and it may not oscillate.
    Check Table 7. "Recommended crystal / MEMS resonators for the LSE oscillator in STM32"
    from an2867-guidelines-for-oscillator-design-on-stm8afals-and-stm32-mcusmpus-stmicroelectronics.pdf for what your MCU supports.I've had issues with using a not supported crystal with too high capacitance. It resulted in some boards not booting sometimes since the LSE init function time out. The trick was using a different crystal with correctly calculated capacitors and set the right drive strength (in our case second highest level was good).

    Check the datasheet of your MCU to see what drive strength levels are supported for LSEDRV.
    "Table 43. Low-speed external user clock characteristic" in stm32h563zi.pdf

    unsigned_char_array_2-1719043062040.png

     

    BharathkumarAuthorAnswer
    Visitor II
    June 27, 2024

    As per your instructions, the problem was solved. We checked it a few times, each for a duration of 5 to 10 minutes, over the last few days. If any issues occur in the future, I will call you back. Thank you for your support and guidance.

    Graduate II
    June 27, 2024

    I'm glad you got it to work. Please kudo the posts that helped you.