cancel
Showing results for 
Search instead for 
Did you mean: 

RTC date is reset after power off in STM32F103C8T6

pushkarmondhe
Associate II

HELLO ,In STM32F103C8T6, the RTC time is preserved after power off, but the date always resets to 01/01/2000 even if I set the current date and time.

2 REPLIES 2
TDK
Super User

What hardware is this? Is VBAT remain connected? When you debug, does the magic value prevent the RTC from being re-initialized?

If you feel a post has answered your question, please click "Accept as Solution".
Shirley.Ye
ST Employee

In the STM32F103C8T6 RTC only has a 32-bit counter (the "RTC counter"), which counts seconds. The date is calculated in software based on the counter value.

The date (year, month, day) is calculated by your code (or the HAL/StdPeriph library) from the RTC counter. Any software variables or RAM values are lost when power off unless you store them in the RTC backup registers