mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/close_rf_in_deep_sleep_backport_v4.2' into 'release/v4.2'
deep sleep: further optimize sleep current if RF is enabled (backport v4.2) See merge request espressif/esp-idf!22735
This commit is contained in:
commit
8e8ef2b469
@ -153,6 +153,12 @@ esp_err_t esp_phy_store_cal_data_to_nvs(const esp_phy_calibration_data_t* cal_da
|
||||
*/
|
||||
esp_err_t esp_phy_erase_cal_data_in_nvs(void);
|
||||
|
||||
/**
|
||||
* @brief Get phy initialize status
|
||||
* @return return true if phy is already initialized.
|
||||
*/
|
||||
bool esp_phy_is_initialized(void);
|
||||
|
||||
/**
|
||||
* @brief Enable PHY and RF module
|
||||
*
|
||||
|
@ -210,6 +210,11 @@ static inline void phy_digital_regs_load(void)
|
||||
}
|
||||
}
|
||||
|
||||
bool esp_phy_is_initialized(void)
|
||||
{
|
||||
return s_is_phy_calibrated;
|
||||
}
|
||||
|
||||
void esp_phy_enable(void)
|
||||
{
|
||||
_lock_acquire(&s_phy_access_lock);
|
||||
|
@ -190,7 +190,6 @@ void rtc_sleep_init(rtc_sleep_config_t cfg)
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_ANA_CONF_REG,
|
||||
RTC_CNTL_CKGEN_I2C_PU | RTC_CNTL_PLL_I2C_PU |
|
||||
RTC_CNTL_RFRX_PBUS_PU | RTC_CNTL_TXRF_I2C_PU);
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_OPTIONS0_REG, RTC_CNTL_BB_I2C_FORCE_PU);
|
||||
} else {
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_DG_WRAP_PD_EN);
|
||||
REG_SET_FIELD(RTC_CNTL_BIAS_CONF_REG, RTC_CNTL_DBG_ATTEN, 0);
|
||||
@ -212,6 +211,12 @@ void rtc_sleep_init(rtc_sleep_config_t cfg)
|
||||
REG_SET_FIELD(RTC_CNTL_REG, RTC_CNTL_DBIAS_WAK, cfg.rtc_dbias_wak);
|
||||
REG_SET_FIELD(RTC_CNTL_REG, RTC_CNTL_DIG_DBIAS_WAK, cfg.dig_dbias_wak);
|
||||
REG_SET_FIELD(RTC_CNTL_REG, RTC_CNTL_DIG_DBIAS_SLP, cfg.dig_dbias_slp);
|
||||
|
||||
extern bool esp_phy_is_initialized(void);
|
||||
if (esp_phy_is_initialized()){
|
||||
extern void phy_close_rf(void);
|
||||
phy_close_rf();
|
||||
}
|
||||
}
|
||||
|
||||
void rtc_sleep_set_wakeup_time(uint64_t t)
|
||||
|
@ -108,7 +108,12 @@ void rtc_sleep_init(rtc_sleep_config_t cfg)
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_ANA_CONF_REG,
|
||||
RTC_CNTL_CKGEN_I2C_PU | RTC_CNTL_PLL_I2C_PU |
|
||||
RTC_CNTL_RFRX_PBUS_PU | RTC_CNTL_TXRF_I2C_PU);
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_OPTIONS0_REG, RTC_CNTL_BB_I2C_FORCE_PU);
|
||||
|
||||
extern bool esp_phy_is_initialized(void);
|
||||
if (esp_phy_is_initialized()){
|
||||
extern void phy_close_rf(void);
|
||||
phy_close_rf();
|
||||
}
|
||||
} else {
|
||||
SET_PERI_REG_MASK(RTC_CNTL_REG, RTC_CNTL_REGULATOR_FORCE_PU);
|
||||
CLEAR_PERI_REG_MASK(RTC_CNTL_DIG_PWC_REG, RTC_CNTL_DG_WRAP_PD_EN);
|
||||
|
@ -19,7 +19,7 @@ Once wakeup sources are configured, application can enter sleep mode using :cpp:
|
||||
WiFi/BT and sleep modes
|
||||
-----------------------
|
||||
|
||||
In deep sleep and light sleep modes, wireless peripherals are powered down. Before entering deep sleep or light sleep modes, applications must disable WiFi and BT using appropriate calls (:cpp:func:`esp_bluedroid_disable`, :cpp:func:`esp_bt_controller_disable`, :cpp:func:`esp_wifi_stop`). WiFi and BT connections will not be maintained in deep sleep or light sleep, even if these functions are not called.
|
||||
In deep sleep and light sleep modes, wireless peripherals are powered down. Before entering light sleep modes, applications must disable WiFi and BT using appropriate calls (:cpp:func:`esp_bluedroid_disable`, :cpp:func:`esp_bt_controller_disable`, :cpp:func:`esp_wifi_stop`). WiFi and BT connections will not be maintained in deep sleep or light sleep, even if these functions are not called.
|
||||
|
||||
If WiFi connection needs to be maintained, enable WiFi modem sleep, and enable automatic light sleep feature (see :doc:`Power Management APIs <power_management>`). This will allow the system to wake up from sleep automatically when required by WiFi driver, thereby maintaining connection to the AP.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user