esp-idf/components/esp32
Ivan Grokhotkov 4359d5985e sleep: make sure input enable is set for EXT0/EXT1 wakeup
Since commit 94250e4, EXT0 wakeup mechanism, when wakeup level was set
to 0, started waking up chip immediately after entering deep sleep.
This failure was triggered in that commit by a change of
RTC_CNTL_MIN_SLP_VAL (i.e. minimum time in sleep mode until wakeup
can happen) from 128 cycles to 2 cycles.

The reason for this behaviour is related to the way input enable (IE)
signal going into an RTC pad is obtained:

    PAD_IE = (SLP_SEL) ? SLP_IE & CHIP_SLEEP : IE,

where SLP_IE, SLP_SEL, and IE are bits of an RTC_IO register related
to the given pad. CHIP_SLEEP is the signal indicating that chip has
entered sleep mode.

The code in prepare_ext{0,1}_wakeup did not enable IE, but did enable
SLP_SEL and SLP_IE. This meant that until CHIP_SLEEP went high, PAD_IE
was 0, hence the input from the pad read 0 even if external signal
was 1. CHIP_SLEEP went high on the 2nd cycle of sleep. So when
RTC_CNTL_MIN_SLP_VAL was set to 2, the input signal from the pad was
latched as 0 at the moment when CHIP_SLEEP went high, causing EXT0
wakeup with level 0 to trigger.

This commit changes the way PAD_IE is enabled: SLP_SEL and SLP_IE are
no longer used, and IE is set to 1. If EXT0 wakeup is used, RTC_IO is
not powered down, so IE signal stays 1 both before CHIP_SLEEP goes
high and after. If EXT1 wakeup is used, RTC_IO may be powered down.
However prepare_ext1_wakeup enables Hold on the pad, locking states
of all the control signals, including IE.

