diff --git a/components/esp_driver_uart/src/uart.c b/components/esp_driver_uart/src/uart.c index 72fcb5c50c..cb023f2f20 100644 --- a/components/esp_driver_uart/src/uart.c +++ b/components/esp_driver_uart/src/uart.c @@ -2275,9 +2275,6 @@ esp_err_t uart_set_wakeup_threshold(uart_port_t uart_num, int wakeup_threshold) "wakeup_threshold out of bounds"); UART_ENTER_CRITICAL(&(uart_context[uart_num].spinlock)); uart_hal_set_wakeup_edge_thrd(&(uart_context[uart_num].hal), wakeup_threshold); - PERIPH_RCC_ATOMIC() { - uart_ll_enable_pad_sleep_clock(uart_context[uart_num].hal.dev, true); - } UART_EXIT_CRITICAL(&(uart_context[uart_num].spinlock)); return ESP_OK; } diff --git a/components/esp_driver_uart/src/uart_wakeup.c b/components/esp_driver_uart/src/uart_wakeup.c index c4afcb07b4..01039b1cdd 100644 --- a/components/esp_driver_uart/src/uart_wakeup.c +++ b/components/esp_driver_uart/src/uart_wakeup.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2024-2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -15,6 +15,7 @@ #include "driver/uart_wakeup.h" #include "hal/uart_hal.h" #include "esp_private/esp_sleep_internal.h" +#include "esp_private/periph_ctrl.h" #include "esp_log.h" #if (SOC_UART_LP_NUM >= 1) @@ -71,7 +72,9 @@ esp_err_t uart_wakeup_setup(uart_port_t uart_num, const uart_wakeup_cfg_t *cfg) // This should be mocked at ll level if the selection of the UART wakeup mode is not supported by this SOC. uart_ll_set_wakeup_mode(hw, cfg->wakeup_mode); - + PERIPH_RCC_ATOMIC() { + uart_ll_enable_pad_sleep_clock(hw, true); + } // When uarts are utilized, the src clk(hp_uart: main XTAL, lp_uart: RTC_FAST or XTAL_D2) need to be PU and ungate,and for hp uart UARTx & IOMX ICG need to be ungate if (cfg->wakeup_mode != UART_WK_MODE_ACTIVE_THRESH) { if (uart_num < SOC_UART_HP_NUM) {