Deep sleep example does not work

atx823
Posts: 15
Joined: Fri Jan 07, 2022 6:51 pm

Deep sleep example does not work

Postby atx823 » Tue Nov 26, 2024 8:52 pm

I'm running the stock deep_sleep example with EXT1 wakeup enabled on a esp32-pico-mini-02 board from digikey with idf version 5.1.4.

The problem: it keeps waking up immediately, even though EXT1 wakeup is set to ANY_HIGH and EXT1 wakeup pins GPIO 2 and 4 are wired directly to ground. Nothing else is connected.

The wakeup source is reported by esp_sleep_get_wakeup_cause() as ESP_SLEEP_WAKEUP_GPIO instead of ESP_SLEEP_WAKEUP_EXT1, even though GPIO is supposed to be light sleep only.

I added the line

Code: Select all

	esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_ALL);
as the first line in app_main, before ext1 wakeup gets enabled, but this had no effect.

The example configuration in menuconfig is:

Code: Select all

(Top) → Example Configuration
[ ] Enable touch wake up
[ ] Enable wakeup from GPIO (ext0)
[*] Enable wakeup from GPIO (ext1)
    EXT1 wakeup configuration  --->

(Top) → Example Configuration → EXT1 wakeup configuration
    Enable wakeup from PIN_1 (GPIO 2)  --->
    Enable wakeup from PIN_2 (GPIO 4)  --->
    Select wakeup mode from EXT1 (GPIO any high level)  --->
[ ] Use internal pull-up/downs for EXT1 wakeup source
The example contains code for light sleep gpio wakeup, but I could not find any way of configuring it in the the menuconfig example configuration. I verified it was not active in sdkconfig.h and from the monitor output.

Monitor output is as follows (the elapsed time between deep sleep and wakeup is < 1 second):

Code: Select all

I (0) cpu_start: App cpu up.
I (233) cpu_start: Pro cpu start user code
I (234) cpu_start: cpu freq: 80000000 Hz
I (234) cpu_start: Application information:
I (238) cpu_start: Project name:     deep_sleep
I (243) cpu_start: App version:      1
I (248) cpu_start: Compile time:     Nov 25 2024 22:53:56
I (254) cpu_start: ELF file SHA256:  2caf2218fa4256ca...
I (260) cpu_start: ESP-IDF:          v5.1.4
I (265) cpu_start: Min chip rev:     v0.0
I (269) cpu_start: Max chip rev:     v3.99 
I (274) cpu_start: Chip rev:         v1.0
I (279) heap_init: Initializing. RAM available for dynamic allocation:
I (286) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (292) heap_init: At 3FFB2A58 len 0002D5A8 (181 KiB): DRAM
I (299) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (305) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (311) heap_init: At 4008D148 len 00012EB8 (75 KiB): IRAM
I (319) spi_flash: detected chip: gd
I (322) spi_flash: flash io: dio
W (326) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (340) app_start: Starting scheduler on CPU0
I (344) app_start: Starting scheduler on CPU1
I (344) main_task: Started on CPU0
I (354) main_task: Calling app_main()
Enabling timer wakeup, 20s
Enabling EXT1 wakeup on pins GPIO2, GPIO4
Not a deep sleep reset
I (364) main_task: Returned from app_main()
Entering deep sleep
ets Jun  8 2016 00:22:57

rst:0x5 (DEEPSLEEP_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 188777542, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:7312
load:0x40078000,len:15932
load:0x40080400,len:4
0x40080400: _init at ??:?

load:0x40080404,len:3876
entry 0x4008064c
I (30) boot: ESP-IDF v5.1.4 2nd stage bootloader
I (30) boot: compile time Nov 25 2024 22:58:32
I (30) boot: Multicore bootloader
I (34) boot: chip revision: v1.0
I (38) boot.esp32: SPI Speed      : 40MHz
I (43) boot.esp32: SPI Mode       : DIO
I (47) boot.esp32: SPI Flash Size : 2MB
I (52) boot: Enabling RNG early entropy source...
I (57) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=09ea8h ( 40616) map
I (66) esp_image: segment 1: paddr=00019ed0 vaddr=3ff80063 size=00008h (     8) 
I (74) esp_image: segment 2: paddr=00019ee0 vaddr=3ffb0000 size=021c0h (  8640) load
I (83) esp_image: segment 3: paddr=0001c0a8 vaddr=40080000 size=03f70h ( 16240) load
I (93) esp_image: segment 4: paddr=00020020 vaddr=400d0020 size=1436ch ( 82796) map
I (99) esp_image: segment 5: paddr=00034394 vaddr=40083f70 size=091d8h ( 37336) load
I (113) esp_image: segment 6: paddr=0003d574 vaddr=400c0000 size=00064h (   100) 
I (115) esp_image: segment 7: paddr=0003d5e0 vaddr=50000200 size=00010h (    16) 
I (124) boot: Fast booting app from partition at offset 0x10000
I (130) boot: Disabling RNG early entropy source...
I (147) cpu_start: Multicore app
I (147) cpu_start: Pro cpu up.
I (147) cpu_start: Starting app cpu, entry point is 0x4008125c
0x4008125c: call_start_cpu1 at /media/neddie/mydata/esp-idf-v5.1.4/components/esp_system/port/cpu_start.c:159

I (0) cpu_start: App cpu up.
I (165) cpu_start: Pro cpu start user code
I (165) cpu_start: cpu freq: 80000000 Hz
I (165) cpu_start: Application information:
I (170) cpu_start: Project name:     deep_sleep
I (175) cpu_start: App version:      1
I (179) cpu_start: Compile time:     Nov 25 2024 22:53:56
I (186) cpu_start: ELF file SHA256:  2caf2218fa4256ca...
I (192) cpu_start: ESP-IDF:          v5.1.4
I (196) cpu_start: Min chip rev:     v0.0
I (201) cpu_start: Max chip rev:     v3.99 
I (206) cpu_start: Chip rev:         v1.0
I (211) heap_init: Initializing. RAM available for dynamic allocation:
I (218) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (224) heap_init: At 3FFB2A58 len 0002D5A8 (181 KiB): DRAM
I (230) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (236) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (243) heap_init: At 4008D148 len 00012EB8 (75 KiB): IRAM
I (251) spi_flash: detected chip: gd
I (253) spi_flash: flash io: dio
W (257) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (271) app_start: Starting scheduler on CPU0
I (276) app_start: Starting scheduler on CPU1
I (276) main_task: Started on CPU0
I (286) main_task: Calling app_main()
Enabling timer wakeup, 20s
Enabling EXT1 wakeup on pins GPIO2, GPIO4
Wake up from GPIO
I (296) main_task: Returned from app_main()
Entering deep sleep

atx823
Posts: 15
Joined: Fri Jan 07, 2022 6:51 pm

Re: Deep sleep example does not work

Postby atx823 » Wed Nov 27, 2024 9:09 pm

Exact same code works in idf v4.2 and v5.2.3, so deep sleep in v5.1.4 is broken.

Who is online

Users browsing this forum: Baidu [Spider], Google [Bot], Majestic-12 [Bot] and 73 guests