diff --git a/components/esp_hw_support/sleep_modes.c b/components/esp_hw_support/sleep_modes.c index 71d873069f..935fdd4f91 100644 --- a/components/esp_hw_support/sleep_modes.c +++ b/components/esp_hw_support/sleep_modes.c @@ -1669,8 +1669,27 @@ esp_err_t esp_sleep_enable_timer_wakeup(uint64_t time_in_us) #if SOC_LP_VAD_SUPPORTED esp_err_t esp_sleep_enable_vad_wakeup(void) { + esp_err_t ret = ESP_FAIL; + + ret = esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "fail to keep rtc periph power on"); + return ret; + } + + ret = esp_sleep_pd_config(ESP_PD_DOMAIN_XTAL, ESP_PD_OPTION_ON); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "fail to keep xtal power on"); + return ret; + } + ret = esp_sleep_sub_mode_config(ESP_SLEEP_LP_USE_XTAL_MODE, true); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "fail to set to ESP_SLEEP_LP_USE_XTAL_MODE mode"); + return ret; + } s_config.wakeup_triggers |= RTC_LP_VAD_TRIG_EN; - return esp_sleep_sub_mode_config(ESP_SLEEP_LP_USE_XTAL_MODE, true); + + return ESP_OK; } #endif diff --git a/components/esp_hw_support/test_apps/vad_wakeup/README.md b/components/esp_hw_support/test_apps/vad_wakeup/README.md index f8ea707124..49827b24fa 100644 --- a/components/esp_hw_support/test_apps/vad_wakeup/README.md +++ b/components/esp_hw_support/test_apps/vad_wakeup/README.md @@ -1,3 +1,4 @@ | Supported Targets | ESP32-P4 | | ----------------- | -------- | +Slave side (LP I2S) should use default (UART0) console, as the USJ isn't working well under sleep modes. \ No newline at end of file diff --git a/components/esp_hw_support/test_apps/vad_wakeup/main/test_vad_wakeup.c b/components/esp_hw_support/test_apps/vad_wakeup/main/test_vad_wakeup.c index 2a245bfc6f..290d9b6638 100644 --- a/components/esp_hw_support/test_apps/vad_wakeup/main/test_vad_wakeup.c +++ b/components/esp_hw_support/test_apps/vad_wakeup/main/test_vad_wakeup.c @@ -98,8 +98,6 @@ static void s_hp_i2s_config(void) static void s_lp_vad_config(void) { ESP_ERROR_CHECK(esp_sleep_enable_vad_wakeup()); - ESP_ERROR_CHECK(esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON)); - ESP_ERROR_CHECK(esp_sleep_pd_config(ESP_PD_DOMAIN_XTAL, ESP_PD_OPTION_ON)); lp_i2s_chan_handle_t rx_handle = NULL; lp_i2s_chan_config_t config = {