samples/boards/esp32/deep_sleep/README.html · samples/boards/esp32/deep_sleep/README.rst 공식 원문 ↗

Zephyr 3.7.0 · Boards · ESP32

ESP32 Deep Sleep Demo

CPU·RAM·APB peripheral 전원을 끄고 20초 timer 또는 GPIO signal로 system을 깨웁니다.

Official pathsamples/boards/esp32/deep_sleep/README.html
Source filesamples/boards/esp32/deep_sleep/README.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

본문 기준: Zephyr 3.7.0 LTS3 · 이후 유지보수 패치는 별도입니다.

Part 1

요약·해설

Wake-up source별 hardware 조건, Kconfig와 GPIO2 console output을 설명합니다.

Always

RTC Timer · 20 s

External

EXT1 · GPIO2/4

Optional

GPIO wake-up

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 89141B3F010015F52F3199943F15D746A9AECA4C6B65B8BD56605DCDD24053E9
.. _esp32-deep-sleep-sample:

ESP32 Deep Sleep demo
#####################

Overview
********

The deep sleep mode of the ESP32 Series is a power saving mode that causes the
CPU, majority of RAM, and digital peripherals that are clocked from APB_CLK to
be powered off.

This sample shows how to set a wake up source, trigger deep sleep and then
make use of that pre-configured wake up source to bring the system back again.

The following wake up sources are demonstrated in this example:

1. ``Timer``: An RTC timer that can be programmed to trigger a wake up after
   a preset time. This example will trigger a wake up every 20 seconds.
2. ``EXT1``: External wake up 1 is tied to multiple RTC GPIOs. This example
   uses GPIO2 and GPIO4 to trigger a wake up with any one of the two pins are
   HIGH.
3. ``GPIO``: Only supported by some Espressif SoCs, in the case of ESP32-C3
   GPIOS0~5 can be used as wake-up sources.

In this demo, Timer is the only wake-up source that cannot be disabled via a
Kconfig option. The target SoC will always repeat the following: enable Timer
as wake-up source, deep sleep for 20 seconds, wake up.

Requirements
************

This example should be able to run on any commonly available
:ref:`esp32_devkitc_wroom` development board without any extra hardware if
only ``Timer`` is used as wakeup source.

However, when ``EXT1`` is also enabled, GPIO2 and GPIO4 should be pulled-down
by external resistors to avoid floating pins. When triggering a wake up, one
or both of the pins must be set to high. Note that floating pins may trigger
a wake up.

The same connection logic used on ``EXT1`` should be applied when ``GPIO`` is
enabled as wake-up source.

To enable or disable ``EXT1``, edit ``CONFIG_EXAMPLE_EXT1_WAKEUP`` on demo's
``prj.conf`` file. By default, this wake up source is enabled. Follow similar
steps to enable or disable ``GPIO`` by editing ``CONFIG_EXAMPLE_GPIO_WAKEUP``.

Building, Flashing and Running
******************************

.. zephyr-app-commands::
   :zephyr-app: samples/boards/esp32/deep_sleep
   :board: esp32_devkitc_wroom/esp32/procpu
   :goals: build flash
   :compact:

Sample Output
=================
ESP32 core output
-----------------

With both wake up sources enabled, the console output will be as below. The
reset reason message depends on the wake up source used. The console output
sample below is for GPIO2.

.. code-block:: console

   *** Booting Zephyr OS build zephyr-v3.1.0-3667-gb42e2b225ecf  ***

   Wake up from GPIO 2
   Enabling timer wakeup, 20s
   Enabling EXT1 wakeup on pins GPIO2, GPIO4
   Powering off

Part 3

한국어 전문 번역

개요

ESP32 Series의 deep sleep mode는 CPU와 RAM 대부분, 그리고 APB_CLK에서 clock을 받는 digital peripheral의 전원을 끄는 power-saving mode입니다.

이 sample은 wake-up source를 설정하고 deep sleep을 시작한 다음, 미리 설정한 wake-up source로 system을 다시 깨우는 방법을 보여줍니다.

이 예제에서는 다음 wake-up source를 시연합니다.

  1. Timer: 미리 정한 시간이 지나면 wake-up을 발생시키도록 program할 수 있는 RTC timer입니다. 이 예제는 20초마다 wake-up을 발생시킵니다.
  2. EXT1: External wake-up 1은 여러 RTC GPIO에 연결됩니다. 이 예제는 GPIO2와 GPIO4 가운데 어느 한 pin이라도 HIGH가 되면 wake-up하도록 설정합니다.
  3. GPIO: 일부 Espressif SoC에서만 지원합니다. ESP32-C3의 경우 GPIOS0~5를 wake-up source로 사용할 수 있습니다.

이 demo에서 Timer는 Kconfig option으로 비활성화할 수 없는 유일한 wake-up source입니다. 대상 SoC는 timer를 wake-up source로 활성화하고, 20초 동안 deep sleep에 들어갔다가 깨어나는 과정을 항상 반복합니다.

요구사항

Timer만 wake-up source로 사용한다면 별도 hardware 없이 일반적인 ESP32-DevKitC-WROOM development board에서 이 예제를 실행할 수 있습니다.

EXT1도 활성화한다면 floating pin을 방지하도록 GPIO2와 GPIO4를 external resistor로 pull-down해야 합니다. Wake-up을 발생시킬 때는 두 pin 가운데 하나 또는 둘 모두를 HIGH로 설정해야 합니다. Floating pin도 의도하지 않은 wake-up을 발생시킬 수 있습니다.

GPIO를 wake-up source로 활성화할 때도 EXT1과 같은 connection logic을 적용해야 합니다.

EXT1을 활성화하거나 비활성화하려면 demo의 prj.conf에서 CONFIG_EXAMPLE_EXT1_WAKEUP을 편집합니다. 기본값은 활성화입니다. GPIO도 같은 방식으로 CONFIG_EXAMPLE_GPIO_WAKEUP을 편집해 활성화하거나 비활성화합니다.

Build, flash와 실행

west build -b esp32_devkitc_wroom/esp32/procpu samples/boards/esp32/deep_sleep
west flash

Sample 출력

ESP32 core 출력

두 wake-up source가 모두 활성화되면 console에는 아래와 같이 출력됩니다. Reset reason message는 사용한 wake-up source에 따라 달라집니다. 아래 sample은 GPIO2로 wake-up한 경우입니다.

*** Booting Zephyr OS build zephyr-v3.1.0-3667-gb42e2b225ecf  ***

Wake up from GPIO 2
Enabling timer wakeup, 20s
Enabling EXT1 wakeup on pins GPIO2, GPIO4
Powering off

Source

출처

영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.