Skip to content

ULP ADC read fails #11557

Open
Open
@ayavilevich

Description

@ayavilevich

Board

ESP32 generic dev module

Device Description

ESP32 generic dev module. Nothing additional connected.

Hardware Configuration

Nothing additional connected.

Version

latest stable Release (if not listed below)

IDE Name

Arduino IDE 2.3.6 and Platform.IO on VSC

Operating System

Windows 10

Flash frequency

40MHz

PSRAM enabled

no

Upload speed

921600

Description

Since Arduino-ESP32 2.0.14, using an ADC read operation in ESP32 ULP FSM co processor will cause the ULP to get "stuck".

I am including minimal code to reproduce.

Expected: wake due to an ULP wake after 5 seconds.
Actual: wakes due to (a fallback) timer wake after 20 seconds.

If using this code with ESP-IDF directly then it works as expected.
If using this code in a version before 2.0.14, then it works as expected.
If disabling the ADC read operation in the ULP code, then it works as expected.

More details at https://github.com/ayavilevich/ulp_adc_issue_ard_min/blob/main/README.md

Sketch

https://github.com/ayavilevich/ulp_adc_issue_ard_min/blob/main/src/main.cpp

Above can can be used with Arduino IDE, PIO or ESP-IDF.

Debug Message

Output, Arduino ESP32 3.2.0


ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:4888
load:0x40078000,len:16516
load:0x40080400,len:4
load:0x40080404,len:3476
entry 0x400805b4
ESP-IDF: 5.4.1, ESP Arduino: 3.2.0
Start
Chip revision: 301
Not ULP/timer wakeup
TEST: sleeping for 20 sec
Entering deep sleep
ets Jul 29 2019 12:21:46

rst:0x5 (DEEPSLEEP_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:4888
load:0x40078000,len:16516
load:0x40080400,len:4
load:0x40080404,len:3476
entry 0x400805b4
ESP-IDF: 5.4.1, ESP Arduino: 3.2.0
Start
Chip revision: 301
Timer wakeup
Deep sleep wakeup
ULP do adc 1
ULP start counter: 2
ULP wake counter: 2
TEST: sleeping for 20 sec
Entering deep sleep


Output, Arduino ESP32 3.2.0 with ADC read disabled


ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:4888
load:0x40078000,len:16516
load:0x40080400,len:4
load:0x40080404,len:3476
entry 0x400805b4
ESP-IDF: 5.4.1, ESP Arduino: 3.2.0
Start
Chip revision: 301
Not ULP/timer wakeup
TEST: sleeping for 20 sec
Entering deep sleep
ets Jul 29 2019 12:21:46

rst:0x5 (DEEPSLEEP_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:4888
load:0x40078000,len:16516
load:0x40080400,len:4
load:0x40080404,len:3476
entry 0x400805b4
ESP-IDF: 5.4.1, ESP Arduino: 3.2.0
Start
Chip revision: 301
ULP wakeup
Deep sleep wakeup
ULP do adc 0
ULP start counter: 51
ULP wake counter: 50
TEST: sleeping for 20 sec
Entering deep sleep


Output, ESP-IDF 4.4.6


ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, 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:5484
ho 0 tail 12 room 4
load:0x40078000,len:14824
ho 0 tail 12 room 4
load:0x40080400,len:3460
0x40080400: _init at ??:?

entry 0x40080638
ESP-IDF: 4.4.6
Start
Chip revision: 3, full: 301
Not ULP/timer wakeup
TEST: sleeping for 20 sec
Entering deep sleep
ets Jul 29 2019 12:21:46

rst:0x5 (DEEPSLEEP_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, 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:5484
ho 0 tail 12 room 4
load:0x40078000,len:14824
ho 0 tail 12 room 4
load:0x40080400,len:3460
0x40080400: _init at ??:?

entry 0x40080638
ESP-IDF: 4.4.6
Start
Chip revision: 3, full: 301
ULP wakeup
Deep sleep wakeup
ULP do adc 1
ULP start counter: 51
ULP wake counter: 50
TEST: sleeping for 20 sec
Entering deep sleep

Other Steps to Reproduce

also tried on another ESP32 board. it made no difference.

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions