esp32freertos

Solving ESP32 Interrupt Watchdog Resets

2 November 2026

What causes this

The ESP32 Interrupt Watchdog Reset is triggered when an interrupt handler exceeds a predefined execution time, causing the system to reset to prevent prolonged blocking of other tasks. This is managed by the Interrupt Watchdog Timer (IWT) within the FreeRTOS environment. The watchdog is armed when an interrupt takes too long, and if not disarmed in time, it leads to a reset. Common causes include infinite loops or extensive processing within an interrupt service routine (ISR). In the ESP32, this is tracked by the WDT_WPROTECT and WDTCONFIG0 registers. You might see an error code like 0x102 in the serial monitor, indicating a watchdog timeout.

Minimal reproduction

Here's a simple code snippet that can trigger an interrupt watchdog reset. This example runs a long delay inside an ISR, which is a common mistake:

```cpp

#include

void IRAM_ATTR onTimer() {

// Simulating a heavy computation in an ISR

for (volatile int i = 0; i < 1000000; ++i);

}

void setup() {

Serial.begin(115200);

timer = timerBegin(0, 80, true);

timerAttachInterrupt(timer, &onTimer, true);

timerAlarmWrite(timer, 1000000, true);

timerAlarmEnable(timer);

}

void loop() {

// Main loop does nothing

}

```

When you run this code, your serial monitor may show:

```

Guru Meditation Error: Core 0 panic'ed (Interrupt wdt timeout on CPU0)

Cores: 0

Backtrace: 0x4008c3b8:0x3ffb1f50 0x4008c5e5:0x3ffb1f70 0x4008e4f0:0x3ffb1fa0

```

The fix

To fix this issue, ensure that your ISR is as short and efficient as possible. Avoid heavy computations or delays. Use FreeRTOS tasks for operations that take longer time. Here's the corrected version of the ISR:

Before:

```cpp

void IRAM_ATTR onTimer() {

for (volatile int i = 0; i < 1000000; ++i);

}

```

After:

```cpp

void IRAM_ATTR onTimer() {

// Set a flag or give a semaphore to signal a task

BaseType_t xHigherPriorityTaskWoken = pdFALSE;

xSemaphoreGiveFromISR(xSemaphore, &xHigherPriorityTaskWoken);

portYIELD_FROM_ISR(xHigherPriorityTaskWoken);

}

```

By optimizing your ISR like this, you ensure it executes quickly, and the actual work is deferred to the main task loop, thereby preventing the watchdog reset.

How SerialDoctor catches this

SerialDoctor connects to your ESP32 board via Web Serial, reads the serial output, and instantly identifies the interrupt watchdog reset. By analyzing the error codes and backtrace, SerialDoctor provides an explanation and suggests optimizations in under 3 seconds. Visit [serialdoctor.com](https://serialdoctor.com) to try it out for free.

Quick checklist

  • [ ] Ensure ISRs are concise: no loops, no blocking calls.
  • [ ] Use FreeRTOS tasks for time-consuming operations.
  • [ ] Monitor serial output for any Interrupt wdt timeout messages.
  • [ ] Regularly test with SerialDoctor for quick diagnostics.
  • [ ] Review and refactor ISRs to use flags or semaphores for task signaling.

Seeing this crash on your board right now?

Connect it to SerialDoctor and get a root cause + code fix in under 3 seconds.

Try SerialDoctor free →