Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(deep-sleep-stub.rst): Added documentation about re-entering deep sleep from wake stub (IDFGH-12569) #13571

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/en/api-guides/deep-sleep-stub.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,14 @@ CRC Check For Wake Stubs

When the `CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP` option is enabled, all the RTC fast memory except the wake stubs area is added to the heap.

Going back to deep-sleep
------------------------

Before going back to deep-sleep you must set a wake up source. This can be a timer, GPIO pin or the ULP. This has to be set using `REG_SET_FIELD(RTC_CNTL_WAKEUP_STATE_REG, RTC_CNTL_WAKEUP_ENA, WAKEUP_MASK)`, where `WAKEUP_MASK` is a byte containing true on all enabled wakeup reasons. These reasons are defined in: https://github.com/espressif/esp-idf/blob/master/components/esp_rom/include/esp32/rom/rtc.h.

.. note:: When using ULP wakeup, it is probably best to leave the wakeup state and just start the RTC timer using `REG_SET_FIELD(RTC_CNTL_STATE0_REG, RTC_CNTL_ULP_CP_SLP_TIMER_EN, 1)`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REG_SET_FIELD(RTC_CNTL_STATE0_REG, RTC_CNTL_ULP_CP_SLP_TIMER_EN, 1) is for enabling the timer wake-up source for the ULP coprocessor, which is independent of the deep-sleep-stub
feature is not a universal usage method, I think it is not necessary to explain it.


After a wakeup source has been set, you must set the wake stub program as entrypoint for the next wake using `esp_wake_stub_sleep('pointer to you wakestub function')`. This function will also put the ESP32 back into deep sleep.

Example
-------
Expand Down