ESP32 reset reasons: what rst:0x… means
The first line the ROM prints at boot says why the chip restarted. After a crash it is the most useful line in the log, and the one most often ignored.
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
ESP32 reset reasons
From ESP-IDF's ROM header for the ESP32 (components/esp_rom/esp32/include/esp32/rom/rtc.h):
| rst | Name | What restarted it |
|---|---|---|
| 0x1 | POWERON_RESET | Power was applied (or came back). |
| 0x3 | SW_RESET | Software reset of the digital core. |
| 0x4 | OWDT_RESET | Legacy watchdog. |
| 0x5 | DEEPSLEEP_RESET | Woke up from deep sleep. Normal if the device sleeps. |
| 0x6 | SDIO_RESET | Reset by the SDIO (SLC) module. |
| 0x7 | TG0WDT_SYS_RESET | Timer Group 0 watchdog: the system hung hard enough that the watchdog reset it. |
| 0x8 | TG1WDT_SYS_RESET | Timer Group 1 watchdog, the one the interrupt watchdog uses when its panic could not run. |
| 0x9 | RTCWDT_SYS_RESET | RTC watchdog reset the digital core. |
| 0xa | INTRUSION_RESET | Intrusion test. |
| 0xb | TGWDT_CPU_RESET | Timer Group watchdog reset the CPU. |
| 0xc | SW_CPU_RESET | Software reset of the CPU: esp_restart(), and also the restart after a panic. If you did not call esp_restart(), look for a crash just before. |
| 0xd | RTCWDT_CPU_RESET | RTC watchdog reset the CPU. |
| 0xe | EXT_CPU_RESET | The APP CPU was reset by the PRO CPU. |
| 0xf | RTCWDT_BROWN_OUT_RESET | The supply voltage was not stable: a brownout. |
| 0x10 | RTCWDT_RTC_RESET | RTC watchdog reset the digital core and the RTC. In startup it means the bootloader took too long (CONFIG_BOOTLOADER_WDT_TIME_MS). |
The ESP32-S2, S3, C3, C6 and newer chips use mostly the same numbers with slightly different names, for example RTC_SW_CPU_RST for 0xc on the C3, and add a few of their own (0x15 and 0x16 for resets from the USB serial and JTAG port). Their table is in the same folder of ESP-IDF under the chip's name.
In your code
esp_reset_reason() returns the reason at run time as an esp_reset_reason_t (ESP_RST_PANIC, ESP_RST_BROWNOUT, ESP_RST_TASK_WDT, ESP_RST_INT_WDT and so on). Log it at every boot: a device in the field that restarts with ESP_RST_PANIC twice a day has a bug you can find; one that restarts with ESP_RST_BROWNOUT has a power supply problem.
Pinscope records the reset reason of every boot of every device and counts them per week, so a device that keeps restarting stands out, with the crash that caused it: crashes from the field.
Related errors: Brownout detector was triggered · Task watchdog got triggered · Interrupt wdt timeout · LoadProhibited. All ESP32 errors: the list. Messages and causes from ESP-IDF's panic handler and Espressif's Fatal Errors guide.
More
- Remote access to an ESP32 without TLS: what it measured and what it costs
- Reaching an ESP32 web server from outside its network
- Updating ESP32 firmware over the internet, with rollback
- Guru Meditation Error: decoding the backtrace, and crashes from the field
- Remote logging: ESP_LOG without a serial cable
- Heap and stack monitoring in the field
- An ESP32 behind CGNAT, 4G or Starlink
- TLS memory usage on the ESP32, and how to reduce it
- Sharing an ESP32 sensor page with anyone, without port forwarding
- ArduinoOTA over the internet, with a rollback
- ESP32 remote access compared: port forwarding, ngrok, Cloudflare Tunnel, Tailscale
- esp_http_server slow? The 250 ms delay and the fix
- Before the first ESP32 ships: a field support checklist
- ESP32 exception decoder: a Guru Meditation backtrace to lines, in the browser