Skip to main content
timothy0508
Associate 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.

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

waclawek.jan
waclawek.janBest answer
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

timothy0508
Associate 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