Skip to main content
Pedram
Associate III
August 30, 2017
Question

STM32F103 Loss RTC Date when RESET

  • August 30, 2017
  • 3 replies
  • 1452 views
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,

    This topic has been closed for replies.

    3 replies

    Jeroen3
    Senior
    August 30, 2017
    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.

    Tesla DeLorean
    Guru
    August 30, 2017
    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 VenmoUp vote any posts that you find helpful, it shows what's working..
    Pedram
    PedramAuthor
    Associate III
    September 7, 2017
    Posted on September 08, 2017 at 01:14

    Someone has a solution?

    Tesla DeLorean
    Guru
    September 8, 2017
    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 VenmoUp vote any posts that you find helpful, it shows what's working..
    Pedram
    PedramAuthor
    Associate III
    October 3, 2017
    Posted on October 03, 2017 at 15:38

    I use HAL functions

    Why does not this bug solve ?

    Tesla DeLorean
    Guru
    October 3, 2017
    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 VenmoUp vote any posts that you find helpful, it shows what's working..