Page 1 of 1

ext0 can't work together with ext1?

Posted: Sat Feb 22, 2020 1:43 am
by lolomarx
I want to wake up esp32 from deepsleep mode by below cases:
1) Key down (gpio 25 turn to low )
2) USB plug in ( gpio 35 turn to high )

So i and below codes on main.c

Code: Select all

[Codebox=c file=Untitled.c]
#define WAKE_UP_GPIO_25_MASK 0x2000000
esp_sleep_enable_ext0_wakeup(35,1)  // wake up when USB connected ,gpio  35 is high

esp_sleep_enable_ext1_wakeup(WAKE_UP_GPIO_25_MASK,ESP_EXT1_WAKEUP_ALL_LOW )  // wake up when the key pressed ,gpio 25 is low
[/Codebox]
I found that i can't get above ext0 and ext1 work together while the last one ext work only.
And , each one can work if i remove the other one

Ext0 work :

Code: Select all

[Codebox=c file=Untitled.c]
#define WAKE_UP_GPIO_25_MASK 0x2000000
esp_sleep_enable_ext0_wakeup(35,1)  // wake up when USB connected ,gpio  35 is high

//esp_sleep_enable_ext1_wakeup(WAKE_UP_GPIO_25_MASK,ESP_EXT1_WAKEUP_ALL_LOW )  // wake up when the key pressed ,gpio 25 is low
[/Codebox]
Ext1 work :

Code: Select all

[Codebox=c file=Untitled.c]
#define WAKE_UP_GPIO_25_MASK 0x2000000
//esp_sleep_enable_ext0_wakeup(35,1)  // wake up when USB connected ,gpio  35 is high

esp_sleep_enable_ext1_wakeup(WAKE_UP_GPIO_25_MASK,ESP_EXT1_WAKEUP_ALL_LOW )  // wake up when the key pressed ,gpio 25 is low
[/Codebox]
Does i miss any other config?

My board is using ESP-IDF 3.3.1 to build the firmware.

Re: ext0 can't work together with ext1?

Posted: Wed Feb 26, 2020 7:11 pm
by mikemoy
Try esp_sleep_enable_gpio_wakeup() in pace for your esp_sleep_enable_ext1_wakeup()