Ad Space — Top Banner

Keeps Resetting

Espressif ESP32

Severity:

What Does This Error Mean?

ESP32 keeps resetting most often because of a brownout (underpowered USB or power supply), a watchdog timer firing because a task blocked too long, or a stack overflow. Open Serial Monitor to read the reset reason printed at startup — this identifies the exact cause.

Affected Models

  • ESP32 DevKit
  • ESP32-WROOM-32
  • ESP32-S2
  • ESP32-S3
  • ESP32-C3
  • ESP32 WROVER

Common Causes

  • Brownout reset — power supply cannot supply enough current during Wi-Fi transmit
  • Watchdog timer reset — loop() or a FreeRTOS task blocked for too long
  • Stack overflow — recursive function or large local array exceeds task stack size
  • Heap corruption — writing past the end of a malloc'd buffer corrupts memory
  • Exception (guru meditation) — null pointer dereference or illegal instruction

How to Fix It

  1. Read the reset reason from Serial Monitor.

    Open Serial Monitor at 115200 baud and power cycle the ESP32. The boot log always prints the reset reason: 'Brownout detector was triggered', 'Guru Meditation Error', 'Task watchdog got triggered', etc. This single step usually identifies the root cause immediately.

  2. Fix brownout: improve power supply.

    If Serial Monitor shows 'Brownout detector was triggered', the 3.3V rail dipped below the brownout threshold during peak current draw (typically Wi-Fi transmission at 300–500mA peak). Use a quality USB cable rated for data (not cheap cables), add a 100µF electrolytic capacitor across VCC and GND, and use a 2A USB charger instead of a 500mA port.

  3. Fix watchdog reset: avoid blocking in loop().

    If the watchdog timer is resetting the ESP32, a function in loop() or a FreeRTOS task is blocking for too long without yielding. Replace blocking delay() calls inside loops with non-blocking millis() timing. Or add vTaskDelay(1) inside your FreeRTOS tasks to yield to the idle task and reset the watchdog.

  4. Fix stack overflow: increase task stack size.

    If a task stack overflow is reported, increase the stack size in xTaskCreate(). Also avoid large local arrays and deeply recursive functions — move large data to global scope or heap (new / malloc). Enable the stack canary feature to get earlier warnings about stack overflows.

  5. Use esp_reset_reason() to log the cause.

    In setup(), call esp_reset_reason() and print the result. This returns the reset reason as an enum (POWERON_RESET, DEEPSLEEP_RESET, WATCHDOG_RESET, BROWNOUT_RESET, etc.). Log it to Serial so you can see the cause on every reset during testing.

When to Call a Professional

ESP32 resets are software or power issues. Read the reset cause from Serial Monitor at 115200 baud — the ESP32 prints the reason on every boot. Share the output for targeted diagnosis.