diff --git a/components/esp_common/src/brownout.c b/components/esp_common/src/brownout.c index e216cfa0fa..9b90012171 100644 --- a/components/esp_common/src/brownout.c +++ b/components/esp_common/src/brownout.c @@ -40,7 +40,7 @@ #define BROWNOUT_RESET_EN false #endif // SOC_BROWNOUT_RESET_SUPPORTED - +#ifndef SOC_BROWNOUT_RESET_SUPPORTED static void rtc_brownout_isr_handler(void *arg) { /* Normally RTC ISR clears the interrupt flag after the application-supplied @@ -56,6 +56,7 @@ static void rtc_brownout_isr_handler(void *arg) ets_printf("\r\nBrownout detector was triggered\r\n\r\n"); esp_restart_noos(); } +#endif // not SOC_BROWNOUT_RESET_SUPPORTED void esp_brownout_init(void) { @@ -69,9 +70,11 @@ void esp_brownout_init(void) brownout_hal_config(&cfg); +#ifndef SOC_BROWNOUT_RESET_SUPPORTED ESP_ERROR_CHECK( rtc_isr_register(rtc_brownout_isr_handler, NULL, RTC_CNTL_BROWN_OUT_INT_ENA_M) ); brownout_hal_intr_enable(true); +#endif // not SOC_BROWNOUT_RESET_SUPPORTED } void esp_brownout_disable(void) diff --git a/components/soc/src/esp32s2/brownout_hal.c b/components/soc/src/esp32s2/brownout_hal.c index 0658304d65..a09e1ea4ea 100644 --- a/components/soc/src/esp32s2/brownout_hal.c +++ b/components/soc/src/esp32s2/brownout_hal.c @@ -31,6 +31,7 @@ void brownout_hal_config(const brownout_hal_config_t *cfg) .rst_wait = 0x3ff, .rst_ena = cfg->reset_enabled, .ena = cfg->enabled, + .rst_sel = 1, }; RTCCNTL.brown_out = brown_out_reg; }