Part 1
요약·해설
500 ms button wake-up 출력과 serial monitor DTR/RTS 문제 해결을 설명합니다.
Memory · CPU · Peripheral kept
2 seconds
GPIO0 LOW
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
E6D039223408C4B53916F247FB97B944DB2B3575F2B2716817DE1BC0ABCFED53
.. _esp32-light-sleep-sample:
ESP32 Light Sleep demo
######################
Overview
********
This example illustrates usage of light sleep mode. Unlike deep sleep mode,
light sleep preserves the state of the memory, CPU, and peripherals. Execution
of code on both CPUs is stopped when esp_light_sleep_start() function is called.
When the chip exits light sleep mode, execution continues at the point where it
was stopped, and esp_light_sleep_start() function returns.
The example enables the following wakeup sources:
* ``Timer``: wake up the chip in 2 seconds.
* ``EXT0``: wake up the chip if a button attached to GPIO0 is pressed (i.e. if
GPIO0 goes low).
Requirements
************
This example can be used with any ESP32 development board. Most boards have a
button attached to GPIO0, often labelled BOOT. If the board does not have such
button, an external button can be connected, along with a 10k pull-up resistor,
and a 100nF capacitor to ground for debouncing.
Building, Flashing and Running
******************************
.. zephyr-app-commands::
:zephyr-app: samples/boards/esp32/light_sleep
:board: esp32_devkitc_wroom/esp32/procpu
:goals: build flash
:compact:
Sample Output
=================
ESP32 core output
-----------------
In the scenario below, the button attached to GPIO0 was pressed and held for
about 500 ms, after the second wakeup from light sleep. The program has
indicated the wakeup reason after each sleep iteration.
.. code-block:: console
*** Booting Zephyr OS build zephyr-v3.1.0-3667-gb42e2b225ecf ***
Entering light sleep
Returned from light sleep, reason: timer, t=3344 ms, slept for 2001 ms
Entering light sleep
Returned from light sleep, reason: timer, t=5354 ms, slept for 2000 ms
Entering light sleep
Returned from light sleep, reason: pin, t=5885 ms, slept for 521 ms
Waiting for GPIO0 to go high...
Entering light sleep
Returned from light sleep, reason: timer, t=8765 ms, slept for 2000 ms
Entering light sleep
Returned from light sleep, reason: timer, t=10776 ms, slept for 2001 ms
Entering light sleep
Troubleshooting
***************
If pressing the button attached to GPIO0 does not affect program behavior,
check DTR/RTS configuration in the serial monitor. This is not necessary for
IDF monitor, but for other tools it might be necessary to set DTR and RTS line
state to "disabled" or "de-asserted".
Part 3
한국어 전문 번역
개요
이 예제는 light sleep mode 사용법을 보여줍니다. Deep sleep과 달리 light sleep은 memory, CPU, peripheral의 상태를 보존합니다. esp_light_sleep_start()를 호출하면 두 CPU 모두 code 실행을 멈춥니다. Chip이 light sleep에서 빠져나오면 멈춘 지점부터 실행을 계속하며 esp_light_sleep_start()가 반환됩니다.
예제는 다음 wake-up source를 활성화합니다.
Timer: 2초 후 chip을 깨웁니다.EXT0: GPIO0에 연결된 button을 눌러 GPIO0가 LOW가 되면 chip을 깨웁니다.
요구사항
이 예제는 어떤 ESP32 development board에서도 사용할 수 있습니다. 대부분의 board에는 GPIO0에 연결되고 흔히 BOOT라고 표시된 button이 있습니다. 그런 button이 없다면 external button과 10 kΩ pull-up resistor를 연결하고, debouncing을 위해 100 nF capacitor를 ground에 연결할 수 있습니다.
Build, flash와 실행
west build -b esp32_devkitc_wroom/esp32/procpu samples/boards/esp32/light_sleep
west flash
Sample 출력
ESP32 core 출력
아래 scenario에서는 두 번째 timer wake-up 뒤 GPIO0 button을 약 500 ms 동안 누르고 있었습니다. Program은 sleep iteration이 끝날 때마다 wake-up reason을 표시합니다.
*** Booting Zephyr OS build zephyr-v3.1.0-3667-gb42e2b225ecf ***
Entering light sleep
Returned from light sleep, reason: timer, t=3344 ms, slept for 2001 ms
Entering light sleep
Returned from light sleep, reason: timer, t=5354 ms, slept for 2000 ms
Entering light sleep
Returned from light sleep, reason: pin, t=5885 ms, slept for 521 ms
Waiting for GPIO0 to go high...
Entering light sleep
Returned from light sleep, reason: timer, t=8765 ms, slept for 2000 ms
Entering light sleep
Returned from light sleep, reason: timer, t=10776 ms, slept for 2001 ms
Entering light sleep
Troubleshooting
GPIO0 button을 눌러도 program 동작이 바뀌지 않으면 serial monitor의 DTR/RTS configuration을 확인하십시오. IDF monitor에는 이 설정이 필요하지 않지만 다른 tool에서는 DTR·RTS line state를 disabled 또는 de-asserted로 설정해야 할 수 있습니다.
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.