Skip to main content
Visitor II
December 8, 2025
Question

STM32U5 internal RTC time greater than 24 hours

  • December 8, 2025
  • 4 replies
  • 82 views

We are using the STM32U5 MCU and its internal RTC in our project.
We are facing an issue where the RTC time sometimes goes beyond 24 hours — for example, we observed a timestamp showing 37 hours.

The RTC is configured in 24-hour format, and we have initialized the RTC and its time format correctly as per the reference manual and HAL documentation.

Also, After running for 23:59:59 seconds, the time changes to 24:00:00 instead of 00:00:00, and the week day has not been incremented.

The main challenge is that this does not happen consistently. We see such out-of-range values only randomly, which makes it difficult to identify the root cause.

Has anyone faced a similar issue with the STM32U5 RTC? Could you please suggest possible causes or solutions, or any checks we should perform to debug this behavior?

    This topic has been closed for replies.

    4 replies

    Technical Moderator
    December 8, 2025

    hello @Gaurangthaker 
    Honestly, this issue is unusual to encounter.
    Can you run some of our firmware examples to verify that the RTC is functioning correctly?
    This can help determine whether the issue originates from your project configuration.
    Since you did not specify which STM32U5 you are using, here is a link to an STM32U575ZI-Q nucleo RTC available examples.

     If you are using another product. You can check this link to see the available examples for it.

    I suggest using the alarm or calendar examples. You can modify them to make the LED turn on after 24 hours to verify if the issue occurs.

    Hope that helps
    Gyessine

    Visitor II
    December 15, 2025

    We have checked the configuration and initialization, and everything appears to be correct. Since we are using the internal RTC, we require a solution specifically for the internal RTC.

    Technical Moderator
    December 15, 2025

    hello @Gaurangthaker 
    can you specify which STM32U5 are you using?
    Gyessine

    Visitor II
    December 15, 2025

    We are utilizing the STM32U585 MCU.

     

    Super User
    December 15, 2025

    This usually happens when you use Cube/HAL functions setting RTC time with uninitialized fields in the init struct.

    Read out and check/post content of RTC registers, when this problem happens.

    JW

    Technical Moderator
    December 16, 2025

    Hello @Gaurangthaker

    I tried to replicate your case, but I did not encounter your issue.
    I am going to attach the project so you can test it yourself. Maybe it will help, or you can use it as a reference if I understood your case correctly. If not, can you provide more details about your problem?
    The project is initialized at 23 hours, 59 minutes, and 30 seconds.
    You can see the time by following these buffers in live expression when you launch a debug session if you are using STM32CubeIDE:

    • aShowTimeStamp
    • aShowDateStamp

    The date will be updated once it reaches the 23 hours, 59 minutes, and 59 seconds mark, as shown in this screenshot.

    Gyessine_0-1765873739752.png

    I hope this information helps you solve your problem. If it does, please accept it as the solution to help other users who encounter the same issue.
    Gyessine