cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103 Loss RTC Date when RESET

Pedram
Associate III
Posted on August 30, 2017 at 11:18

Hello friends

i using STM32CubeMX 4.2.2 & Firmware F103 v1.6 , MCU = STM32F103ZET6

I set the time and date in RTC When micro resets I miss the date but time is still right

How do I fix this problem?

Thank,

6 REPLIES 6
Jeroen3
Senior
Posted on August 30, 2017 at 16:02

You will have to calculate the date. The 103 only has a 32-bit field as RTC. In which you can fit an epoch counter.

Posted on August 30, 2017 at 16:32

>>The 103 only has a 32-bit field as RTC. 

Should be sufficient to hold over a century (100 years) worth of seconds?

Sounds like the reset path code doesn't check if the RTC is already initialized, or has some other nonsensical implementation.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Pedram
Associate III
Posted on September 08, 2017 at 01:14

Someone has a solution?

Posted on September 08, 2017 at 03:03

Unfortunately not for the library you're using, review the code execution, and how the RTC is handled/reset during initialization. In parallel perhaps look at how you're determining the type of reset, ie external button vs exit standby

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Pedram
Associate III
Posted on October 03, 2017 at 15:38

I use HAL functions

Why does not this bug solve ?

Posted on October 03, 2017 at 18:54

Likely has very low priority. The STM32F1 is a ten year old design, the newer parts have a calendaring RTC, not a 32-bit second counter.

If time/date are critical to you, then you'll need to implement your own solution which will likely be more robust and functional.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..