Closes https://github.com/espressif/esp-idf/issues/1931
Closes https://github.com/espressif/esp-idf/issues/2043
2018-06-12 20:25:15 +08:00
..
hwcrypto soc: Change DPORT access 2018-05-14 17:54:57 +05:00
include Merge branch 'feature/Add_noinit_rtc_noinit_sections' into 'master' 2018-06-08 16:01:30 +08:00
ld Merge branch 'feature/Add_noinit_rtc_noinit_sections' into 'master' 2018-06-08 16:01:30 +08:00
lib@16777c5d1e fix espnow bug when add node in AP+STA mode 2018-06-06 20:44:19 +08:00
test Merge branch 'feature/Add_noinit_rtc_noinit_sections' into 'master' 2018-06-08 16:01:30 +08:00
brownout.c brownout detector: enable by default 2017-07-10 17:25:55 +08:00
cache_err_int.c esp32: fix cache error interrupt handler 2017-09-08 09:59:09 +08:00
clk.c driver: reset communication peripherals when the cpu starts. 2018-05-18 14:41:58 +08:00
coexist_internal.h component/esp32 : clear some minor thingsw about PM and coexistence 2018-04-03 20:13:49 +08:00
coexist.c component/esp32 : clear some minor thingsw about PM and coexistence 2018-04-03 20:13:49 +08:00
component.mk add mesh feature 2018-04-04 22:57:45 +08:00
core_dump.c freertos: deprecate XT_CLOCK_FREQ 2017-10-18 14:19:19 +08:00
cpu_start.c esp32: Adds GCOV debug stubs support 2018-05-18 16:16:03 +03:00
crosscore_int.c crosscore_int: use _ISR version of portENTER/EXIT_CRITICAL in ISR 2018-04-19 18:28:55 +05:30
dbg_stubs.c esp32: Adds GCOV debug stubs support 2018-05-18 16:16:03 +03:00
dport_access.c dport: Bigfix dport_read code move to IRAM 2018-05-21 22:00:51 +05:00
dport_panic_highint_hdl.S xtensa: remove unused header files 2018-05-31 02:21:36 +00:00
esp_clk_internal.h bugfix/rtc_clk_32k_bootstrap: Fix starting 32k RTC 2018-03-21 13:27:56 +05:00
esp_err_to_name.c Add esp_http_client 2018-05-21 09:35:07 +07:00
esp_err_to_name.c.in ESP32: Optionally disable lookup-tables for esp_err_to_name 2018-03-13 14:26:54 +01:00
esp_timer_esp32.c sleep: fix deadlock in esp_timer_impl_advance after light sleep 2018-05-09 22:52:50 +08:00
esp_timer_impl.h sleep: fix deadlock in esp_timer_impl_advance after light sleep 2018-05-09 22:52:50 +08:00
esp_timer.c Merge branch 'bugfix/light_sleep_fixes' into 'master' 2018-05-02 20:09:36 +08:00
ets_timer_legacy.c wifi/bt coexistence: Fix disabled cache access race when writing to flash 2017-10-16 19:47:33 +08:00
event_default_handlers.c add event SYSTEM_EVENT_AP_STAIPASSIGNED 2018-05-19 13:14:12 +08:00
event_loop.c add mesh feature 2018-04-04 22:57:45 +08:00
fast_crypto_ops.c esp32/wpa_supplicant: fix some bugs introduced by wifi os adapter 2018-05-31 17:09:40 +08:00
freertos_hooks.c freertos,esp32: automatic light sleep support 2018-05-18 03:14:46 +00:00
gdbstub.c Resolve problems found by enabling -Wwrite-strings compilation flag 2018-04-10 08:53:43 +02:00
hw_random.c freertos: deprecate XT_CLOCK_FREQ 2017-10-18 14:19:19 +08:00
int_wdt.c Dump the frame of the other core when interrupt watchdog happens 2018-01-18 23:10:29 +00:00
intr_alloc.c esp32: fix interrupt list insert issue 2018-05-14 14:13:08 +08:00
ipc.c fix buffer overflow in ipc.c 2017-11-27 18:47:40 +08:00
Kconfig remove executable permission from source files 2018-05-29 20:07:45 +08:00
lib_printf.c component/esp32 : clear some minor thingsw about PM and coexistence 2018-04-03 20:13:49 +08:00
libhal.a Initial public version 2016-08-17 23:08:22 +08:00
Makefile.projbuild build: Remove explict -lstdc++-psram-workaround 2018-01-11 10:32:02 +11:00
panic.c ESP_ERROR_CHECK converts error code to text 2018-05-31 12:53:37 +02:00
phy_init_data.h component/esp32 : update phy & rtc 2017-10-17 18:02:42 +08:00
phy_init.c esp32/wpa_supplicant: fix some bugs introduced by wifi os adapter 2018-05-31 17:09:40 +08:00
phy.h esp32: some changes relating to phy v3900 2018-05-22 14:16:09 +08:00
pm_esp32.c freertos,esp32: automatic light sleep support 2018-05-18 03:14:46 +00:00
pm_impl.h pm: initial implementation for ESP32 2017-10-18 14:19:16 +08:00
pm_locks.c pm: initial version of power management APIs 2017-10-18 14:19:16 +08:00
pm_trace.c freertos,esp32: automatic light sleep support 2018-05-18 03:14:46 +00:00
pm_trace.h freertos,esp32: automatic light sleep support 2018-05-18 03:14:46 +00:00
restore.c esp_system: remove link time dependency on WiFi stack 2017-06-15 18:15:36 +08:00
sleep_modes.c sleep: make sure input enable is set for EXT0/EXT1 wakeup 2018-06-12 20:25:15 +08:00
spiram_psram.c soc: Fix description of rtc_config_t.tieh, add macros 2018-05-25 14:58:37 +10:00
spiram_psram.h Add initial SPI RAM support. This adds support for an ESP-PSRAM32 chip connected to the default flash pins and GPIO 16 and 17. The RAM is mapped to address 0x3F800000, but otherwise ignored by esp-idf as of yet. 2017-09-04 12:05:49 +08:00
spiram.c Add option to continue running (with less ram) if psram is enabled but not detected 2018-02-12 13:44:11 +08:00
stack_check.c esp32: Adds Stack Smashing Protection Feature 2017-11-17 12:08:36 +03:00
system_api.c rename clock enable and reset bits for SPI modules 2018-05-14 16:45:03 +08:00
task_wdt.c watchdogs: make sure timer group peripherals are enabled 2017-12-01 20:10:26 +08:00
wifi_init.c wifi: Set default wifi library log level based on sdkconfig 2018-05-02 15:11:21 +10:00
wifi_os_adapter.c Add OS adapter to WiFi driver 2018-05-26 17:22:23 +08:00