Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add LowPower library #2620

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

Conversation

maxgerhardt
Copy link
Contributor

@maxgerhardt maxgerhardt commented Nov 17, 2024

My attempt at making a nice low power library, that works for RP2040 and RP2350. Will close #2528, related to #345.

Adds a modified version of pico_sleep that removes some stuff (like STDIO reinit) that we can't just do in this core.

Currently working on RP2040 with a Pico board, work in progress.

Current state:

  • with all unused GPIOs set to PULLDOWN: 2.08mA
  • disabling input gate (gpio_set_input_enabled(p, false)) : 1.87mA
  • using INPUT mode instead: 1.58mA
  • disabling SWDCLK, SWDIO pins (magic pin number 30 and 3): 1.51mA
  • turning off the brown out detector: 1.48mA
  • changing the regulator for the digital voltage from 1.10V dow to 0.8V: 1.35mA
  • powering down the USB memory: no effect, 1.35mA
  • noticed that I was connected my power meter to VBUS and giving it 3.3V here, so all measurements above were actually at 3.3V
  • changed to supplying 5V to VBUS: 1.22mA
  • change to supplying 5V to VSYS pin (bypasses diode between VBUS and VSYS): 760µA!! (0.76mA at 5V)

grafik

ToDo and notes:

  • make management of GPIO pins before sleep and after wakeup easy, provide good defaults for a e.g. Pico board
  • GPIO pin leakage minimization is important
  • turn off as much digital logic as possible to minimize static power dissipation; in DORMANT mode wiht GPIO wakeup, all clocks are off, so dynamic power dissipation is 0

@maxgerhardt maxgerhardt marked this pull request as draft November 17, 2024 21:39
@maxgerhardt
Copy link
Contributor Author

Powering it from the actual 3V3 pin with my power meter gets the current to 869µA @ 3.3V, which is less Watt than 750µA @ 5V (3750µW vs 2870µW).. so bypassing the regulator gives good savings, too, if it can be done.

@earlephilhower
Copy link
Owner

Very neat! Do any clocks or subsystems need to be reinitialized after the sleep modes? I'm thinking of things like USB or UARTs, PWM, DMA, etc.? Or do they just preserve their state and freeze clocks so that they just jump back to life afterwards?

@seamusdemora seamusdemora mentioned this pull request Nov 18, 2024
@seamusdemora
Copy link

So looking forward to seeing this released :)

@ThomasLeister
Copy link

ThomasLeister commented Nov 26, 2024

Same here. I have a RAK11300 based project and the OEM's Arduino Framework does not seem to support any power saving measures. Thanks for all your efforts! I'm really excited to see the new features in a new release.

I'm going to set up my arduino-pico environment and try the current version for testing. :-)

@earlephilhower
Copy link
Owner

@maxgerhardt is this still a draft? I'll be releasing a minor update next week...

@maxgerhardt
Copy link
Contributor Author

Still a draft, need to test the sleep mode (instead of dormant) plus testing on RP2350. Also fixing the CI (the copy of the board jsons from Arduino-Pico into the platform-raspberrypi folder blocked the pio pkg update to work due to git conflicts). End of next week might be realistic.

@earlephilhower
Copy link
Owner

No worries, just wanted to double check since I saw you merging master recently. Thx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: support deep sleep for the RP2350
4 participants