mirror of
https://github.com/espressif/esp-idf.git
synced 2026-04-27 19:13:21 +00:00
change(docs): add uart wakeup mode 0 1 2 3 description
This commit is contained in:
@@ -370,11 +370,39 @@ RTC peripherals or RTC memories do not need to be powered on during sleep in thi
|
||||
UART Wakeup (Light-sleep Only)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
When {IDF_TARGET_NAME} receives UART input from external devices, it is often necessary to wake up the chip when input data is available. The UART peripheral contains a feature which allows waking up the chip from Light-sleep when a certain number of positive edges on RX pin are seen. This number of positive edges can be set using :cpp:func:`uart_set_wakeup_threshold` function. Note that the character which triggers wakeup (and any characters before it) will not be received by the UART after wakeup. This means that the external device typically needs to send an extra character to the {IDF_TARGET_NAME} to trigger wakeup before sending the data.
|
||||
When {IDF_TARGET_NAME} receives UART input from external devices, it is often necessary to wake up the chip when input data is available. The UART peripheral supports multiple wakeup modes that can wake up the chip from Light-sleep. The wakeup mode and its parameters can be configured using :cpp:func:`uart_wakeup_setup` function.
|
||||
|
||||
The UART wakeup supports the following modes:
|
||||
|
||||
.. only:: SOC_UART_WAKEUP_SUPPORT_ACTIVE_THRESH_MODE
|
||||
|
||||
**Mode 0 (UART_WK_MODE_ACTIVE_THRESH) - Active Edge Threshold Wakeup**
|
||||
|
||||
When all clocks are powered down, the chip can be woken up by toggling the RXD pin for a certain number of cycles. The chip wakes up when the number of rising edges is greater than or equal to threshold value. The threshold value can be configured using the ``rx_edge_threshold`` field in :cpp:type:`uart_wakeup_cfg_t` structure.
|
||||
|
||||
.. only:: SOC_UART_WAKEUP_SUPPORT_FIFO_THRESH_MODE
|
||||
|
||||
**Mode 1 (UART_WK_MODE_FIFO_THRESH) - RX FIFO Threshold Wakeup**
|
||||
|
||||
Since the UART Core clock remains active, the UART RX can still receive data and store it in the RX FIFO. The chip can be woken up from Light-sleep when the number of bytes in the RX FIFO exceeds the configured threshold. The threshold value can be configured using the ``rx_fifo_threshold`` field in :cpp:type:`uart_wakeup_cfg_t` structure.
|
||||
|
||||
.. only:: SOC_UART_WAKEUP_SUPPORT_START_BIT_MODE
|
||||
|
||||
**Mode 2 (UART_WK_MODE_START_BIT) - Start Bit Detection Wakeup**
|
||||
|
||||
The chip wakes up when the UART RX detects a start bit.
|
||||
|
||||
.. only:: SOC_UART_WAKEUP_SUPPORT_CHAR_SEQ_MODE
|
||||
|
||||
**Mode 3 (UART_WK_MODE_CHAR_SEQ) - Character Sequence Detection Wakeup**
|
||||
|
||||
The chip wakes up when the UART RX receives a specific character sequence. The character sequence can be configured using the ``wake_chars_seq`` field in :cpp:type:`uart_wakeup_cfg_t` structure. The character sequence supports wildcard matching using '*' to represent any symbol.
|
||||
|
||||
:cpp:func:`esp_sleep_enable_uart_wakeup` function can be used to enable this wakeup source.
|
||||
|
||||
After waking-up from UART, you should send some extra data through the UART port in Active mode, so that the internal wakeup indication signal can be cleared. Otherwises, the next UART wake-up would trigger with two less rising edges than the configured threshold value.
|
||||
.. only:: SOC_UART_WAKEUP_SUPPORT_ACTIVE_THRESH_MODE
|
||||
|
||||
After waking-up from UART wakeup mode 0, you should send some extra data through the UART port or reset the UART module in Active mode, otherwise, the next UART wake-up would trigger with two less rising edges than the configured threshold value.
|
||||
|
||||
.. only:: SOC_PM_SUPPORT_TOP_PD
|
||||
|
||||
@@ -382,6 +410,22 @@ After waking-up from UART, you should send some extra data through the UART port
|
||||
|
||||
In Light-sleep mode, setting Kconfig option :ref:`CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP` will invalidate UART wakeup.
|
||||
|
||||
.. only:: SOC_ULP_LP_UART_SUPPORTED
|
||||
|
||||
LP_UART can wake up the ULP LP core coprocessor. LP_UART supports the same wakeup modes as the HP UART described above, including active edge threshold wakeup, RX FIFO threshold wakeup, start bit detection wakeup, and character sequence detection wakeup.
|
||||
|
||||
To use LP_UART to wake up the ULP LP core, follow these steps:
|
||||
|
||||
#. Set the :c:macro:`ULP_LP_CORE_WAKEUP_SOURCE_LP_UART` flag in the ``wakeup_source`` field of the :cpp:type:`ulp_lp_core_cfg_t` structure.
|
||||
#. Initialize the LP UART (call :cpp:func:`lp_core_uart_init`).
|
||||
#. Configure the LP_UART wakeup mode using the :cpp:func:`lp_core_uart_wakeup_setup` function with a :cpp:type:`uart_wakeup_cfg_t` structure, using the same configuration method as HP UART.
|
||||
|
||||
.. note::
|
||||
|
||||
Once the LP core wakes up due to LP_UART, you must call :cpp:func:`ulp_lp_core_lp_uart_reset_wakeup_en` or reset the LP UART module to clear the wakeup signal before the LP core goes to sleep, otherwise, it will be repeated wakeup.
|
||||
|
||||
For example code on LP_UART wakeup, refer to :example:`system/ulp/lp_core/lp_uart/lp_uart_char_seq_wakeup`.
|
||||
|
||||
.. _disable_sleep_wakeup_source:
|
||||
|
||||
Disable Sleep Wakeup Source
|
||||
|
||||
@@ -370,11 +370,39 @@ RTC 控制器中内嵌定时器,可用于在预定义的时间到达后唤醒
|
||||
UART 唤醒(仅适用于 Light-sleep 模式)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
当 {IDF_TARGET_NAME} 从外部设备接收 UART 输入时,通常需要在输入数据可用时唤醒芯片。UART 外设支持在 RX 管脚上观测到一定数量的上升沿时,将芯片从 Light-sleep 模式中唤醒。调用 :cpp:func:`uart_set_wakeup_threshold` 函数可设置被观测上升沿的数量。请注意,触发唤醒的字符(及该字符前的所有字符)在唤醒后不会被 UART 接收,因此在发送数据之前,外部设备通常需要首先向 {IDF_TARGET_NAME} 额外发送一个字符以触发唤醒。
|
||||
当 {IDF_TARGET_NAME} 从外部设备接收 UART 输入时,通常需要在输入数据可用时唤醒芯片。UART 外设支持多种唤醒模式,可以将芯片从 Light-sleep 模式中唤醒。唤醒模式及其参数可以通过调用 :cpp:func:`uart_wakeup_setup` 函数进行配置。
|
||||
|
||||
UART 唤醒支持以下模式:
|
||||
|
||||
.. only:: SOC_UART_WAKEUP_SUPPORT_ACTIVE_THRESH_MODE
|
||||
|
||||
**模式 0 (UART_WK_MODE_ACTIVE_THRESH) - 边沿阈值唤醒**
|
||||
|
||||
当所有时钟都关闭时,此时可以通过使 RXD 翻转若干周期,当上升沿个数大于等于设定阈值时唤醒芯片。阈值可以通过 :cpp:type:`uart_wakeup_cfg_t` 结构体中的 ``rx_edge_threshold`` 字段进行配置。
|
||||
|
||||
.. only:: SOC_UART_WAKEUP_SUPPORT_FIFO_THRESH_MODE
|
||||
|
||||
**模式 1 (UART_WK_MODE_FIFO_THRESH) - RX FIFO 阈值唤醒**
|
||||
|
||||
由于 UART Core 时钟保持工作,因此 UART RX 仍然可以接收数据并将数据暂存在 Rx FIFO 中。当 Rx FIFO 中的数据量超过配置的阈值时,可以将芯片从 Light-sleep 中唤醒。阈值可以通过 :cpp:type:`uart_wakeup_cfg_t` 结构体中的 ``rx_fifo_threshold`` 字段进行配置。
|
||||
|
||||
.. only:: SOC_UART_WAKEUP_SUPPORT_START_BIT_MODE
|
||||
|
||||
**模式 2 (UART_WK_MODE_START_BIT) - 起始位检测唤醒**
|
||||
|
||||
当 UART RX 监测到起始位后,唤醒芯片。
|
||||
|
||||
.. only:: SOC_UART_WAKEUP_SUPPORT_CHAR_SEQ_MODE
|
||||
|
||||
**模式 3 (UART_WK_MODE_CHAR_SEQ) - 字符序列检测唤醒**
|
||||
|
||||
当 UART RX 接收到特定字符序列后,唤醒芯片。字符序列可以通过 :cpp:type:`uart_wakeup_cfg_t` 结构体中的 ``wake_chars_seq`` 字段进行配置。字符序列支持使用 '*' 作为通配符来匹配任意字符。
|
||||
|
||||
可调用 :cpp:func:`esp_sleep_enable_uart_wakeup` 函数来启用此唤醒源。
|
||||
|
||||
使用 UART 唤醒之后,在芯片 Active 模式下需要让 UART 接受一些数据用来清零内部的唤醒指示信号。不然的话,下一次 UART 唤醒的触发将只需要比配置的阈值少两个上升沿的数量。
|
||||
.. only:: SOC_UART_WAKEUP_SUPPORT_ACTIVE_THRESH_MODE
|
||||
|
||||
使用 UART 唤醒模式 0 之后,需要通过在 Active 模式下向 UART 传输数据或是复位整个 UART 模块,否则下一次唤醒所需的上升沿个数将减少。
|
||||
|
||||
.. only:: SOC_PM_SUPPORT_TOP_PD
|
||||
|
||||
@@ -382,6 +410,22 @@ UART 唤醒(仅适用于 Light-sleep 模式)
|
||||
|
||||
在 Light-sleep 模式下,设置 Kconfig 选项 :ref:`CONFIG_PM_POWER_DOWN_PERIPHERAL_IN_LIGHT_SLEEP` 将使 UART 唤醒失效。
|
||||
|
||||
.. only:: SOC_ULP_LP_UART_SUPPORTED
|
||||
|
||||
LP_UART 可以将 ULP LP 内核协处理器唤醒。LP_UART 支持的唤醒模式与上述 HP UART 唤醒模式相同,包括边沿阈值唤醒、RX FIFO 阈值唤醒、起始位检测唤醒和字符序列检测唤醒。
|
||||
|
||||
要使用 LP_UART 唤醒 ULP LP 内核,需要执行以下步骤:
|
||||
|
||||
#. 在 :cpp:type:`ulp_lp_core_cfg_t` 结构体的 ``wakeup_source`` 字段中设置 :c:macro:`ULP_LP_CORE_WAKEUP_SOURCE_LP_UART` 标志位。
|
||||
#. 初始化 LP UART(调用 :cpp:func:`lp_core_uart_init`)。
|
||||
#. 使用 :cpp:func:`lp_core_uart_wakeup_setup` 函数配置 LP_UART 的唤醒模式,参数使用 :cpp:type:`uart_wakeup_cfg_t` 结构体,配置方式与 HP UART 相同。
|
||||
|
||||
.. note::
|
||||
|
||||
当 LP 核因 LP_UART 唤醒后,必须在 LP 核进入睡眠前调用 :cpp:func:`ulp_lp_core_lp_uart_reset_wakeup_en` 函数或是复位整个 LP UART 模块以清除唤醒信号,否则会被重复唤醒。
|
||||
|
||||
有关 LP_UART 唤醒的示例代码,请参考 :example:`system/ulp/lp_core/lp_uart/lp_uart_char_seq_wakeup`。
|
||||
|
||||
.. _disable_sleep_wakeup_source:
|
||||
|
||||
禁用睡眠模式唤醒源
|
||||
|
||||
Reference in New Issue
Block a user