docs(esp_pm): Adding notes on configuring GPIOs when using PD_TOP sleep

Closes https://github.com/espressif/esp-idf/issues/13143
This commit is contained in:
wuzhenghui
2024-02-19 11:33:35 +08:00
parent ae1cf0594c
commit 2e21a74d85
3 changed files with 16 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -367,8 +367,9 @@ esp_err_t gpio_get_drive_capability(gpio_num_t gpio_num, gpio_drive_cap_t *stren
* *
* When a GPIO is set to hold, its state is latched at that moment and will not change when the internal * When a GPIO is set to hold, its state is latched at that moment and will not change when the internal
* signal or the IO MUX/GPIO configuration is modified (including input enable, output enable, output value, * signal or the IO MUX/GPIO configuration is modified (including input enable, output enable, output value,
* function, and drive strength values). This function can be used to retain the state of GPIOs when the chip * function, and drive strength values). This function can be used to retain the state of GPIOs when the power
* or system is reset, for example, when watchdog time-out or Deep-sleep events are triggered. * domain of where GPIO/IOMUX belongs to becomes off. For example, chip or system is reset (e.g. watchdog
* time-out, deep-sleep events are triggered), or peripheral power-down in light-sleep.
* *
* This function works in both input and output modes, and only applicable to output-capable GPIOs. * This function works in both input and output modes, and only applicable to output-capable GPIOs.
* If this function is enabled: * If this function is enabled:
@@ -392,9 +393,9 @@ esp_err_t gpio_hold_en(gpio_num_t gpio_num);
/** /**
* @brief Disable gpio pad hold function. * @brief Disable gpio pad hold function.
* *
* When the chip is woken up from Deep-sleep, the gpio will be set to the default mode, so, the gpio will output * When the chip is woken up from peripheral power-down sleep, the gpio will be set to the default mode,
* the default level if this function is called. If you don't want the level changes, the gpio should be configured to * so, the gpio will output the default level if this function is called. If you don't want the level changes, the
* a known state before this function is called. * gpio should be configured to a known state before this function is called.
* e.g. * e.g.
* If you hold gpio18 high during Deep-sleep, after the chip is woken up and `gpio_hold_dis` is called, * If you hold gpio18 high during Deep-sleep, after the chip is woken up and `gpio_hold_dis` is called,
* gpio18 will output low level(because gpio18 is input mode by default). If you don't want this behavior, * gpio18 will output low level(because gpio18 is input mode by default). If you don't want this behavior,

View File

@@ -163,6 +163,10 @@ Light-sleep Peripheral Power Down
For peripherals that do not support Light-sleep context retention, if the Power management is enabled, the `ESP_PM_NO_LIGHT_SLEEP` lock should be held when the peripheral is working to avoid losing the working context of the peripheral when entering sleep. For peripherals that do not support Light-sleep context retention, if the Power management is enabled, the `ESP_PM_NO_LIGHT_SLEEP` lock should be held when the peripheral is working to avoid losing the working context of the peripheral when entering sleep.
.. note::
When the peripheral power domain is powered down during sleep, both the IO_MUX and GPIO modules are inactive, meaning the chip pins' state is not maintained by these modules. To preserve the state of an IO during sleep, it's essential to call :cpp:func:`gpio_hold_dis` and :cpp:func:`gpio_hold_en` before and after configuring the GPIO state. This action ensures that the IO configuration is latched and prevents the IO from becoming floating while in sleep mode.
API Reference API Reference
------------- -------------

View File

@@ -164,6 +164,11 @@ Light-sleep 外设下电
对于未支持 Light-sleep 上下文备份的外设,若启用了电源管理功能,应在外设工作时持有 `ESP_PM_NO_LIGHT_SLEEP` 锁以避免进入休眠导致外设工作上下文丢失。 对于未支持 Light-sleep 上下文备份的外设,若启用了电源管理功能,应在外设工作时持有 `ESP_PM_NO_LIGHT_SLEEP` 锁以避免进入休眠导致外设工作上下文丢失。
.. note::
当外设电源域在睡眠期间断电时IO_MUX 和 GPIO 模块都处于下电状态,这意味着芯片引脚的状态不会受这些模块控制。要在休眠期间保持 IO 的状态,需要在配置 GPIO 状态前后调用 :cpp:func:`gpio_hold_dis`:cpp:func:`gpio_hold_en`。此操作可确保 IO 配置被锁存,防止 IO 在睡眠期间浮空。
API 参考 API 参考
------------- -------------