mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-17 23:28:15 +00:00
fix(uart): Fix mismatch wakeup rising edges required with the threshold configured
Closes https://github.com/espressif/esp-idf/issues/12586
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -28,7 +28,7 @@ extern "C" {
|
||||
// The timeout calibration factor when using ref_tick
|
||||
#define UART_LL_TOUT_REF_FACTOR_DEFAULT (8)
|
||||
|
||||
#define UART_LL_MIN_WAKEUP_THRESH (2)
|
||||
#define UART_LL_MIN_WAKEUP_THRESH (3)
|
||||
#define UART_LL_INTR_MASK (0x7ffff) //All interrupt mask
|
||||
|
||||
// Define UART interrupts
|
||||
@@ -597,7 +597,9 @@ FORCE_INLINE_ATTR void uart_ll_set_dtr_active_level(uart_dev_t *hw, int level)
|
||||
*/
|
||||
FORCE_INLINE_ATTR void uart_ll_set_wakeup_thrd(uart_dev_t *hw, uint32_t wakeup_thrd)
|
||||
{
|
||||
hw->sleep_conf.active_threshold = wakeup_thrd - UART_LL_MIN_WAKEUP_THRESH;
|
||||
// System would wakeup when the number of positive edges of RxD signal is larger than or equal to (UART_ACTIVE_THRESHOLD+2)
|
||||
// Note: On ESP32, the minimum UART wakeup threshold is 2 + 1 = 3 (UART_ACTIVE_THRESHOLD set to 0 leads to consecutive triggering wakeup)
|
||||
hw->sleep_conf.active_threshold = wakeup_thrd - (UART_LL_MIN_WAKEUP_THRESH - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -739,7 +741,7 @@ FORCE_INLINE_ATTR void uart_ll_get_at_cmd_char(uart_dev_t *hw, uint8_t *cmd_char
|
||||
*/
|
||||
FORCE_INLINE_ATTR uint32_t uart_ll_get_wakeup_thrd(uart_dev_t *hw)
|
||||
{
|
||||
return hw->sleep_conf.active_threshold + UART_LL_MIN_WAKEUP_THRESH;
|
||||
return hw->sleep_conf.active_threshold + (UART_LL_MIN_WAKEUP_THRESH - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user