ESP32 Doesn't Wakeup with Ext1 source
Posted: Fri Jan 29, 2021 4:34 am
Hi,
I am facing an issue with my ESP32 custom board where the device doesn't wake up with(GPIO35 ) as an EXT1 Wakeup source when the pin reads low. I have used the example provided in the IDF. However, my board's wakeup with ULP as a wakeup source. Also, the other wakeup sources aren't working. I have tried examples but of no use. The code is as mentioned below.
void RTC_IRAM_ATTR esp_wake_deep_sleep(void)
{
esp_default_wake_deep_sleep();
// Add additional functionality here
}
void app_main()
{
rtc_gpio_init(( 35));
rtc_gpio_set_direction((35), RTC_GPIO_MODE_INPUT_ONLY);
rtc_gpio_pullup_en((35));
while(1)
{
esp_wake_deep_sleep();
switch (esp_sleep_get_wakeup_cause())
{
case ESP_SLEEP_WAKEUP_EXT1:
{
uint64_t wakeup_pin_mask = esp_sleep_get_ext1_wakeup_status();
if (wakeup_pin_mask != 0)
{
int pin = __builtin_ffsll(wakeup_pin_mask) - 1;
printf("Wake up from GPIO %d\n", pin);
}
else
{
printf("Wake up from GPIO\n");
}
break;
}
case ESP_SLEEP_WAKEUP_UNDEFINED:
default:
printf("Not a deep sleep reset\n");
}
vTaskDelay(1000 / portTICK_PERIOD_MS);
const int ext_wakeup_pin_1 = 35;
const uint64_t ext_wakeup_pin_1_mask = 1ULL << ext_wakeup_pin_1;
esp_sleep_enable_ext1_wakeup(ext_wakeup_pin_1_mask, ESP_EXT1_WAKEUP_ALL_LOW);
esp_deep_sleep_start();
}
}
Can someone suggest a way to use EXT1 as a wakeup source?
I am facing an issue with my ESP32 custom board where the device doesn't wake up with(GPIO35 ) as an EXT1 Wakeup source when the pin reads low. I have used the example provided in the IDF. However, my board's wakeup with ULP as a wakeup source. Also, the other wakeup sources aren't working. I have tried examples but of no use. The code is as mentioned below.
void RTC_IRAM_ATTR esp_wake_deep_sleep(void)
{
esp_default_wake_deep_sleep();
// Add additional functionality here
}
void app_main()
{
rtc_gpio_init(( 35));
rtc_gpio_set_direction((35), RTC_GPIO_MODE_INPUT_ONLY);
rtc_gpio_pullup_en((35));
while(1)
{
esp_wake_deep_sleep();
switch (esp_sleep_get_wakeup_cause())
{
case ESP_SLEEP_WAKEUP_EXT1:
{
uint64_t wakeup_pin_mask = esp_sleep_get_ext1_wakeup_status();
if (wakeup_pin_mask != 0)
{
int pin = __builtin_ffsll(wakeup_pin_mask) - 1;
printf("Wake up from GPIO %d\n", pin);
}
else
{
printf("Wake up from GPIO\n");
}
break;
}
case ESP_SLEEP_WAKEUP_UNDEFINED:
default:
printf("Not a deep sleep reset\n");
}
vTaskDelay(1000 / portTICK_PERIOD_MS);
const int ext_wakeup_pin_1 = 35;
const uint64_t ext_wakeup_pin_1_mask = 1ULL << ext_wakeup_pin_1;
esp_sleep_enable_ext1_wakeup(ext_wakeup_pin_1_mask, ESP_EXT1_WAKEUP_ALL_LOW);
esp_deep_sleep_start();
}
}
Can someone suggest a way to use EXT1 as a wakeup source?