ESP32C3 Brownout Configuration
Posted: Wed Apr 20, 2022 2:37 pm
I'm having some issues configuring the brownout on ESP32C3.
For reference I'm using the ESP32C3 mini devkit C and I have seen related form posts:
https://www.esp32.com/viewtopic.php?t=6855
https://www.esp32.com/viewtopic.php?t=7690
In the IDF it seems like the C3 has `SOC_BROWNOUT_RESET_SUPPORTED` enabled and as such wont create a brownout interrupt by default when brownout is enabled in the sdkconfig. I tried disabling brownout in the sdkconfig and writing my own brownout initialization and interrupt handler to mimic what I found in the IDF however I was not able to ever break into the interrupt handler. This is my mimicked initialization and interrupt code:
My question is what is `SOC_BROWNOUT_RESET_SUPPORTED` and is the brownout ISR supposed to work on the C3? If the brownout interrupt does not work on the C3 then how do I disable the brownout entirely (so that I can create my own brownout implementation). Currently if I disable brownout in the sdkconfig and lower the voltage to ~3V I end up resetting and the monitor output shows:
Thank You!
For reference I'm using the ESP32C3 mini devkit C and I have seen related form posts:
https://www.esp32.com/viewtopic.php?t=6855
https://www.esp32.com/viewtopic.php?t=7690
In the IDF it seems like the C3 has `SOC_BROWNOUT_RESET_SUPPORTED` enabled and as such wont create a brownout interrupt by default when brownout is enabled in the sdkconfig. I tried disabling brownout in the sdkconfig and writing my own brownout initialization and interrupt handler to mimic what I found in the IDF however I was not able to ever break into the interrupt handler. This is my mimicked initialization and interrupt code:
Code: Select all
static void rtc_brownout_isr_handler(void *arg) {
brownout_hal_intr_clear();
esp_rom_printf("\r\nBrownout detector was Tripped\r\n\r\n");
esp_cpu_stall(!cpu_hal_get_core_id());
esp_restart_noos();
}
void brownout_init(void)
{
brownout_hal_config_t cfg = {
.threshold = 5,
.enabled = true,
.reset_enabled = true,
.flash_power_down = true,
.rf_power_down = true,
};
brownout_hal_config(&cfg);
rtc_isr_register(rtc_brownout_isr_handler, NULL, RTC_CNTL_BROWN_OUT_INT_ENA_M);
brownout_hal_intr_enable(true);
esp_rom_printf("\r\nBrownout detector was Initialized\r\n\r\n");
}
Code: Select all
rst:0xf (BROWNOUT_RST),boot:0xc (SPI_FAST_FLASH_BOOT)