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

rory_gleeson
Posts: 1
Joined: Sat Mar 03, 2018 9:55 pm

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

Postby rory_gleeson » Sat Mar 03, 2018 10:11 pm

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

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.

Postby selim_bayhan » Sun Apr 15, 2018 7:52 am

I have the same case. This you find a solution.?

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

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

Postby loboris » 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.

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.

Postby selim_bayhan » Wed Apr 25, 2018 5:01 pm

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

LucasMG03
Posts: 1
Joined: Fri Jul 16, 2021 10:35 pm

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

Postby LucasMG03 » Fri Jul 16, 2021 10:41 pm

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

Who is online

Users browsing this forum: Bing [Bot], Majestic-12 [Bot] and 113 guests