esp-idf: Wrong reset cause on brownout (ESP_RST_WDT instead of ESP_RST_BROWNOUT) (IDFGH-9468)
Answers checklist.
- I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
- I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
- I have searched the issue tracker for a similar issue and not found a similar issue.
IDF version.
4.4.4
Operating System used.
Windows
How did you build your project?
VS Code IDE
If you are using Windows, please specify command line type.
None
Development Kit.
TTGO (ESP32)
Power Supply used.
USB
What is the expected behavior?
After a brownout and the subsequent restart, ESP_RST_BROWNOUT should be returned by esp_reset_reason().
What is the actual behavior?
Instead, esp_reset_reason() returns ESP_RST_WDT.
Steps to reproduce.
Run any code that displays the result of esp_reset_reason(), then provoke a supply voltage instability. The console will correctly show “Brownout detector was triggered”, the ESP32 will restart and esp_reset_reason() will show the wrong reason.
Debug Logs.
No response
More Information.
The IDF sets the reset reason correctly: https://github.com/espressif/esp-idf/blob/release/v4.4/components/esp_system/port/brownout.c#L66 But it seems to get overwritten by the way the CPUs are reset (using the watchdog).
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 29 (2 by maintainers)
I have reproduced it powering esp with a regulated dc power supply and dropping it’s voltage to something around 1.3V. Using ESP_IDF v4.4.4.
The RTC WDT cannot be disabled in general. It’s always activated by the ESP32 and the ROM bootloader timeout cannot be changed.
19.3.1.3 Flash Boot Protection
https://www.espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf
My workaround is to store the reset hint (RTC_RESET_CAUSE_REG) in RTC SRAM. This memory is not cleared by RTC WDT reset.
esp-idf already uses the RTC SRAM to store timekeeping info.
@ginkgm Are all necessary information in this log? (ESP32-WROOM-32E)