In the project I'm working on now, everything happens in PIO—all my main() function does is call pio_add_program() a few times to configure and load the necessary PIO programs. My PIO programs are entirely self-contained—there are no PUSHes, PULLs, IRQs or other interactions with the CPU. I'd like to reduce the RP2040's power usage as much as possible in this scenario. I'm using the C/C++ SDK, and I've underclocked the system clock as low as I can for my application. A few questions:
(1) What should my main() function do after it loads and activates my PIO programs? Right now I have while (true) { sleep_ms(500); } but I'm not sure if this is the best option for minimizing power draw.
(2) I've stopped clk_usb, clk_peri, clk_adc and clk_ref with clock_stop(), hoping to thereby disable peripherals associated with those clocks, so they're not using power. However, section 5.7.1 of the RP2040 datasheet lists a bunch of other peripherals that I don't need, and it's not clear to me which of them are disabled by default on boot, and which of them I've successfully disabled by disabling those four clocks. What's the best way to disable everything except what's needed to run self-contained PIO programs?
(3) By far the most power-hungry peripheral listed in 5.7.1 is XIP. I'm guessing that if I build my binary with NO_FLASH, then I won't need XIP to be enabled. Is this correct? Is there something that automatically disables XIP in NO_FLASH builds, or is there an extra step that I need to take to do this?
This is for a battery-powered application, so saving even a handful of milliamps would make a big difference.
Thanks!
(1) What should my main() function do after it loads and activates my PIO programs? Right now I have while (true) { sleep_ms(500); } but I'm not sure if this is the best option for minimizing power draw.
(2) I've stopped clk_usb, clk_peri, clk_adc and clk_ref with clock_stop(), hoping to thereby disable peripherals associated with those clocks, so they're not using power. However, section 5.7.1 of the RP2040 datasheet lists a bunch of other peripherals that I don't need, and it's not clear to me which of them are disabled by default on boot, and which of them I've successfully disabled by disabling those four clocks. What's the best way to disable everything except what's needed to run self-contained PIO programs?
(3) By far the most power-hungry peripheral listed in 5.7.1 is XIP. I'm guessing that if I build my binary with NO_FLASH, then I won't need XIP to be enabled. Is this correct? Is there something that automatically disables XIP in NO_FLASH builds, or is there an extra step that I need to take to do this?
This is for a battery-powered application, so saving even a handful of milliamps would make a big difference.
Thanks!
Statistics: Posted by aparrish — Sat Apr 20, 2024 2:42 am