Skip to main content
Visitor II
September 24, 2020
Solved

Reinitialize RTC upon watchdog reset

  • September 24, 2020
  • 1 reply
  • 1926 views

In my application, I have a watchdog timer that resets every 45 seconds if not fed. I also have an RTC. The application records sensor samples, along with timestamps from the RTC.

Problem is, when there is a watchdog reset, the RTC is re-initialized to default date and time. This messes up the sample/timestamp collection.

  • Are the RTC time/date values still maintained even when there is a watchdog reset?
  • Would it make sense to skip setting the default date/time when a watchdog reset has been detected?

Thanks.

    This topic has been closed for replies.
    Best answer by waclawek.jan

    Which STM32?

    > Are the RTC time/date values still maintained even when there is a watchdog reset?

    Yes. Your problems are caused by using Cube.

    > Would it make sense to skip setting the default date/time when a watchdog reset has been detected?

    Yes. You need to detect, if RTC is already set - see RTC_ISR.INITS flag - and act accordingly.

    JW

    1 reply

    Super User
    September 24, 2020

    Which STM32?

    > Are the RTC time/date values still maintained even when there is a watchdog reset?

    Yes. Your problems are caused by using Cube.

    > Would it make sense to skip setting the default date/time when a watchdog reset has been detected?

    Yes. You need to detect, if RTC is already set - see RTC_ISR.INITS flag - and act accordingly.

    JW

    Visitor II
    September 24, 2020

    STM32L4

    Thanks. I just tested this out and it worked. The RTC values are maintained even with a watchdog reset.

    Just needed to be absolutely sure.

    Tim