How to write 8bytes application data to flash before reset which occurred by wdt

Hi

       If a bug stop the  application to feed the wdt,Is there any way to store 8bytes application data to flash before reset which occurred by wdt?

       I find that there is only two cycles of 32768[Hz] clock to write the 8bytes application data to flash,I think the time is not enough to write the flash.

       I want to write the 8bytes application data to  GPREGRET in the wdt interrupt.Is the time enough to do this?If it is,how to write GPREGRET ?

  • Hi,

    There is not enough time to write to flash when the watchdog triggers, so that is not possible. Another option could be to store the data in a RAM location that is not initialized during startup, and read that after the reset. Note that the RAM content is not guaranteed to be intact, so you should also add a checksum of some sort to validate the data. This thread discusses how to retain the data during the next boot (ensure the memory is not overwritten).

Related