cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U5 internal RTC time greater than 24 hours

Gaurangthaker
Associate II

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?

6 REPLIES 6
Gyessine
ST Employee

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

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

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.

Gyessine
ST Employee

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

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

waclawek.jan
Super User

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

We are utilizing the STM32U585 MCU.

 

Gyessine
ST Employee

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

 

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.