← index #15751Issue #18730
Related · high · value 2.453
QUERY · ISSUE

machine.lightsleep makes time.sleep_ms takes more time on every call

openby staltuxopened 2024-08-30updated 2024-09-01
bug

Port, board and/or hardware

rp2040

MicroPython version

MicroPython v1.23.0 on 2024-06-02; Raspberry Pi Pico with RP2040

Reproduction

while True:
# omitted code to turn led on and off
time.sleep_ms(500)
machine.lightsleep(4000)

Expected behaviour

every call to time.sleep_ms(500) should take the same time

Observed behaviour

the led take more and more time to turn on and off after the same sleep_ms()

Additional Information

No, I've provided everything above.

Code of Conduct

Yes, I agree

CANDIDATE · ISSUE

RP2350 lightsleep broken on battery

closedby chhuopened 2026-01-27updated 2026-01-27
bug

Port, board and/or hardware

pico 2 w

MicroPython version

v1.27.0 (2025-12-09)

Reproduction

from machine import Pin
import machine
import time

led = Pin("LED", Pin.OUT) # Use the built-in LED

just to indicate when a reset occured

led.off()
time.sleep(1)
led.on()
time.sleep(1)
machine.lightsleep(60_000)

Expected behaviour

LED should go out for 1s every 62s.

Observed behaviour

Keeps blinking in 1s intervals when on battery power (Vsys), disconnected USB. WLAN off.

Additional Information

Same behavior with deepsleep. My work-around is
now = time.time()
wake = now + 60
while now < wake:
machine.lightsleep(60_000)
now = time.time()

but goal was to save power. With this loop it is idling at 0.15W versus 0.2W with time.sleep. Bummer. Is this a limitation of the pico 2 w?
Thanks!

Code of Conduct

Yes, I agree

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied