cancel
Showing results for 
Search instead for 
Did you mean: 

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

Pohua0413
Associate II

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?

5 REPLIES 5
STTwo-32
ST Employee

Hello @Pohua0413 and welcome to the ST Community 😊.

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.

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

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.

Pohua0413
Associate II

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
Senior III

Related thread from just a few days ago:

https://community.st.com/t5/stm32-mcus-products/is-there-a-secret-code-required-to-read-and-write-the-rtc-value/m-p/707545

- 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.