-
Notifications
You must be signed in to change notification settings - Fork 7.6k
External wake up ext1 problem #9809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I found the command ESP_EXT1_WAKEUP_ALL_LOW is the same as ESP_EXT1_WAKEUP_ANY_HIGH in 3.0.0 version so that's the cause of the problem in 3.0.0 and 3.0.1 but in version 2.x.x there is no problem |
I have the same problem. It seems like @CobaProgram is right. |
I'm having the same issue on an ESP32-S2. The code for waking up on high pins worked in Core 2.0.x but triggers immediately on Core 3.0.1 when the pins are low. I looked through the code for both cores (ESP-IDF versions 4.4 and 5.1) and tried manually setting the following registers to no avail: REG_WRITE(RTC_CNTL_PAD_HOLD_REG,0x4000); Setting those registers alone had no effect. If I put this line before them: esp_sleep_enable_ext1_wakeup(0x4000, ESP_EXT1_WAKEUP_ANY_HIGH); The processor would wake up immediately when pin 14 was low. Wakeup reason is shows as EXT1, pin 14. I did a comparison of all RTC_CNTL registers (and a few others) between Core 2.0.6 and Core 3.0.1 and didn't find any significant differences that I believe would explain the problem. Not sure whether this is fixable with modifying registers alone or the ESP-IDF code needs to be modified. |
@SuGlider Can you please help with triage of this issue? Thanks a lot |
This issue seems to be related to a change in IDF code. Not directly Arduino related. This is how it was and how the issue describes it: const int ext_wakeup_pin_1 = 2;
const uint64_t ext_wakeup_pin_1_mask = 1ULL << ext_wakeup_pin_1;
const int ext_wakeup_pin_2 = 4;
const uint64_t ext_wakeup_pin_2_mask = 1ULL << ext_wakeup_pin_2;
printf("Enabling EXT1 wakeup on pins GPIO%d, GPIO%d\n", ext_wakeup_pin_1, ext_wakeup_pin_2);
ESP_ERROR_CHECK(esp_sleep_enable_ext1_wakeup(ext_wakeup_pin_1_mask | ext_wakeup_pin_2_mask, ESP_EXT1_WAKEUP_ANY_HIGH)); This is the way how IDF 5.x does it: const int ext_wakeup_pin_1 = CONFIG_EXAMPLE_EXT1_WAKEUP_PIN_1;
const int ext_wakeup_pin_2 = CONFIG_EXAMPLE_EXT1_WAKEUP_PIN_2;
const uint64_t ext_wakeup_pin_1_mask = 1ULL << ext_wakeup_pin_1;
const uint64_t ext_wakeup_pin_2_mask = 1ULL << ext_wakeup_pin_2;
printf("Enabling EXT1 wakeup on pins GPIO%d, GPIO%d\n", ext_wakeup_pin_1, ext_wakeup_pin_2);
#if SOC_PM_SUPPORT_EXT1_WAKEUP_MODE_PER_PIN
ESP_ERROR_CHECK(esp_sleep_enable_ext1_wakeup_io(ext_wakeup_pin_1_mask, CONFIG_EXAMPLE_EXT1_WAKEUP_MODE_PIN_1));
ESP_ERROR_CHECK(esp_sleep_enable_ext1_wakeup_io(ext_wakeup_pin_2_mask, CONFIG_EXAMPLE_EXT1_WAKEUP_MODE_PIN_2));
#else
ESP_ERROR_CHECK(esp_sleep_enable_ext1_wakeup_io(ext_wakeup_pin_1_mask | ext_wakeup_pin_2_mask, CONFIG_EXAMPLE_EXT1_WAKEUP_MODE));
#endif The IDF Calls are different. My suggestion is about reading the manual and checking those examples. |
The solution for this issue is: esp_sleep_enable_ext1_wakeup_io(BUTTON_PIN_BITMASK(WAKEUP_GPIO), ESP_EXT1_WAKEUP_ANY_HIGH);
/*
If there are no external pull-up/downs, tie wakeup pins to inactive level with internal pull-up/downs via RTC IO
during deepsleep. However, RTC IO relies on the RTC_PERIPH power domain. Keeping this power domain on will
increase some power comsumption. However, if we turn off the RTC_PERIPH domain or if certain chips lack the RTC_PERIPH
domain, we will use the HOLD feature to maintain the pull-up and pull-down on the pins during sleep.
*/
rtc_gpio_pulldown_en(WAKEUP_GPIO); // GPIO33 is tie to GND in order to wake up in HIGH
rtc_gpio_pullup_dis(WAKEUP_GPIO); // Disable PULL_UP in order to allow it to wakeup on HIGH
The example from Arduino has been fixed as well. |
@CobaProgram - No pull down resistor is necessary because it is done internally to the chip using |
Note: it is necessary to include a new file in order to use
|
Board
ESP32 Dev Module and Doit ESP32 devkit v1
Device Description
Devkit v1
Hardware Configuration
GPIO 34, 36 and 39 connect to push button active high (pulldown resistor 10k)
Version
v3.0.0
IDE Name
Arduino IDE
Operating System
Windows 10
Flash frequency
80 MHz
PSRAM enabled
no
Upload speed
921600
Description
This code does not work after update to version 3.0.0 and always awake
Sketch
Debug Message
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
The text was updated successfully, but these errors were encountered: