Hi, I am just wondering does anyone know if there is a technical reason why it may NOT be possible to have both a timer interrupt AND an external interrupt setup at the same time on the ESP32. If I know this is not supposed to work, I can stop trying to fix..
I have successfully got both to work on their own, but not together and wondering if it is supported. Using Arduino environment with relevant included code snippets.
Works: (timer interrupt, wakes up after 1 hour).
esp_sleep_enable_timer_wakeup(3600000000);
esp_deep_sleep_start();
Works: (External interrupt when gpio33 goes high).
esp_sleep_enable_ext0_wakeup(GPIO_NUM_33,1);
esp_deep_sleep_start();
Not working: (timer and external interrup).
esp_sleep_enable_timer_wakeup(3600000000);
esp_sleep_enable_ext0_wakeup(GPIO_NUM_33,1);
esp_deep_sleep_start();
The use case I have in mind is as follows:
Wake-up once per day and send heartbeat signal (use timer interrupt for this).
Then go into deep sleep mode, with a PIR sensor primed (I.E gpio33 listening for external interrupt when movement detected).
So you can see how using the 2 types of wake-up are required.
But currently as soon as the esp_deep_sleep_start() is run, the device resets.
Good to know if its possible, and has anyone setup such a use case.
Thanks,
Rory
Using timer AND external interrupt to wake up from deep sleep mode.
-
rory_gleeson
- Posts: 1
- Joined: Sat Mar 03, 2018 9:55 pm
-
selim_bayhan
- Posts: 5
- Joined: Sun Apr 15, 2018 7:48 am
Re: Using timer AND external interrupt to wake up from deep sleep mode.
I have the same case. This you find a solution.?
Re: Using timer AND external interrupt to wake up from deep sleep mode.
How exactly it does not work ?Not working: (timer and external interrup).
esp_sleep_enable_timer_wakeup(3600000000);
esp_sleep_enable_ext0_wakeup(GPIO_NUM_33,1);
esp_deep_sleep_start();
I'm using it all the time, also mixed with ext1 wake up and wake stub and it works as expected.
I'm not using Arduino, maybe it is an Arduino problem.
-
selim_bayhan
- Posts: 5
- Joined: Sun Apr 15, 2018 7:48 am
Re: Using timer AND external interrupt to wake up from deep sleep mode.
Hi,
Thank you very much. I am using Mongoose OS. I found the solution. I made a little mistake in my code.I fix it. But now I have a different problem . I posted this problem in the following post.
viewtopic.php?f=2&t=5493
Thank you very much. I am using Mongoose OS. I found the solution. I made a little mistake in my code.I fix it. But now I have a different problem . I posted this problem in the following post.
viewtopic.php?f=2&t=5493
Re: Using timer AND external interrupt to wake up from deep sleep mode.
Hi loboris, what IDE are you using for your projects? I'm starting with ESP32, I started using Arduino but there are many functions that don't work very wellHow exactly it does not work ?Not working: (timer and external interrup).
esp_sleep_enable_timer_wakeup(3600000000);
esp_sleep_enable_ext0_wakeup(GPIO_NUM_33,1);
esp_deep_sleep_start();
I'm using it all the time, also mixed with ext1 wake up and wake stub and it works as expected.
I'm not using Arduino, maybe it is an Arduino problem.
Regards, Lucas
-
andrewandroid
- Posts: 10
- Joined: Sat Dec 26, 2020 7:33 am
Re: Using timer AND external interrupt to wake up from deep sleep mode.
I have the exact same issue. I want to set the deep sleep timer to wake, and also wake on external button press.
When I have the timer deep sleep set up, it works great.
But when I add in the ext1 or ext0 external interrupt set up, the ESP32 wakes immediately after sleeping.
Gotchas that I've looked at to solve this:
On the ESP32-WROOM, only certain RTC pins may used for EXT1 wakeups. Luckily I had chosen one. No luck.
On some ESP32 devices, you can use ESP_EXT1_WAKEUP_ANY_LOW, but this doesn't exist on ESP32-WROOM it seems, and it doesn't throw an error when you use it. Tried using ESP_EXT1_WAKEUP_ALL_LOW with INPUT_PULLUP but no luck.
I'd like to try ESP_EXT1_WAKEUP_ANY_HIGH, without using and relying on INPUT_PULLUP, but my PCB has the button connecting to GND when pressed, so I can't try that yet.
What was the solution / problem that you encountered?
When I have the timer deep sleep set up, it works great.
But when I add in the ext1 or ext0 external interrupt set up, the ESP32 wakes immediately after sleeping.
Gotchas that I've looked at to solve this:
On the ESP32-WROOM, only certain RTC pins may used for EXT1 wakeups. Luckily I had chosen one. No luck.
On some ESP32 devices, you can use ESP_EXT1_WAKEUP_ANY_LOW, but this doesn't exist on ESP32-WROOM it seems, and it doesn't throw an error when you use it. Tried using ESP_EXT1_WAKEUP_ALL_LOW with INPUT_PULLUP but no luck.
I'd like to try ESP_EXT1_WAKEUP_ANY_HIGH, without using and relying on INPUT_PULLUP, but my PCB has the button connecting to GND when pressed, so I can't try that yet.
What was the solution / problem that you encountered?
-
andrewandroid
- Posts: 10
- Joined: Sat Dec 26, 2020 7:33 am
Re: Using timer AND external interrupt to wake up from deep sleep mode.
I have the exact same issue. I want to set the deep sleep timer to wake, and also wake on external button press.
When I have the timer deep sleep set up, it works great.
But when I add in the ext1 or ext0 external interrupt set up, the ESP32 wakes immediately after sleeping.
Gotchas that I've looked at to solve this:
On the ESP32-WROOM, only certain RTC pins may used for EXT1 wakeups. Luckily I had chosen one. No luck.
On some ESP32 devices, you can use ESP_EXT1_WAKEUP_ANY_LOW, but this doesn't exist on ESP32-WROOM it seems, and it doesn't throw an error when you use it. Tried using ESP_EXT1_WAKEUP_ALL_LOW with INPUT_PULLUP but no luck.
I'd like to try ESP_EXT1_WAKEUP_ANY_HIGH, without using and relying on INPUT_PULLUP, but my PCB has the button connecting to GND when pressed, so I can't try that yet.
What was the solution / problem that you encountered?
When I have the timer deep sleep set up, it works great.
But when I add in the ext1 or ext0 external interrupt set up, the ESP32 wakes immediately after sleeping.
Gotchas that I've looked at to solve this:
On the ESP32-WROOM, only certain RTC pins may used for EXT1 wakeups. Luckily I had chosen one. No luck.
On some ESP32 devices, you can use ESP_EXT1_WAKEUP_ANY_LOW, but this doesn't exist on ESP32-WROOM it seems, and it doesn't throw an error when you use it. Tried using ESP_EXT1_WAKEUP_ALL_LOW with INPUT_PULLUP but no luck.
I'd like to try ESP_EXT1_WAKEUP_ANY_HIGH, without using and relying on INPUT_PULLUP, but my PCB has the button connecting to GND when pressed, so I can't try that yet.
What was the solution / problem that you encountered?
-
andrewandroid
- Posts: 10
- Joined: Sat Dec 26, 2020 7:33 am
Re: Using timer AND external interrupt to wake up from deep sleep mode.
This seemed to have fixed my problem:
Good luck!
Code: Select all
// Add ESP32 RTC GPIO header
#include "driver/rtc_io.h"
(...)
rtc_gpio_isolate((gpio_num_t) 4);Who is online
Users browsing this forum: Applebot, ChatGPT-User, Qwantbot and 6 guests