Page 1 of 1

ESP32: Brownout detection configuration

Posted: Mon Nov 18, 2019 6:36 am
by akushva
Hello,

I want to know whether there is any provision in micropython for ESP32 to configure brownout detection voltages or to enable or disable it.

Thanks in advance.

Re: ESP32: Brownout detection configuration

Posted: Mon Nov 18, 2019 11:15 am
by jimmo
I'm unsure of the current status of the brownout detector on ESP32. There's this comment in the Kconfig file (this is part of the ESP IDF, not MicroPython).

Code: Select all

    config ESP32_BROWNOUT_DET
        #The brownout detector code is disabled (by making it depend on a nonexisting symbol) because the current
        #revision of ESP32 silicon has a bug in the brown-out detector, rendering it unusable for resetting the CPU.
        bool "Hardware brownout detect & reset"
        default y
I had a quick look at the IDF code and I couldn't see that it was actually disabled or what the nonexisting symbol was (and it appears to be enabled, as per the "default y").

So if you want to try experimenting with it and you're happy to build your own firmware, you can add a sdkconfig file to your board definition (have a look at ports/esp32/boards/GENERIC/mpconfigboard.mk, and ports/esp32/boards/sdkconfig.base for a starting pint) to set ESP32_BROWNOUT_DET_LVL_SEL and ESP32_BROWNOUT_DET_LVL.

(Note if you're using the v3.3 IDF, the variables are BROWNOUT_DET_LVL_SEL (i.e. without the ESP32_ prefix) ).

From MicroPython, a brownout reset can be detected using machine.reset_cause() (which will return machine.WDT_RESET for a brownout).