ESP32: deep sleep seems to cut clock to ULP processor
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).
esp32/ulp: Explicitly enable ULP in build config.
Resolves esp32: ULP binary loading support was broken after 1.10 release #5159
I was able to reproduce the working ULP example in v1.10 using https://github.com/ThomasWaldmann/py-esp32-ulp/blob/master/examples/counter.py
As described in https://github.com/ThomasWaldmann/py-esp32-ulp/issues/42 this was broken in v1.11 release, throwing an OSError: 260
I was also able to reproduce this error.
The same error is present on current master builds for both IDF v3 and v4
Explicitly enabling ULP in the board config as attached fixes the error, allowing the counter example to run the same as v1.10
I'm not sure if CONFIG_ESP32_ULP_COPROC_RESERVE_MEM=1024 is the most appropriate value, this was picked from https://github.com/espressif/esp-idf/blob/master/examples/system/ulp/sdkconfig.defaults
This example config has only 512 however:
https://github.com/espressif/esp-idf/blob/master/examples/system/deep_sleep/sdkconfig.defaults
The ULP ram is taken out of RTC slow ram, I'm not sure what else uses this?
https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/kconfig.html