Browse Source

xfdump_full_dump_and_reset: set a guaranteed minimum WDT

Just prior to dumping, reset the WDT to a known-safe (and not too long)
interval that guarantees a complete dump.
Yuri D'Elia 2 years ago
parent
commit
0362b6484f
1 changed files with 5 additions and 1 deletions
  1. 5 1
      Firmware/xflash_dump.cpp

+ 5 - 1
Firmware/xflash_dump.cpp

@@ -105,10 +105,14 @@ void xfdump_full_dump_and_reset(dump_crash_source crash)
     // disable interrupts for a cleaner register dump
     cli();
 
+    // ensure there's always enough time (with some margin) to dump
+    // dump time on w25x20cl: ~150ms
+    wdt_enable(WDTO_500MS);
+
     // write all addressable ranges (this will trash bidirectional registers)
     xfdump_dump_core(buf, DUMP_OFFSET + offsetof(dump_t, data), 0, RAMEND);
 
-    // force a reset soon
+    // force a reset even sooner
     softReset();
 }
 #endif