mirror of
https://github.com/espressif/esp-idf.git
synced 2025-11-01 07:31:42 +01:00
Merge branch 'bugfix/external_rtc_start_fail_3.2' into 'release/v3.2'
Bugfix/external rtc start fail (backport 3.2) See merge request idf/esp-idf!4272
This commit is contained in:
@@ -786,6 +786,18 @@ config ESP32_RTC_CLK_CAL_CYCLES
|
||||
In case more value will help improve the definition of the launch of the crystal.
|
||||
If the crystal could not start, it will be switched to internal RC.
|
||||
|
||||
config ESP32_RTC_EXTERNAL_CRYSTAL_ADDITIONAL_CURRENT
|
||||
bool "Additional current for external 32kHz crystal"
|
||||
depends on ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL
|
||||
default "n"
|
||||
help
|
||||
Choose which additional current is used for rtc external crystal.
|
||||
|
||||
- "Enable current by touch" option provides touch pad9 current to
|
||||
external 32kHz crystal, at the expense of slightly higher (4-5uA) deep
|
||||
sleep current consumption. Note that enabled Touch or ULP wakeup
|
||||
source at sleep, this item is invalid even selected ESP32_RTC_EXTERNAL_CRYSTAL_ADDITIONAL_CURRENT.
|
||||
|
||||
config ESP32_RTC_XTAL_BOOTSTRAP_CYCLES
|
||||
int "Bootstrap cycles for external 32kHz crystal"
|
||||
depends on ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL
|
||||
|
||||
@@ -95,6 +95,7 @@ esp_err_t esp_sleep_disable_wakeup_source(esp_sleep_source_t source);
|
||||
* source is used.
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - ESP_ERR_NOT_SUPPORTED if additional current by touch (CONFIG_ESP32_RTC_EXTERNAL_CRYSTAL_ADDITIONAL_CURRENT) is enabled.
|
||||
* - ESP_ERR_INVALID_STATE if ULP co-processor is not enabled or if wakeup triggers conflict
|
||||
*/
|
||||
esp_err_t esp_sleep_enable_ulp_wakeup();
|
||||
@@ -121,6 +122,7 @@ esp_err_t esp_sleep_enable_timer_wakeup(uint64_t time_in_us);
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - ESP_ERR_NOT_SUPPORTED if additional current by touch (CONFIG_ESP32_RTC_EXTERNAL_CRYSTAL_ADDITIONAL_CURRENT) is enabled.
|
||||
* - ESP_ERR_INVALID_STATE if wakeup triggers conflict
|
||||
*/
|
||||
esp_err_t esp_sleep_enable_touchpad_wakeup();
|
||||
|
||||
@@ -401,6 +401,9 @@ esp_err_t esp_sleep_disable_wakeup_source(esp_sleep_source_t source)
|
||||
|
||||
esp_err_t esp_sleep_enable_ulp_wakeup()
|
||||
{
|
||||
#ifdef CONFIG_ESP32_RTC_EXTERNAL_CRYSTAL_ADDITIONAL_CURRENT
|
||||
return ESP_ERR_NOT_SUPPORTED;
|
||||
#endif
|
||||
#ifdef CONFIG_ULP_COPROC_ENABLED
|
||||
if(s_config.wakeup_triggers & RTC_EXT0_TRIG_EN) {
|
||||
ESP_LOGE(TAG, "Conflicting wake-up trigger: ext0");
|
||||
@@ -434,6 +437,9 @@ static void timer_wakeup_prepare()
|
||||
|
||||
esp_err_t esp_sleep_enable_touchpad_wakeup()
|
||||
{
|
||||
#ifdef CONFIG_ESP32_RTC_EXTERNAL_CRYSTAL_ADDITIONAL_CURRENT
|
||||
return ESP_ERR_NOT_SUPPORTED;
|
||||
#endif
|
||||
if (s_config.wakeup_triggers & (RTC_EXT0_TRIG_EN)) {
|
||||
ESP_LOGE(TAG, "Conflicting wake-up trigger: ext0");
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
@@ -693,6 +699,13 @@ static uint32_t get_power_down_flags()
|
||||
if (s_config.pd_options[ESP_PD_DOMAIN_XTAL] != ESP_PD_OPTION_ON) {
|
||||
pd_flags |= RTC_SLEEP_PD_XTAL;
|
||||
}
|
||||
|
||||
if ((s_config.wakeup_triggers & (RTC_TOUCH_TRIG_EN | RTC_ULP_TRIG_EN)) == 0) {
|
||||
// If enabled EXT1 only and enable the additional current by touch, should be keep RTC_PERIPH power on.
|
||||
#if ((defined CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL) && (defined CONFIG_ESP32_RTC_EXTERNAL_CRYSTAL_ADDITIONAL_CURRENT))
|
||||
pd_flags &= ~RTC_SLEEP_PD_RTC_PERIPH;
|
||||
#endif
|
||||
}
|
||||
return pd_flags;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user