Page 1 of 1

How to read from sensors with ULP in deepsleep?

Posted: Sat Feb 02, 2019 3:18 pm
by walterheisenberg
I want to run my ESP32-board with a battery. To get more battery life, I wanted to read values from sensors when the device is in deepsleep via the UltraLow Coprocessor.
Is that possible in Micropython without writing assembly code?

Re: How to read from sensors with ULP in deepsleep?

Posted: Sun Feb 03, 2019 5:19 am
by mattyt
No, you still have to write ULP assembly code unfortunately.

However, it is somewhat easier to use ULP in MicroPython since it's possible to compile ULP assembly at runtime with Thomas Waldmann's py-esp-ulp MicroPython library. This simplifies the build process a little.

There has been some discussion around allowing some subset of MicroPython to target ULP assembly (with a particular decorator over a function perhaps?) but this is quite a lot of work for not a lot of value. The ULP directives are quite primitive so it would be an awkward compilation step from Python to ULP.

So yeah, right now it's still some work figuring out how to use the obscure ULP syntax to interact with your sensors...