forked from espressif/esp-idf
change(pm/deepsleep): remove disable rtcio before hold it when ext1 wakeup
This commit is contained in:
@@ -1416,6 +1416,12 @@ static void ext1_wakeup_prepare(void)
|
|||||||
rtcio_hal_function_select(rtc_pin, RTCIO_FUNC_RTC);
|
rtcio_hal_function_select(rtc_pin, RTCIO_FUNC_RTC);
|
||||||
// set input enable in sleep mode
|
// set input enable in sleep mode
|
||||||
rtcio_hal_input_enable(rtc_pin);
|
rtcio_hal_input_enable(rtc_pin);
|
||||||
|
#if SOC_PM_SUPPORT_RTC_PERIPH_PD
|
||||||
|
// Pad configuration depends on RTC_PERIPH state in sleep mode
|
||||||
|
if (s_config.domain[ESP_PD_DOMAIN_RTC_PERIPH].pd_option != ESP_PD_OPTION_ON) {
|
||||||
|
rtcio_hal_hold_enable(rtc_pin);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
/* ESP32H2 use hp iomux to config rtcio, and there is no complete
|
/* ESP32H2 use hp iomux to config rtcio, and there is no complete
|
||||||
* rtcio functionality. In the case of EXT1 wakeup, rtcio only provides
|
* rtcio functionality. In the case of EXT1 wakeup, rtcio only provides
|
||||||
@@ -1427,19 +1433,6 @@ static void ext1_wakeup_prepare(void)
|
|||||||
gpio_ll_input_enable(&GPIO, gpio);
|
gpio_ll_input_enable(&GPIO, gpio);
|
||||||
// hold rtc_pin to use it during sleep state
|
// hold rtc_pin to use it during sleep state
|
||||||
rtcio_hal_hold_enable(rtc_pin);
|
rtcio_hal_hold_enable(rtc_pin);
|
||||||
#endif
|
|
||||||
#if SOC_PM_SUPPORT_RTC_PERIPH_PD
|
|
||||||
// Pad configuration depends on RTC_PERIPH state in sleep mode
|
|
||||||
if (s_config.domain[ESP_PD_DOMAIN_RTC_PERIPH].pd_option != ESP_PD_OPTION_ON) {
|
|
||||||
#if SOC_RTCIO_INPUT_OUTPUT_SUPPORTED
|
|
||||||
// RTC_PERIPH will be powered down, so RTC_IO_ registers will
|
|
||||||
// loose their state. Lock pad configuration.
|
|
||||||
// Pullups/pulldowns also need to be disabled.
|
|
||||||
rtcio_hal_pullup_disable(rtc_pin);
|
|
||||||
rtcio_hal_pulldown_disable(rtc_pin);
|
|
||||||
#endif
|
|
||||||
rtcio_hal_hold_enable(rtc_pin);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
// Keep track of pins which are processed to bail out early
|
// Keep track of pins which are processed to bail out early
|
||||||
rtc_gpio_mask &= ~BIT(rtc_pin);
|
rtc_gpio_mask &= ~BIT(rtc_pin);
|
||||||
|
@@ -244,9 +244,10 @@ menu "Example Configuration"
|
|||||||
When using EXT1 wakeup source without external pull-up/downs, you may want to make use of
|
When using EXT1 wakeup source without external pull-up/downs, you may want to make use of
|
||||||
the internal ones.
|
the internal ones.
|
||||||
|
|
||||||
However, the RTC IO reside in the RTC Periph power domain. Enable this option to force that
|
if we turn off the RTC_PERIPH domain or if certain chips lack the RTC_PERIPH domain,
|
||||||
power domain ON during deep sleep. Note that this will increase some power comsumption, so
|
we will use the HOLD feature to maintain the pull-up and pull-down on the pins during sleep.
|
||||||
it's still suggested to use external ones instead.
|
but if we turn on the RTC_PERIPH domain, we don not need to use HOLD feature and this will
|
||||||
|
increase some power comsumption.
|
||||||
|
|
||||||
EXT0 wakeup source resides in the same power domain as RTCIO (RTC Periph), so internal
|
EXT0 wakeup source resides in the same power domain as RTCIO (RTC Periph), so internal
|
||||||
pull-up/downs are always available. There's no need to explicitly force it on for EXT0.
|
pull-up/downs are always available. There's no need to explicitly force it on for EXT0.
|
||||||
|
@@ -49,19 +49,33 @@ void example_deep_sleep_register_ext1_wakeup(void)
|
|||||||
|
|
||||||
/* If there are no external pull-up/downs, tie wakeup pins to inactive level with internal pull-up/downs via RTC IO
|
/* If there are no external pull-up/downs, tie wakeup pins to inactive level with internal pull-up/downs via RTC IO
|
||||||
* during deepsleep. However, RTC IO relies on the RTC_PERIPH power domain. Keeping this power domain on will
|
* during deepsleep. However, RTC IO relies on the RTC_PERIPH power domain. Keeping this power domain on will
|
||||||
* increase some power comsumption. */
|
* increase some power comsumption. However, if we turn off the RTC_PERIPH domain or if certain chips lack the RTC_PERIPH
|
||||||
|
* domain, we will use the HOLD feature to maintain the pull-up and pull-down on the pins during sleep.*/
|
||||||
#if CONFIG_EXAMPLE_EXT1_USE_INTERNAL_PULLUPS
|
#if CONFIG_EXAMPLE_EXT1_USE_INTERNAL_PULLUPS
|
||||||
#if !CONFIG_IDF_TARGET_ESP32H2
|
#if SOC_RTCIO_INPUT_OUTPUT_SUPPORTED
|
||||||
ESP_ERROR_CHECK(esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON));
|
if (ext_wakeup_mode) {
|
||||||
ESP_ERROR_CHECK(rtc_gpio_pullup_dis(ext_wakeup_pin_1));
|
ESP_ERROR_CHECK(rtc_gpio_pullup_dis(ext_wakeup_pin_1));
|
||||||
ESP_ERROR_CHECK(rtc_gpio_pulldown_en(ext_wakeup_pin_1));
|
ESP_ERROR_CHECK(rtc_gpio_pulldown_en(ext_wakeup_pin_1));
|
||||||
ESP_ERROR_CHECK(rtc_gpio_pullup_dis(ext_wakeup_pin_2));
|
ESP_ERROR_CHECK(rtc_gpio_pullup_dis(ext_wakeup_pin_2));
|
||||||
ESP_ERROR_CHECK(rtc_gpio_pulldown_en(ext_wakeup_pin_2));
|
ESP_ERROR_CHECK(rtc_gpio_pulldown_en(ext_wakeup_pin_2));
|
||||||
|
} else {
|
||||||
|
ESP_ERROR_CHECK(rtc_gpio_pulldown_dis(ext_wakeup_pin_1));
|
||||||
|
ESP_ERROR_CHECK(rtc_gpio_pullup_en(ext_wakeup_pin_1));
|
||||||
|
ESP_ERROR_CHECK(rtc_gpio_pulldown_dis(ext_wakeup_pin_2));
|
||||||
|
ESP_ERROR_CHECK(rtc_gpio_pullup_en(ext_wakeup_pin_2));
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
gpio_pullup_dis(ext_wakeup_pin_1);
|
if (ext_wakeup_mode) {
|
||||||
gpio_pulldown_en(ext_wakeup_pin_1);
|
ESP_ERROR_CHECK(gpio_pullup_dis(ext_wakeup_pin_1));
|
||||||
gpio_pullup_dis(ext_wakeup_pin_2);
|
ESP_ERROR_CHECK(gpio_pulldown_en(ext_wakeup_pin_1));
|
||||||
gpio_pulldown_en(ext_wakeup_pin_2);
|
ESP_ERROR_CHECK(gpio_pullup_dis(ext_wakeup_pin_2));
|
||||||
|
ESP_ERROR_CHECK(gpio_pulldown_en(ext_wakeup_pin_2));
|
||||||
|
} else {
|
||||||
|
ESP_ERROR_CHECK(gpio_pulldown_dis(ext_wakeup_pin_1));
|
||||||
|
ESP_ERROR_CHECK(gpio_pullup_en(ext_wakeup_pin_1));
|
||||||
|
ESP_ERROR_CHECK(gpio_pulldown_dis(ext_wakeup_pin_2));
|
||||||
|
ESP_ERROR_CHECK(gpio_pullup_en(ext_wakeup_pin_2));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif //CONFIG_EXAMPLE_EXT1_USE_INTERNAL_PULLUPS
|
#endif //CONFIG_EXAMPLE_EXT1_USE_INTERNAL_PULLUPS
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user