Arduino WDT Issue in WiFi STA mode: Unable to reboot 10% of the time
Posted: Tue May 19, 2020 12:51 am
Hi the support team,
I have a critical issue with WDT. The example in the core library runs consistently well. It can reboot successfully if I don't reset the WDT timer.
https://github.com/espressif/arduino-es ... gTimer.ino
However, when I enable WiFi STA in the above example, I begin to see Core 1 panic'ed (Interrupt wdt timeout on CPU1) and I got concerned. In my actual firmware, I get the same Core 1 Error. In addition, 10% of the times the CPU will not be able to reboot at all unless I press the reset button to restart the firmware. I carefully copied everything from the example to my firmware. Here are codes I copied.
Would you see anything that might affect the restart function from working? What could be the reason why the cpu cannot reboot? Thank you.
Best,
Michael
Here are the codes I copied from the example to my firmware:
=====================================================
hw_timer_t * wdtTimer = NULL; // WDT timer handle
void IRAM_ATTR resetModuleISR() {
ets_printf("reboot\n");
//esp_restart();
ESP.restart(); // same as esp_restart()
}
void init_wdt() {
/* Timer 1 Setup as WDT */
Serial.println("Set up WDT.");
wdtTimer = timerBegin(1, 80, true); //timer 1, div 80
timerAttachInterrupt(wdtTimer, &resetModuleISR, true); //attach callback
timerAlarmWrite(wdtTimer, wdtTimeout * 1000, false); //set time in us
timerAlarmEnable(wdtTimer); //enable interrupt
Serial.print("Time stamp (ms) WDT enabled:");
Serial.println(millis());
}
timerWrite(wdtTimer, 0); //reset timer (feed watchdog) in the main loop()
Here is the output I copied when I got the core 1 error and the cpu failed to reboot.
=====================================================
reboot
Guru Meditation Error: Core 1 panic'ed (Interrupt wdt timeout on CPU1)
Core 1 register dump:
PC : 0x4008b5da PS : 0x00060734 A0 : 0x8008a7b7 A1 : 0x3ffbe660
A2 : 0x3ffafe90 A3 : 0x3ffbaec0 A4 : 0x00000001 A5 : 0x00000001
A6 : 0x00060723 A7 : 0x00000000 A8 : 0x3ffbaec0 A9 : 0x3ffbaec0
A10 : 0x00000018 A11 : 0x00000018 A12 : 0x00000001 A13 : 0x00000001
A14 : 0x00060721 A15 : 0x00000000 SAR : 0x00000016 EXCCAUSE: 0x00000006
EXCVADDR: 0x00000000 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0xffffffff
Core 1 was running in ISR context:
EPC1 : 0x4011163c EPC2 : 0x00000000 EPC3 : 0x00000000 EPC4 : 0x4008b5da
Backtrace: 0x4008b5da:0x3ffbe660 0x4008a7b4:0x3ffbe680 0x40088a4f:0x3ffbe6a0 0x400e10a9:0x3ffbe6e0 0x4011cd02:0x3ffbe700 0x40111ac5:0x3ffbe720 0x4008166f:0x3ffbe750 0x400dcb7b:0x3ffbe770 0x40080f5e:
I have a critical issue with WDT. The example in the core library runs consistently well. It can reboot successfully if I don't reset the WDT timer.
https://github.com/espressif/arduino-es ... gTimer.ino
However, when I enable WiFi STA in the above example, I begin to see Core 1 panic'ed (Interrupt wdt timeout on CPU1) and I got concerned. In my actual firmware, I get the same Core 1 Error. In addition, 10% of the times the CPU will not be able to reboot at all unless I press the reset button to restart the firmware. I carefully copied everything from the example to my firmware. Here are codes I copied.
Would you see anything that might affect the restart function from working? What could be the reason why the cpu cannot reboot? Thank you.
Best,
Michael
Here are the codes I copied from the example to my firmware:
=====================================================
hw_timer_t * wdtTimer = NULL; // WDT timer handle
void IRAM_ATTR resetModuleISR() {
ets_printf("reboot\n");
//esp_restart();
ESP.restart(); // same as esp_restart()
}
void init_wdt() {
/* Timer 1 Setup as WDT */
Serial.println("Set up WDT.");
wdtTimer = timerBegin(1, 80, true); //timer 1, div 80
timerAttachInterrupt(wdtTimer, &resetModuleISR, true); //attach callback
timerAlarmWrite(wdtTimer, wdtTimeout * 1000, false); //set time in us
timerAlarmEnable(wdtTimer); //enable interrupt
Serial.print("Time stamp (ms) WDT enabled:");
Serial.println(millis());
}
timerWrite(wdtTimer, 0); //reset timer (feed watchdog) in the main loop()
Here is the output I copied when I got the core 1 error and the cpu failed to reboot.
=====================================================
reboot
Guru Meditation Error: Core 1 panic'ed (Interrupt wdt timeout on CPU1)
Core 1 register dump:
PC : 0x4008b5da PS : 0x00060734 A0 : 0x8008a7b7 A1 : 0x3ffbe660
A2 : 0x3ffafe90 A3 : 0x3ffbaec0 A4 : 0x00000001 A5 : 0x00000001
A6 : 0x00060723 A7 : 0x00000000 A8 : 0x3ffbaec0 A9 : 0x3ffbaec0
A10 : 0x00000018 A11 : 0x00000018 A12 : 0x00000001 A13 : 0x00000001
A14 : 0x00060721 A15 : 0x00000000 SAR : 0x00000016 EXCCAUSE: 0x00000006
EXCVADDR: 0x00000000 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0xffffffff
Core 1 was running in ISR context:
EPC1 : 0x4011163c EPC2 : 0x00000000 EPC3 : 0x00000000 EPC4 : 0x4008b5da
Backtrace: 0x4008b5da:0x3ffbe660 0x4008a7b4:0x3ffbe680 0x40088a4f:0x3ffbe6a0 0x400e10a9:0x3ffbe6e0 0x4011cd02:0x3ffbe700 0x40111ac5:0x3ffbe720 0x4008166f:0x3ffbe750 0x400dcb7b:0x3ffbe770 0x40080f5e: