• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Example in ESP32 Tuotial Module 2 Unit 1 : ESP32 Deep Sleep Mode

Q&A Forum › Category: ESP32 › Example in ESP32 Tuotial Module 2 Unit 1 : ESP32 Deep Sleep Mode
0 Vote Up Vote Down
woschneider asked 6 years ago

Hello Rui
Using the exact code from the example I wondered to did get this output:
…
Boot number: 2
wakeup_reason = 4
Wakeup caused by touchpad
Setup ESP32 to sleep for every 5 Seconds
…
Although the wakeup is really caused by the timer.
 
Trying a different case statement however works  fine:
switch (wakeup_reason)
{
case ESP_SLEEP_WAKEUP_EXT0 : Serial.println(“Wakeup caused by external signal using RTC_IO”); break;
case ESP_SLEEP_WAKEUP_EXT1 : Serial.println(“Wakeup caused by external signal using RTC_CNTL”); break;
case ESP_SLEEP_WAKEUP_TIMER : Serial.println(“Wakeup caused by timer”); break;
case ESP_SLEEP_WAKEUP_TOUCHPAD : Serial.println(“Wakeup caused by touchpad”); break;
case ESP_SLEEP_WAKEUP_ULP : Serial.println(“Wakeup caused by ULP program”); break;
default : Serial.printf(“Wakeup was not caused by deep sleep: %d\n”, wakeup_reason); break;
}
 
According to my findings the definition in
https://github.com/espressif/esp-idf/blob/master/components/esp32/include/esp_sleep.h
line 62  the enum statement gives ESP_SLEEP_WAKEUP_TIMER indeed the number 4
So the numbers of the cases in the example should be changed?
Best regards
Wolfgang
 

3 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 6 years ago

Hi.
I’ve tested the example with the latest release of ESP32 for Arduino IDE, and it is working fine.
I get “Wakeup caused by timer”
Are you using the latest table release or the latest development release? https://github.com/espressif/arduino-esp32
Regards,
Sara

0 Vote Up Vote Down
woschneider answered 6 years ago

Hello Sara
Thank you for your quick answer!
Please excuse my impertinent question: are you sure to use the latest update?
I found that with the latest update from Sep 21, 2018 there has really been a change in the file:
arduino-esp32/tools/sdk/include/esp32/esp_sleep.h
A new wakeup item has been added and with that update the timer wakeup got now number 4 (in former versions it’s been number 3)
I think other new users with a fresh installed environment will see the same effect as I did.
Perhaps you can check it.
Anyway – Thank you for your great job and all the material you did supply!!!
For you an Rui a happy & successful new year!
Best regards
Wolfgang
 
 
 
 
 

0 Vote Up Vote Down
Sara Santos Staff answered 6 years ago

Hi again.
I was not able to reproduce that error.
I get the right wake up reason with the latest installation.
I think that issue was already resolved. Take a look at the following links:

  • https://github.com/espressif/arduino-esp32/commit/a43682596fad48f18b87903807bb95e2b56750be#diff-8444ad22f7fba217637bf2f6b55496e4
  • https://github.com/espressif/arduino-esp32/pull/1911
  • https://github.com/espressif/arduino-esp32/blob/master/libraries/ESP32/examples/DeepSleep/TimerWakeUp/TimerWakeUp.ino

I hope this helps. Let me know if you have any other issues.
Thank you for supporting our work!
Regards,
Sara 🙂

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.