Brownout handling

ahinsen
Posts: 1
Joined: Tue Mar 02, 2021 9:06 am

Brownout handling

Postby ahinsen » Tue Mar 02, 2021 10:05 am

Hi All,
I would like to discuss proper brownout handling.
The ESP32 chip detects a brownout status and triggers a BROWNOUT reset (if enabled) to properly handle the brownout situation (e.g. saving data to flash, signaling low power alarm, etc). From a brownout state there are two ways out: If power further drops, it causes a shutdown. If power comes back it will clear the brownout state and continues operation without any reset. Am I right so far?
Question: After "properly handling" the brownout situation, what is the proper operation to halt the processor in a way that makes sure that when power comes back, then the processor can start operation from a determined state (e.g. PWRON reset) regardless if it was shut down due to low power, or if it has "survived" the brownout state?
A possible answer: keep watching the brownout status and if it goes back to normal, issue a sw reset....would that work?
Thanks
Andrew

ESP_Sprite
Posts: 9051
Joined: Thu Nov 26, 2015 4:08 am

Re: Brownout handling

Postby ESP_Sprite » Wed Mar 03, 2021 1:39 am

Technically, you don't want to do *anything* that can be corrupted when the brownout detector triggers, as you can't know how fast the power level goes from 'low but usable' to 'out of spec'. In ESP-IDF, we use the brownout detector to trigger a panic to make the user aware of what's going on, but we reboot immediately after. Note that 'brownout' is not the same as 'low battery' or anything: you would expect a low battery to be handled elsewhere, and a brownout to be an anomality that should never happen in normal use.

Who is online

Users browsing this forum: No registered users and 120 guests