UART as wake-up source in Light sleep mode

Paul Efford
Posts: 1
Joined: Thu Mar 14, 2019 4:18 pm

Re: UART as wake-up source in Light sleep mode

Postby Paul Efford » Thu Mar 14, 2019 4:21 pm

Another solution to awake ESP32 from sleep (also from DEEP SLEEP) would be:

1) Cabling (direct connecting) from SERIAL_RX_PIN (=GPIO_NUM_3) to any free RTC GPIO, for example, GPIO_27.

2) We cannot do "esp_sleep_enable_ext1_wakeup(MULTIPLE_INT_BITMASK, ESP_EXT1_WAKEUP_ANY_HIGH);" because SERIAL_RX_PIN pin is HIGH when idle, so it will awake the ESP32 continuously.

3) We cannot use "esp_sleep_enable_ext1_wakeup(MULTIPLE_INT_BITMASK, ESP_EXT1_WAKEUP_ALL_LOW);" because we will probably want to awake the ESP32 from different independent sources, and not when having all of them LOW.

4) Solution: we can do "esp_sleep_enable_ext0_wakeup(GPIO_NUM_27, LOW);" and also having it combined with "esp_sleep_enable_ext1_wakeup(MULTIPLE_INT_BITMASK, ESP_EXT1_WAKEUP_ANY_HIGH);" for other sources.
This will awake our ESP32 from deep_sleep on receiving any serial input.

5) Careful:
* Only RTC IO can be used as a source for external wake source: they are pins: 0,2,4,12-15,25-27,32-39
* ext0 uses RTC_IO to wake up thus requires RTC peripherals; to be on while ext1 uses RTC Controller so doesn't need peripherals to be powered on.
* Note that using internal pullups/pulldowns also requires RTC peripherals to be turned on: this makes "esp_sleep_enable_touchpad_wakeup()" to NOT work! (https://docs.espressif.com/projects/esp ... ad_wakeupv), throwing an exception: "E (151) sleep: Conflicting wake-up trigger: ext0"
* So, if there are to use capacitive-pin interrupts in addtion to ext0 or ext1 interrupts, don't use this. Instead, put all interrupts as ext1 masked.
* If we need to use touch_interrupts, ext0 has NOT to be used.
* We can NOT use instead ext1 again, defining a second macro ONLY for our copied RTC pin for SERIAL_RX_PIN, like: "esp_sleep_enable_ext1_wakeup(SERIAL_INT_BITMASK, ESP_EXT1_WAKEUP_ALL_LOW);", because further definitions of ext1 will overwrite prior ones... same applies to ext0.

Hope this helps! :)

Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot] and 23 guests