← index #5651PR #11571
Related · high · value 2.211
QUERY · ISSUE

ESP32: deep sleep seems to cut clock to ULP processor

openby flo-rianopened 2020-02-16updated 2025-09-23
port-esp32

It seems like going to deep sleep stops the ULP processor. I uploaded a counter code to the ULP and it counts nicely as long as main CPUs running. When going to deep sleep counting stops but the counter value remains so the ULP was not reset or memory erased. After coming back from deep sleep counting works again.

As a side note: I would like to suggest to also add the ULP as a wakeup source in the esp32 package (in addition to the EXT, timer and touch options).

CANDIDATE · PULL REQUEST

ports/esp32/ulp: Initial draft PR for RISCV ULP support S2/S3

closedby ThinkTransitopened 2023-05-20updated 2023-05-20

The S2 and S3 chips contain a RISCV ULP co-processor in addition to the FSM ULP.

This PR is an initial attempt to provide access to the RISCV co-processor from micropython.

Operation

  1. During build cmake checks for the existence of file ports/esp32/ulp_riscv/main.c
  2. main.c is compiled and included in the micropython firmware bin file
  3. Calling ULP.riscv_load_binary() will load binary to ULP co-processor
  4. Calling ULP.riscv_run() will run RISCV ULP.

Example

Tested with IDF v4.4.4, micropython latest

MicroPython 3229791b6-dirty on 2023-05-20; INSIGHT_S3_GENERIC with ESP32-S3
Type "help()" for more information.
>>> import esp32
>>> ulp = esp32.ULP()
>>> ulp.riscv_load_binary()
>>> ulp.riscv_run()
>>>
>>> import machine
>>> machine.deepsleep(0)

After calling run() GPIO_14 will blink rapidly.

After entering deepsleep, GPIO_14 will continue to blink.

Next steps/improvements

  • Move main.c ULP code to more appropriate location, possibly to board definition sub-folder?
  • Support sharing variables between ULP and main program
  • Documentation/examples

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied