Skip to main content
Associate
August 7, 2024
Question

How to make the RTC still operate after the main power is powered off?

I use the internal RTC with MCU P/N:STM32U575.
The schematic has two power supplies,RTC uses the VBAT power supply, others use the main power supply.
My problem is that the RTC can count time normally, but when the main power is powered off and VBAT is continuously powered, the RTC will be cleared and reloaded for me to set the time after the main power is restart.
How to make the RTC still operate after the maim power is powered off?

This topic has been closed for replies.

6 replies

STTwo-32
ST Technical Moderator
August 7, 2024

Hello @Pohua0413 and welcome to the ST Community :smiling_face_with_smiling_eyes:.

According to the reference manual RM0456, to keep the RTC working on Vbat mode, you have to select the LSE as a Clock source for the RTC.

Best Regards.

STTwo-32 

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.
Pohua0413Author
Associate
August 7, 2024

HI @STTwo-32 

Thanks your reply,

The RTC power supply uses VBAT, and the clock source uses LSE=32.768KHz.

I had a discussion with the distributor's FAE, and he mentioned that the RTC time count uses the RAM inside the MCU, and the RTC will be reset when the main power is powered off.

But I don't think his statement is correct, because the RTC has VBAT and LSE, so it should be able to operate normally, and the RTC should not be reset or cleared when the main power is powered off.
So I want to use RTC to have date and time in my system.

 

tdecker2
Associate II
August 7, 2024

Check the RTC init code of your HAL/LL. I remember that I had to add a check if the RTC is already initialized and running, because the default code always did a re-init the RTC on startup.

Pohua0413Author
Associate
August 15, 2024

HI @tdecker2 

Can you help me with this problem?
Because I tried for many days and still got the same result.
Or do I need to provide the HAL of the RTC?

BarryWhit
Lead
August 15, 2024
"- If someone's post helped resolve your issue, please thank them by clicking ""Accept as Solution"".- Please post an update with details once you've solved your issue. Your experience may help others."
Pohua0413Author
Associate
October 21, 2024

Thanks for all the replies.
In the end, this function was completed through the help of an agent. I posted it for reference if I encounter it later.pic1.png