mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/bod_reset_c6_h2_v5.1' into 'release/v5.1'
fix(bod): Reset brownout in configuration to avoid RF cannot be enabled again(backport v5.1) See merge request espressif/esp-idf!27723
This commit is contained in:
commit
1b78d57496
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -11,7 +11,7 @@
|
||||
#include "esp_private/system_internal.h"
|
||||
#include "esp_private/rtc_ctrl.h"
|
||||
#include "esp_private/spi_flash_os.h"
|
||||
#include "esp_rom_sys.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_cpu.h"
|
||||
#include "soc/soc.h"
|
||||
#include "soc/rtc_periph.h"
|
||||
@ -28,6 +28,8 @@
|
||||
#define BROWNOUT_DET_LVL 0
|
||||
#endif
|
||||
|
||||
static __attribute__((unused)) DRAM_ATTR const char *TAG = "BOD";
|
||||
|
||||
#if CONFIG_ESP_SYSTEM_BROWNOUT_INTR
|
||||
IRAM_ATTR static void rtc_brownout_isr_handler(void *arg)
|
||||
{
|
||||
@ -51,7 +53,7 @@ IRAM_ATTR static void rtc_brownout_isr_handler(void *arg)
|
||||
} else
|
||||
#endif // CONFIG_SPI_FLASH_BROWNOUT_RESET
|
||||
{
|
||||
esp_rom_printf("\r\nBrownout detector was triggered\r\n\r\n");
|
||||
ESP_DRAM_LOGI(TAG, "Brownout detector was triggered\r\n\r\n");
|
||||
}
|
||||
|
||||
esp_restart_noos();
|
||||
|
@ -15,6 +15,7 @@ void brownout_hal_config(const brownout_hal_config_t *cfg)
|
||||
brownout_ll_set_intr_wait_cycles(2);
|
||||
brownout_ll_enable_flash_power_down(cfg->flash_power_down);
|
||||
brownout_ll_enable_rf_power_down(cfg->rf_power_down);
|
||||
brownout_ll_clear_count();
|
||||
brownout_ll_reset_config(cfg->reset_enabled, 0x3ff, 1);
|
||||
brownout_ll_set_threshold(cfg->threshold);
|
||||
brownout_ll_bod_enable(cfg->enabled);
|
||||
|
@ -112,6 +112,15 @@ static inline void brownout_ll_intr_clear(void)
|
||||
RTCCNTL.int_clr.rtc_brown_out = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Clear BOD internal count.
|
||||
*/
|
||||
static inline void brownout_ll_clear_count(void)
|
||||
{
|
||||
// Not supported on esp32
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -115,6 +115,16 @@ static inline void brownout_ll_intr_clear(void)
|
||||
RTCCNTL.int_clr.rtc_brown_out = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Clear BOD internal count.
|
||||
*/
|
||||
static inline void brownout_ll_clear_count(void)
|
||||
{
|
||||
RTCCNTL.brown_out.cnt_clr = 1;
|
||||
RTCCNTL.brown_out.cnt_clr = 0;
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -115,6 +115,15 @@ static inline void brownout_ll_intr_clear(void)
|
||||
RTCCNTL.int_clr.rtc_brown_out = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Clear BOD internal count.
|
||||
*/
|
||||
static inline void brownout_ll_clear_count(void)
|
||||
{
|
||||
RTCCNTL.brown_out.cnt_clr = 1;
|
||||
RTCCNTL.brown_out.cnt_clr = 0;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -115,6 +115,15 @@ static inline void brownout_ll_intr_clear(void)
|
||||
LP_ANA_PERI.int_clr.bod_mode0 = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Clear BOD internal count.
|
||||
*/
|
||||
static inline void brownout_ll_clear_count(void)
|
||||
{
|
||||
LP_ANA_PERI.bod_mode0_cntl.bod_mode0_cnt_clr = 1;
|
||||
LP_ANA_PERI.bod_mode0_cntl.bod_mode0_cnt_clr = 0;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -115,6 +115,15 @@ static inline void brownout_ll_intr_clear(void)
|
||||
LP_ANA_PERI.int_clr.bod_mode0_int_clr = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Clear BOD internal count.
|
||||
*/
|
||||
static inline void brownout_ll_clear_count(void)
|
||||
{
|
||||
LP_ANA_PERI.bod_mode0_cntl.bod_mode0_cnt_clr = 1;
|
||||
LP_ANA_PERI.bod_mode0_cntl.bod_mode0_cnt_clr = 0;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -116,6 +116,16 @@ static inline void brownout_ll_intr_clear(void)
|
||||
RTCCNTL.int_clr.rtc_brown_out = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Clear BOD internal count.
|
||||
*/
|
||||
static inline void brownout_ll_clear_count(void)
|
||||
{
|
||||
RTCCNTL.brown_out.cnt_clr = 1;
|
||||
RTCCNTL.brown_out.cnt_clr = 0;
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -115,6 +115,15 @@ static inline void brownout_ll_intr_clear(void)
|
||||
RTCCNTL.int_clr.rtc_brown_out = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Clear BOD internal count.
|
||||
*/
|
||||
static inline void brownout_ll_clear_count(void)
|
||||
{
|
||||
RTCCNTL.brown_out.cnt_clr = 1;
|
||||
RTCCNTL.brown_out.cnt_clr = 0;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user