Keep PIOs running during 'lightsleep()' to help power saving #14087
Replies: 3 comments
-
Here's a more complicated example, structured in a way closer to my own project's (Pico-Timecode) implementation. This uses the FIFOs; where the duration of the PIO loop (representing 1 frame of video), and whether the LED should flash, is pushed into the FIFO ahead of when it's actually used. The PIO is timed according to it's clock divider, and 'plays' out the frames in sequence, creating a '1PPS' signal on the LED. Of note is that the Power savings? Again with 3.8V into VSYS pin... in the first 10s (regular Average measurements read from my PSU, instantaneous may be different - we expect a pulse every 4 frames as CPU re-fills the FIFOs. |
Beta Was this translation helpful? Give feedback.
-
Updated patches: 20240314_mp_keep_pios_running.patch.txt 20240314_sdk_keep_pios_running.patch.txt These now allow you to specify which clocks you want to keep active when calling
Not sure how you can reference the #defines of the SDK from python script.... |
Beta Was this translation helpful? Give feedback.
-
Patch suggested for/to Pico-SDK: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In reading the rp2040 datasheet I see that it is possible to keep the PIO functional during the
lightsleep()
mode; this does require that the SYS_PLL is kept running, but DOES offer significant power saving for projects where the PIOs (rather than the CPU) are performing workload.This simple
blink.py
script shows that the PIO are normally stopped duringlightsleep()
.blink.py.txt
However with these patches to microPython/Pico-SDK, the PIO clocks/blocks(s) are kept running.
20240313_mp_keep_pios_running.patch.txt
20240313_sdk_keep_pios_running.patch.txt
The power saving for this? Running 3.8V into the VSYS pin.
Before patches : 20mA, then 3mA, then 23mA (noting CPU freq is reset to default)
After patches : 20mA, then 8mA, then 20mA
So overall a saving of 12mA, when the CPU does not need to be enabled, but whilst still flashing the LED.
I would suggest that the call to
lightsleep()
be extended tolightsleep(time_ms, sleep_en0_bitfield, sleep_en1_bitfield)
.Edit:
Here's a demo of the 'magic' happening. The Pico+OLED is running at 13mA from 3.8V whilst in the 'power save' mode!
https://youtu.be/YZEwyyycofg?si=Siods6kGUAUzKczd
Beta Was this translation helpful? Give feedback.
All reactions