Merge branch 'refactor/move_bod_to_hw_support' into 'master'

refactor(bod): Move brownout handling file from esp_system to esp_hw_support

See merge request espressif/esp-idf!36191
This commit is contained in:
C.S.M 2025-01-09 11:08:05 +08:00
commit 50cd05c4ac
48 changed files with 433 additions and 185 deletions

View File

@ -146,6 +146,11 @@ if(NOT non_os_build)
if(CONFIG_SOC_GPIO_CLOCKOUT_BY_GPIO_MATRIX OR CONFIG_SOC_GPIO_CLOCKOUT_BY_IO_MUX)
list(APPEND srcs "esp_clock_output.c")
endif()
if(CONFIG_SOC_BOD_SUPPORTED)
list(APPEND srcs "power_supply/brownout.c")
endif()
else()
if(ESP_TEE_BUILD)
list(APPEND srcs "esp_clk.c" "hw_random.c")
@ -156,7 +161,7 @@ endif()
set(public_include_dirs "include" "include/soc" "include/soc/${target}"
"dma/include" "ldo/include" "debug_probe/include"
"mspi_timing_tuning/include")
"mspi_timing_tuning/include" "power_supply/include")
if(CONFIG_IDF_TARGET_ESP32H21)
list(REMOVE_ITEM srcs

View File

@ -247,6 +247,8 @@ menu "Hardware Settings"
orsource "./port/$IDF_TARGET/Kconfig.ldo"
orsource "./power_supply/port/$IDF_TARGET/Kconfig.bod"
# Invisible bringup bypass options for esp_hw_support component
config ESP_BRINGUP_BYPASS_CPU_CLK_SETTING
bool

View File

@ -12,7 +12,7 @@ choice ESP32_REV_MIN
config ESP32_REV_MIN_0
bool "Rev v0.0 (ECO0)"
# Brownout on Rev 0 is bugged, must use interrupt
select ESP_SYSTEM_BROWNOUT_INTR
select ESP_BROWNOUT_USE_INTR
config ESP32_REV_MIN_1
bool "Rev v1.0 (ECO1)"
config ESP32_REV_MIN_1_1

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -25,6 +25,7 @@
#include "sdkconfig.h"
#include "esp_rom_uart.h"
#include "hal/uart_ll.h"
#include "soc/power_supply_periph.h"
#if defined(CONFIG_ESP_BROWNOUT_DET_LVL)
#define BROWNOUT_DET_LVL CONFIG_ESP_BROWNOUT_DET_LVL
@ -34,7 +35,7 @@
static __attribute__((unused)) DRAM_ATTR const char TAG[] = "BOD";
#if CONFIG_ESP_SYSTEM_BROWNOUT_INTR
#if CONFIG_ESP_BROWNOUT_USE_INTR
IRAM_ATTR static void rtc_brownout_isr_handler(void *arg)
{
/* Normally RTC ISR clears the interrupt flag after the application-supplied
@ -71,11 +72,11 @@ IRAM_ATTR static void rtc_brownout_isr_handler(void *arg)
ESP_INFINITE_LOOP();
}
#endif // CONFIG_ESP_SYSTEM_BROWNOUT_INTR
#endif // CONFIG_ESP_BROWNOUT_USE_INTR
void esp_brownout_init(void)
{
#if CONFIG_ESP_SYSTEM_BROWNOUT_INTR
#if CONFIG_ESP_BROWNOUT_USE_INTR
brownout_hal_config_t cfg = {
.threshold = BROWNOUT_DET_LVL,
.enabled = true,
@ -87,15 +88,12 @@ void esp_brownout_init(void)
brownout_hal_config(&cfg);
brownout_ll_intr_clear();
#if SOC_LP_TIMER_BOD_SHARE_INTR_SOURCE
// TODO IDF-6606: LP_RTC_TIMER interrupt source is shared by lp_timer and brownout detector, but lp_timer interrupt
// is not used now. An interrupt allocator is needed when lp_timer intr gets supported.
esp_intr_alloc_intrstatus(ETS_LP_RTC_TIMER_INTR_SOURCE, ESP_INTR_FLAG_IRAM | ESP_INTR_FLAG_SHARED, (uint32_t)brownout_ll_intr_get_status_reg(), BROWNOUT_DETECTOR_LL_INTERRUPT_MASK, &rtc_brownout_isr_handler, NULL, NULL);
#elif CONFIG_IDF_TARGET_ESP32P4
esp_intr_alloc(ETS_LP_ANAPERI_INTR_SOURCE, ESP_INTR_FLAG_IRAM, &rtc_brownout_isr_handler, NULL, NULL);
#else
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C2
rtc_isr_register(rtc_brownout_isr_handler, NULL, RTC_CNTL_BROWN_OUT_INT_ENA_M, RTC_INTR_FLAG_IRAM);
#else
esp_intr_alloc_intrstatus(power_supply_periph_signal.irq, ESP_INTR_FLAG_IRAM | ESP_INTR_FLAG_SHARED, (uint32_t)brownout_ll_intr_get_status_reg(), BROWNOUT_DETECTOR_LL_INTERRUPT_MASK, &rtc_brownout_isr_handler, NULL, NULL);
#endif
brownout_ll_intr_enable(true);
#else // brownout without interrupt
@ -119,8 +117,8 @@ void esp_brownout_disable(void)
};
brownout_hal_config(&cfg);
#if CONFIG_ESP_SYSTEM_BROWNOUT_INTR
#if CONFIG_ESP_BROWNOUT_USE_INTR
brownout_ll_intr_enable(false);
rtc_isr_deregister(rtc_brownout_isr_handler, NULL);
#endif // CONFIG_ESP_SYSTEM_BROWNOUT_INTR
#endif // CONFIG_ESP_BROWNOUT_USE_INTR
}

View File

@ -0,0 +1,35 @@
/*
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Initialize the brownout detection system
*
* This function configures and enables the brownout detection hardware, which monitors
* the power supply voltage and triggers appropriate system actions if the voltage
* drops below a predefined threshold. Brownout detection helps ensure the stability
* and reliability of the system under low-voltage conditions.
*/
void esp_brownout_init(void);
/**
* @brief Disable the brownout detection system
*
* This function disables the brownout detection hardware, stopping voltage monitoring
* and associated system actions. Use this function with caution, as disabling brownout
* detection may increase the risk of system instability or malfunction under low-voltage
* conditions.
*/
void esp_brownout_disable(void);
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,64 @@
menu "Brownout Detector"
config ESP_BROWNOUT_DET
bool "Hardware brownout detect & reset"
depends on !IDF_ENV_FPGA
default y
help
The ESP has a built-in brownout detector which can detect if the voltage is lower than
a specific value. If this happens, it will reset the chip in order to prevent unintended
behaviour.
choice ESP_BROWNOUT_DET_LVL_SEL
prompt "Brownout voltage level"
depends on ESP_BROWNOUT_DET
default ESP_BROWNOUT_DET_LVL_SEL_0
help
The brownout detector will reset the chip when the supply voltage is approximately
below this level. Note that there may be some variation of brownout voltage level
between each ESP chip.
#The voltage levels here are estimates, more work needs to be done to figure out the exact voltages
#of the brownout threshold levels.
config ESP_BROWNOUT_DET_LVL_SEL_0
bool "2.43V +/- 0.05"
config ESP_BROWNOUT_DET_LVL_SEL_1
bool "2.48V +/- 0.05"
config ESP_BROWNOUT_DET_LVL_SEL_2
bool "2.58V +/- 0.05"
config ESP_BROWNOUT_DET_LVL_SEL_3
bool "2.62V +/- 0.05"
config ESP_BROWNOUT_DET_LVL_SEL_4
bool "2.67V +/- 0.05"
config ESP_BROWNOUT_DET_LVL_SEL_5
bool "2.70V +/- 0.05"
config ESP_BROWNOUT_DET_LVL_SEL_6
bool "2.77V +/- 0.05"
config ESP_BROWNOUT_DET_LVL_SEL_7
bool "2.80V +/- 0.05"
endchoice
config ESP_BROWNOUT_DET_LVL
int
default 0 if ESP_BROWNOUT_DET_LVL_SEL_0
default 1 if ESP_BROWNOUT_DET_LVL_SEL_1
default 2 if ESP_BROWNOUT_DET_LVL_SEL_2
default 3 if ESP_BROWNOUT_DET_LVL_SEL_3
default 4 if ESP_BROWNOUT_DET_LVL_SEL_4
default 5 if ESP_BROWNOUT_DET_LVL_SEL_5
default 6 if ESP_BROWNOUT_DET_LVL_SEL_6
default 7 if ESP_BROWNOUT_DET_LVL_SEL_7
config ESP_BROWNOUT_USE_INTR
bool
default n
help
This config allows to trigger an interrupt when brownout detected. Software restart will be done
at the end of the default callback.
Two occasions need to restart the chip with interrupt so far.
(1). For ESP32 version 1, brown-out reset function doesn't work (see ESP32 errata 3.4).
So that we must restart from interrupt.
(2). For special workflow, the chip needs do more things instead of restarting directly. This part
needs to be done in callback function of interrupt.
endmenu

View File

@ -42,4 +42,14 @@ menu "Brownout Detector"
default 6 if ESP_BROWNOUT_DET_LVL_SEL_6
default 7 if ESP_BROWNOUT_DET_LVL_SEL_7
config ESP_BROWNOUT_USE_INTR
bool
default n
help
This config allows to trigger an interrupt when brownout detected. Software restart will be done
at the end of the default callback.
This is because for some special workflow, the chip needs do more things when brownout happens
before restart instead of restarting directly. This part needs to be done in callback function
of interrupt.
endmenu

View File

@ -42,4 +42,14 @@ menu "Brownout Detector"
default 6 if ESP_BROWNOUT_DET_LVL_SEL_6
default 7 if ESP_BROWNOUT_DET_LVL_SEL_7
config ESP_BROWNOUT_USE_INTR
bool
default n
help
This config allows to trigger an interrupt when brownout detected. Software restart will be done
at the end of the default callback.
This is because for some special workflow, the chip needs do more things when brownout happens
before restart instead of restarting directly. This part needs to be done in callback function
of interrupt.
endmenu

View File

@ -42,4 +42,14 @@ menu "Brownout Detector"
default 6 if ESP_BROWNOUT_DET_LVL_SEL_6
default 7 if ESP_BROWNOUT_DET_LVL_SEL_7
config ESP_BROWNOUT_USE_INTR
bool
default n
help
This config allows to trigger an interrupt when brownout detected. Software restart will be done
at the end of the default callback.
This is because for some special workflow, the chip needs do more things when brownout happens
before restart instead of restarting directly. This part needs to be done in callback function
of interrupt.
endmenu

View File

@ -42,4 +42,14 @@ menu "Brownout Detector"
default 6 if ESP_BROWNOUT_DET_LVL_SEL_6
default 7 if ESP_BROWNOUT_DET_LVL_SEL_7
config ESP_BROWNOUT_USE_INTR
bool
default n
help
This config allows to trigger an interrupt when brownout detected. Software restart will be done
at the end of the default callback.
This is because for some special workflow, the chip needs do more things when brownout happens
before restart instead of restarting directly. This part needs to be done in callback function
of interrupt.
endmenu

View File

@ -42,4 +42,14 @@ menu "Brownout Detector"
default 6 if ESP_BROWNOUT_DET_LVL_SEL_6
default 7 if ESP_BROWNOUT_DET_LVL_SEL_7
config ESP_BROWNOUT_USE_INTR
bool
default n
help
This config allows to trigger an interrupt when brownout detected. Software restart will be done
at the end of the default callback.
This is because for some special workflow, the chip needs do more things when brownout happens
before restart instead of restarting directly. This part needs to be done in callback function
of interrupt.
endmenu

View File

@ -48,4 +48,14 @@ menu "Brownout Detector"
default 6 if ESP_BROWNOUT_DET_LVL_SEL_6
default 7 if ESP_BROWNOUT_DET_LVL_SEL_7
config ESP_BROWNOUT_USE_INTR
bool
default n
help
This config allows to trigger an interrupt when brownout detected. Software restart will be done
at the end of the default callback.
This is because for some special workflow, the chip needs do more things when brownout happens
before restart instead of restarting directly. This part needs to be done in callback function
of interrupt.
endmenu

View File

@ -48,4 +48,14 @@ menu "Brownout Detector"
default 6 if ESP_BROWNOUT_DET_LVL_SEL_6
default 7 if ESP_BROWNOUT_DET_LVL_SEL_7
config ESP_BROWNOUT_USE_INTR
bool
default n
help
This config allows to trigger an interrupt when brownout detected. Software restart will be done
at the end of the default callback.
This is because for some special workflow, the chip needs do more things when brownout happens
before restart instead of restarting directly. This part needs to be done in callback function
of interrupt.
endmenu

View File

@ -36,4 +36,14 @@ menu "Brownout Detector"
default 6 if ESP_BROWNOUT_DET_LVL_SEL_6
default 7 if ESP_BROWNOUT_DET_LVL_SEL_7
config ESP_BROWNOUT_USE_INTR
bool
default n
help
This config allows to trigger an interrupt when brownout detected. Software restart will be done
at the end of the default callback.
This is because for some special workflow, the chip needs do more things when brownout happens
before restart instead of restarting directly. This part needs to be done in callback function
of interrupt.
endmenu

View File

@ -0,0 +1,59 @@
menu "Brownout Detector"
config ESP_BROWNOUT_DET
bool "Hardware brownout detect & reset"
depends on !IDF_ENV_FPGA
default y
help
The ESP32-S2 has a built-in brownout detector which can detect if the voltage is lower than
a specific value. If this happens, it will reset the chip in order to prevent unintended
behaviour.
choice ESP_BROWNOUT_DET_LVL_SEL
prompt "Brownout voltage level"
depends on ESP_BROWNOUT_DET
default ESP_BROWNOUT_DET_LVL_SEL_7
help
The brownout detector will reset the chip when the supply voltage is approximately
below this level. Note that there may be some variation of brownout voltage level
between each ESP3-S2 chip.
#The voltage levels here are estimates, more work needs to be done to figure out the exact voltages
#of the brownout threshold levels.
config ESP_BROWNOUT_DET_LVL_SEL_7
bool "2.44V"
config ESP_BROWNOUT_DET_LVL_SEL_6
bool "2.56V"
config ESP_BROWNOUT_DET_LVL_SEL_5
bool "2.67V"
config ESP_BROWNOUT_DET_LVL_SEL_4
bool "2.84V"
config ESP_BROWNOUT_DET_LVL_SEL_3
bool "2.98V"
config ESP_BROWNOUT_DET_LVL_SEL_2
bool "3.19V"
config ESP_BROWNOUT_DET_LVL_SEL_1
bool "3.30V"
endchoice
config ESP_BROWNOUT_DET_LVL
int
default 1 if ESP_BROWNOUT_DET_LVL_SEL_1
default 2 if ESP_BROWNOUT_DET_LVL_SEL_2
default 3 if ESP_BROWNOUT_DET_LVL_SEL_3
default 4 if ESP_BROWNOUT_DET_LVL_SEL_4
default 5 if ESP_BROWNOUT_DET_LVL_SEL_5
default 6 if ESP_BROWNOUT_DET_LVL_SEL_6
default 7 if ESP_BROWNOUT_DET_LVL_SEL_7
config ESP_BROWNOUT_USE_INTR
bool
default n
help
This config allows to trigger an interrupt when brownout detected. Software restart will be done
at the end of the default callback.
This is because for some special workflow, the chip needs do more things when brownout happens
before restart instead of restarting directly. This part needs to be done in callback function
of interrupt.
endmenu

View File

@ -46,4 +46,14 @@ menu "Brownout Detector"
default 6 if ESP_BROWNOUT_DET_LVL_SEL_6
default 7 if ESP_BROWNOUT_DET_LVL_SEL_7
config ESP_BROWNOUT_USE_INTR
bool
default n
help
This config allows to trigger an interrupt when brownout detected. Software restart will be done
at the end of the default callback.
This is because for some special workflow, the chip needs do more things when brownout happens
before restart instead of restarting directly. This part needs to be done in callback function
of interrupt.
endmenu

View File

@ -6,3 +6,4 @@ CONFIG_TWO_UNIVERSAL_MAC_ADDRESS CONFIG_ESP32_UNIVERSAL_M
CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_FOUR
CONFIG_ESP_SYSTEM_PD_FLASH CONFIG_ESP_SLEEP_POWER_DOWN_FLASH
CONFIG_ESP_SYSTEM_BROWNOUT_INTR CONFIG_ESP_BROWNOUT_USE_INTR

View File

@ -583,19 +583,7 @@ menu "ESP System Settings"
endchoice
# Insert chip-specific system config
rsource "./port/soc/$IDF_TARGET/Kconfig.system"
config ESP_SYSTEM_BROWNOUT_INTR
bool
default n
help
This config allows to trigger an interrupt when brownout detected. Software restart will be done
at the end of the default callback.
Two occasions need to restart the chip with interrupt so far.
(1). For ESP32 version 1, brown-out reset function doesn't work (see ESP32 errata 3.4).
So that we must restart from interrupt.
(2). For special workflow, the chip needs do more things instead of restarting directly. This part
needs to be done in callback function of interrupt.
orsource "./port/soc/$IDF_TARGET/Kconfig.system"
config ESP_SYSTEM_HW_STACK_GUARD
bool "Hardware stack guard"

View File

@ -12,10 +12,6 @@ if(NOT CONFIG_APP_BUILD_TYPE_PURE_RAM_APP)
list(APPEND srcs "image_process.c")
endif()
if(CONFIG_SOC_BOD_SUPPORTED)
list(APPEND srcs "brownout.c")
endif()
if(CONFIG_ESP_CONSOLE_USB_CDC)
list(APPEND srcs "usb_console.c")
endif()

View File

@ -1,22 +0,0 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef __ESP_BROWNOUT_H
#define __ESP_BROWNOUT_H
#ifdef __cplusplus
extern "C" {
#endif
void esp_brownout_init(void);
void esp_brownout_disable(void);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,56 +1,3 @@
menu "Brownout Detector"
config ESP_BROWNOUT_DET
bool "Hardware brownout detect & reset"
depends on !IDF_ENV_FPGA
default y
help
The ESP has a built-in brownout detector which can detect if the voltage is lower than
a specific value. If this happens, it will reset the chip in order to prevent unintended
behaviour.
choice ESP_BROWNOUT_DET_LVL_SEL
prompt "Brownout voltage level"
depends on ESP_BROWNOUT_DET
default ESP_BROWNOUT_DET_LVL_SEL_0
help
The brownout detector will reset the chip when the supply voltage is approximately
below this level. Note that there may be some variation of brownout voltage level
between each ESP chip.
#The voltage levels here are estimates, more work needs to be done to figure out the exact voltages
#of the brownout threshold levels.
config ESP_BROWNOUT_DET_LVL_SEL_0
bool "2.43V +/- 0.05"
config ESP_BROWNOUT_DET_LVL_SEL_1
bool "2.48V +/- 0.05"
config ESP_BROWNOUT_DET_LVL_SEL_2
bool "2.58V +/- 0.05"
config ESP_BROWNOUT_DET_LVL_SEL_3
bool "2.62V +/- 0.05"
config ESP_BROWNOUT_DET_LVL_SEL_4
bool "2.67V +/- 0.05"
config ESP_BROWNOUT_DET_LVL_SEL_5
bool "2.70V +/- 0.05"
config ESP_BROWNOUT_DET_LVL_SEL_6
bool "2.77V +/- 0.05"
config ESP_BROWNOUT_DET_LVL_SEL_7
bool "2.80V +/- 0.05"
endchoice
config ESP_BROWNOUT_DET_LVL
int
default 0 if ESP_BROWNOUT_DET_LVL_SEL_0
default 1 if ESP_BROWNOUT_DET_LVL_SEL_1
default 2 if ESP_BROWNOUT_DET_LVL_SEL_2
default 3 if ESP_BROWNOUT_DET_LVL_SEL_3
default 4 if ESP_BROWNOUT_DET_LVL_SEL_4
default 5 if ESP_BROWNOUT_DET_LVL_SEL_5
default 6 if ESP_BROWNOUT_DET_LVL_SEL_6
default 7 if ESP_BROWNOUT_DET_LVL_SEL_7
endmenu
config ESP32_DISABLE_BASIC_ROM_CONSOLE
bool "Permanently disable BASIC ROM Console"
default n

View File

@ -1,53 +1,3 @@
menu "Brownout Detector"
config ESP_BROWNOUT_DET
bool "Hardware brownout detect & reset"
depends on !IDF_ENV_FPGA
default y
help
The ESP32-S2 has a built-in brownout detector which can detect if the voltage is lower than
a specific value. If this happens, it will reset the chip in order to prevent unintended
behaviour.
choice ESP_BROWNOUT_DET_LVL_SEL
prompt "Brownout voltage level"
depends on ESP_BROWNOUT_DET
default ESP_BROWNOUT_DET_LVL_SEL_7
help
The brownout detector will reset the chip when the supply voltage is approximately
below this level. Note that there may be some variation of brownout voltage level
between each ESP3-S2 chip.
#The voltage levels here are estimates, more work needs to be done to figure out the exact voltages
#of the brownout threshold levels.
config ESP_BROWNOUT_DET_LVL_SEL_7
bool "2.44V"
config ESP_BROWNOUT_DET_LVL_SEL_6
bool "2.56V"
config ESP_BROWNOUT_DET_LVL_SEL_5
bool "2.67V"
config ESP_BROWNOUT_DET_LVL_SEL_4
bool "2.84V"
config ESP_BROWNOUT_DET_LVL_SEL_3
bool "2.98V"
config ESP_BROWNOUT_DET_LVL_SEL_2
bool "3.19V"
config ESP_BROWNOUT_DET_LVL_SEL_1
bool "3.30V"
endchoice
config ESP_BROWNOUT_DET_LVL
int
default 1 if ESP_BROWNOUT_DET_LVL_SEL_1
default 2 if ESP_BROWNOUT_DET_LVL_SEL_2
default 3 if ESP_BROWNOUT_DET_LVL_SEL_3
default 4 if ESP_BROWNOUT_DET_LVL_SEL_4
default 5 if ESP_BROWNOUT_DET_LVL_SEL_5
default 6 if ESP_BROWNOUT_DET_LVL_SEL_6
default 7 if ESP_BROWNOUT_DET_LVL_SEL_7
endmenu
config ESP32S2_KEEP_USB_ALIVE
bool "Keep USB peripheral enabled at start up" if !ESP_CONSOLE_USB_CDC
default y if ESP_CONSOLE_USB_CDC

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -20,6 +20,7 @@
#include "hal/efuse_hal.h"
#include "soc/chip_revision.h"
#define BROWNOUT_DETECTOR_LL_INTERRUPT_MASK (BIT(31))
#define BROWNOUT_DETECTOR_LL_FIB_ENABLE (BIT(1))
#ifdef __cplusplus
@ -138,6 +139,16 @@ static inline void brownout_ll_clear_count(void)
LP_ANA_PERI.bod_mode0_cntl.bod_mode0_cnt_clr = 0;
}
/**
* @brief Get interrupt status register address
*
* @return Register address
*/
static inline volatile void *brownout_ll_intr_get_status_reg(void)
{
return &LP_ANA_PERI.int_st;
}
#ifdef __cplusplus
}
#endif

View File

@ -169,6 +169,10 @@ if(CONFIG_SOC_LCDCAM_CAM_SUPPORTED)
list(APPEND srcs "${target_folder}/cam_periph.c")
endif()
if(CONFIG_SOC_BOD_SUPPORTED)
list(APPEND srcs "${target_folder}/power_supply_periph.c")
endif()
idf_component_register(SRCS ${srcs}
INCLUDE_DIRS ${includes}
LDFRAGMENTS "linker.lf")

View File

@ -0,0 +1,11 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "soc/power_supply_periph.h"
const power_supply_signal_conn_t power_supply_periph_signal = {
.irq = ETS_RTC_CORE_INTR_SOURCE,
};

View File

@ -0,0 +1,11 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "soc/power_supply_periph.h"
const power_supply_signal_conn_t power_supply_periph_signal = {
.irq = ETS_RTC_CORE_INTR_SOURCE,
};

View File

@ -0,0 +1,11 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "soc/power_supply_periph.h"
const power_supply_signal_conn_t power_supply_periph_signal = {
.irq = ETS_RTC_CORE_INTR_SOURCE,
};

View File

@ -1215,10 +1215,6 @@ config SOC_LP_TIMER_BIT_WIDTH_HI
int
default 16
config SOC_LP_TIMER_BOD_SHARE_INTR_SOURCE
bool
default y
config SOC_TIMER_GROUPS
int
default 2

View File

@ -485,7 +485,6 @@
/*-------------------------- LP_TIMER CAPS ----------------------------------*/
#define SOC_LP_TIMER_BIT_WIDTH_LO 32 // Bit width of lp_timer low part
#define SOC_LP_TIMER_BIT_WIDTH_HI 16 // Bit width of lp_timer high part
#define SOC_LP_TIMER_BOD_SHARE_INTR_SOURCE 1 //LP timer and brownout detector share the interrupt source
/*--------------------------- TIMER GROUP CAPS ---------------------------------------*/
#define SOC_TIMER_GROUPS (2)

View File

@ -0,0 +1,11 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "soc/power_supply_periph.h"
const power_supply_signal_conn_t power_supply_periph_signal = {
.irq = ETS_LP_RTC_TIMER_INTR_SOURCE,
};

View File

@ -1155,10 +1155,6 @@ config SOC_LP_TIMER_BIT_WIDTH_HI
int
default 16
config SOC_LP_TIMER_BOD_SHARE_INTR_SOURCE
bool
default y
config SOC_TIMER_GROUPS
int
default 2

View File

@ -450,7 +450,6 @@
/*-------------------------- LP_TIMER CAPS ----------------------------------*/
#define SOC_LP_TIMER_BIT_WIDTH_LO 32 // Bit width of lp_timer low part
#define SOC_LP_TIMER_BIT_WIDTH_HI 16 // Bit width of lp_timer high part
#define SOC_LP_TIMER_BOD_SHARE_INTR_SOURCE 1 //LP timer and brownout detector share the interrupt source
/*--------------------------- TIMER GROUP CAPS ---------------------------------------*/
#define SOC_TIMER_GROUPS (2)

View File

@ -0,0 +1,11 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "soc/power_supply_periph.h"
const power_supply_signal_conn_t power_supply_periph_signal = {
.irq = ETS_LP_RTC_TIMER_INTR_SOURCE,
};

View File

@ -875,10 +875,6 @@ config SOC_LP_TIMER_BIT_WIDTH_HI
int
default 16
config SOC_LP_TIMER_BOD_SHARE_INTR_SOURCE
bool
default y
config SOC_TIMER_GROUPS
int
default 2

View File

@ -363,7 +363,6 @@
/*-------------------------- LP_TIMER CAPS ----------------------------------*/
#define SOC_LP_TIMER_BIT_WIDTH_LO 32 // Bit width of lp_timer low part
#define SOC_LP_TIMER_BIT_WIDTH_HI 16 // Bit width of lp_timer high part
#define SOC_LP_TIMER_BOD_SHARE_INTR_SOURCE 1 //LP timer and brownout detector share the interrupt source
/*--------------------------- TIMER GROUP CAPS ---------------------------------------*/
#define SOC_TIMER_GROUPS (2)

View File

@ -0,0 +1,11 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "soc/power_supply_periph.h"
const power_supply_signal_conn_t power_supply_periph_signal = {
.irq = ETS_LP_RTC_TIMER_INTR_SOURCE,
};

View File

@ -1159,10 +1159,6 @@ config SOC_LP_TIMER_BIT_WIDTH_HI
int
default 16
config SOC_LP_TIMER_BOD_SHARE_INTR_SOURCE
bool
default y
config SOC_TIMER_GROUPS
int
default 2

View File

@ -464,7 +464,6 @@
/*-------------------------- LP_TIMER CAPS ----------------------------------*/
#define SOC_LP_TIMER_BIT_WIDTH_LO 32 // Bit width of lp_timer low part
#define SOC_LP_TIMER_BIT_WIDTH_HI 16 // Bit width of lp_timer high part
#define SOC_LP_TIMER_BOD_SHARE_INTR_SOURCE 1 //LP timer and brownout detector share the interrupt source
/*--------------------------- TIMER GROUP CAPS ---------------------------------------*/
#define SOC_TIMER_GROUPS (2)

View File

@ -0,0 +1,11 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "soc/power_supply_periph.h"
const power_supply_signal_conn_t power_supply_periph_signal = {
.irq = ETS_LP_RTC_TIMER_INTR_SOURCE,
};

View File

@ -447,10 +447,6 @@ config SOC_LP_TIMER_BIT_WIDTH_HI
int
default 16
config SOC_LP_TIMER_BOD_SHARE_INTR_SOURCE
bool
default y
config SOC_TIMER_GROUPS
int
default 2

View File

@ -429,7 +429,6 @@
/*-------------------------- LP_TIMER CAPS ----------------------------------*/
#define SOC_LP_TIMER_BIT_WIDTH_LO 32 // Bit width of lp_timer low part
#define SOC_LP_TIMER_BIT_WIDTH_HI 16 // Bit width of lp_timer high part
#define SOC_LP_TIMER_BOD_SHARE_INTR_SOURCE 1 //LP timer and brownout detector share the interrupt source
/*--------------------------- TIMER GROUP CAPS ---------------------------------------*/
#define SOC_TIMER_GROUPS (2)

View File

@ -0,0 +1,11 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "soc/power_supply_periph.h"
const power_supply_signal_conn_t power_supply_periph_signal = {
.irq = ETS_LP_RTC_TIMER_INTR_SOURCE,
};

View File

@ -0,0 +1,11 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "soc/power_supply_periph.h"
const power_supply_signal_conn_t power_supply_periph_signal = {
.irq = ETS_LP_ANAPERI_INTR_SOURCE,
};

View File

@ -0,0 +1,11 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "soc/power_supply_periph.h"
const power_supply_signal_conn_t power_supply_periph_signal = {
.irq = ETS_RTC_CORE_INTR_SOURCE,
};

View File

@ -0,0 +1,11 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "soc/power_supply_periph.h"
const power_supply_signal_conn_t power_supply_periph_signal = {
.irq = ETS_RTC_CORE_INTR_SOURCE,
};

View File

@ -0,0 +1,23 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include "soc/interrupts.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
const uint8_t irq;
} power_supply_signal_conn_t;
extern const power_supply_signal_conn_t power_supply_periph_signal;
#ifdef __cplusplus
}
#endif

View File

@ -16,7 +16,7 @@ menu "Main Flash configuration"
config SPI_FLASH_BROWNOUT_RESET
bool
default y
select ESP_SYSTEM_BROWNOUT_INTR
select ESP_BROWNOUT_USE_INTR
help
When brownout happens during flash erase/write operations,
send reset command to stop the flash operations to improve stability.

View File

@ -1,6 +1,6 @@
CPU 0 interrupt status:
Int Level Type Status
0 1 Level Used: LP_ANAPERI
0 1 Level Shared: LP_ANAPERI
1 1 Level Used: CPU_INT_FROM_CPU_0
2 1 Level Used: SYSTIMER_TARGET0
3 1 Level Used: TG0_WDT_LEVEL
@ -67,3 +67,4 @@ CPU 1 interrupt status:
30 * * Free
31 * * Free
Interrupts available for general use: 47
Shared interrupts: 1