Page 1 of 1

How to replace the brownout interrupt service routine

Posted: Wed Oct 17, 2018 8:30 am
by Zingemneire
@ESP_igrr

Hi,

I have seen your answer in this reply: viewtopic.php?t=6855#p29440.
In it you say it is simple to replace the standard brownout ISR via menuconfig, can you supply some more details on how to do that exactly ?
I have located the standard code, both on GITHUB and in the current ESP-IDF but I could not find anything in menuconfig to make it execute a different piece of code, all I found via menuconfig was how to set the brownout level ,nothing else. So I guess I must be overlooking it.

Any help much appreciated.

Re: How to replace the brownout interrupt service routine

Posted: Wed Oct 17, 2018 8:57 am
by WiFive
It suggests to turn brownout off in menuconfig and do the rest in code. In the other topic you can see the function brownout_init posted by maldus

Re: How to replace the brownout interrupt service routine

Posted: Wed Oct 17, 2018 9:11 am
by Zingemneire
Hi,

I have figured it out: the exact entry in menuconfig is "Hardware brownout detect & reset" under "ESP-32-specific" under "component-config". Setting that to blank eliminates the call to "esp_brownout_init();" in "cpu_start.c". After that it is simple: duplicate the functionality of "esp_brownout_init();" and reroute the ISR to your own code.

Hope this is useful for someone.