• 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

ESP32 deep sleep with External Wake Up

Q&A Forum › Category: Other › ESP32 deep sleep with External Wake Up
0 Vote Up Vote Down
John Remnant asked 5 years ago

Hi , I am working my way through the ESP32 course .
And in Module 3 Unit 4 I have enabled the ext1 external trigger to monitor pins 36 and 39 ( bit mask 0x 9000000000) . The interupts work and the ESP32 wakes up  when ever either of these two pins are toggled. BUT the print_GPIO_wake_up() function returns “GPIO that triggered the wake up: GPIO inf” and not the GPIO that caused the wake up. This may be because esp_sleep_get_ext1_wakeup_status() returns 0 and log (0) is inf. 
Do you know of a fix for this ?
In my project I want to know which pin woke the ESP32 up and act appropriately 
Thanks

Question Tags: ESP32 deep sleep
4 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 5 years ago

Hi John. That’s weird…
If you are using GPIOs 36 and 39, the esp_sleep_get_ext1_wakeup_status() shouldn’t return 0. At the documentation, it says that the esp_sleep_get_ext1_wakeup_status() can return one of the following two options:

  • Get the bit mask of GPIOs which caused wakeup (ext1)
  • If wakeup was caused by another source, this function will return 0. (http://esp-idf.readthedocs.io/en/latest/api-reference/system/sleep_modes.html)

So, it seems that the ESP considers that it is being woken up by another source or something. 
Did that happens only with those pins 36 and 39, or did you get the same result to another pins?
GPIOs 36 and 39 are connected to the internal VP and VN sensors. Can you try with another pins and see if you get the same result?
I hope this helps.

0 Vote Up Vote Down
John Remnant answered 5 years ago

Hi Sara, 
Thanks for the reply, I tried the Sketch again using other allowed GPIO pins and it works as expected for all except the 6 pins in the range 32-39. Looks like I will have to re-arrange my PCB and use these pins for other things. 

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

Hi John.
I don’t know why that happens. Maybe it is some property of those pins that I’m not aware of.
I know that pins 34 to 39 are input only, but that shouldn’t make any difference.
Thanks for testing and letting us know that.

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

I know this is a bit old, but the solution seems to be:
“int” must be replaced with “uint64_t” in the following line:

int GPIO_reason = esp_sleep_get_ext1_wakeup_status();

So, it should be:

uint64_t GPIO_reason = esp_sleep_get_ext1_wakeup_status();

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] SMART HOME with RPi, ESP32, and ESP8266 (version 1.2) March 8, 2023
  • [eBook Updated] ESP32-CAM Projects (version 1.3) January 7, 2023

You must be logged in to view this content.

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

Copyright © 2013-2023 · 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.