Page 1 of 1

Using timer AND external interrupt to wake up from deep sleep mode.

Posted: Sat Mar 03, 2018 10:11 pm
by rory_gleeson
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

Re: Using timer AND external interrupt to wake up from deep sleep mode.

Posted: Sun Apr 15, 2018 7:52 am
by selim_bayhan
I have the same case. This you find a solution.?

Re: Using timer AND external interrupt to wake up from deep sleep mode.

Posted: Sun Apr 15, 2018 3:48 pm
by loboris
rory_gleeson wrote: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();
How exactly it does not work ?
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.

Re: Using timer AND external interrupt to wake up from deep sleep mode.

Posted: Wed Apr 25, 2018 5:01 pm
by selim_bayhan
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

Re: Using timer AND external interrupt to wake up from deep sleep mode.

Posted: Fri Jul 16, 2021 10:41 pm
by LucasMG03
loboris wrote:
Sun Apr 15, 2018 3:48 pm
rory_gleeson wrote: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();
How exactly it does not work ?
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.
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 well
Regards, Lucas