Using timer AND external interrupt to wake up from deep sleep mode.
Posted: 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
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