ESP32: Brownout detection configuration

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
akushva
Posts: 19
Joined: Fri May 03, 2019 10:08 am

ESP32: Brownout detection configuration

Post by akushva » Mon Nov 18, 2019 6:36 am

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.

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: ESP32: Brownout detection configuration

Post by jimmo » Mon Nov 18, 2019 11:15 am

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).

Post Reply