-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
lightsleep on Pico W regression for 1.24.0 #16181
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
Comments
related to #16180 16180 |
I got the same result using a regular PICO. Works on 1.23, not on 1.24.1 |
|
Does your Pico say RP2-B1 on the chip, or RP2-B2? |
I posted some explanation of this in one of the linked PRs that's since closed, but here's what is happening (mostly copied from #16431):
Before 74fb42a (including V1.23), both the pico-sdk alarm pool and the lightsleep wakeup timer use alarm 3. The lightsleep timer would quietly clobber alarm 3's timeout, meaning softtimer events wouldn't wake the chip from lightsleep. After 74fb42a (including V1.24), soft timer wakeup happens on timer alarm 2 so this interrupt can wake the chip from light sleep. On PICO-W builds this happens every lwIP tick (64ms), which is unexpected and prevents lightsleep from sleeping more than 64ms. We could change the code back so that soft timer isn't a wakeup source, or make this configurable. However, I think the happy path for most users will be to stop the the lwIP tick (or timers) when there aren't any active network interfaces. That would mean lightsleep+wifi would work (lightsleep stills exit earlier, but wifi stays up with minimal power consumption), however if you instead disconnect wifi then lightsleep would run until something else woke it up or it hits the timeout. This work has gotten intertwined with some related pico-sdk sleep problems, but now those are approaching resolution (see #16454) then it's probably a good time to revisit it. |
I consider the proposal from @projectgus to be a really good solution:
This would bring back the possibility to lightsleep for >64ms (with WiFi turned off) as it was with <=1.23.0. The Pico_W guys can go back to 1.23 ... but for the Pico2_W there is currently no solution, so this proposal is even more important for those wanting to use a Pico2_W in low power-consumption scenario. Is there any work going on to stop the the lwIP tick/timers when there aren't any active network interfaces? |
I will weigh-in on @projectgus and @madozu recent comments. I don't seem much point in calling lightsleep() while the wifi radio is active. When I run the following fragment on a RPI Pico W power consumption (measured on USB)
Running on a RPI Pico (where lightsleep works) I measure a power consumption drop For an application running from battery it makes sense to shutdown WIFI and the CYW43 chip first. Having said that, I agree with @projectgus about the 'happy path'. |
Port, board and/or hardware
PICO W
MicroPython version
Micropython 1.24.0
Reproduction
Micropython 1.23.0 can run that code:
it will sleep for 10s.
if you try the same with 1.24.0 there is absolutely no sleep at all. the string
Loop instance
just appears every 0.1 secondsExpected behaviour
machine.lightsleep
to do something on 1.24.0Observed behaviour
machine.lightsleep
do something on 1.23.0 but not 1.24.0Additional Information
No, I've provided everything above.
Code of Conduct
Yes, I agree
The text was updated successfully, but these errors were encountered: