Sleep/Lightsleep with Pico 2 #16361
Replies: 4 comments 7 replies
-
What are you trying to do? Verify that lightsleep() is accurate? There have been problems with lightsleep in the past, but I don't know how many of them have been addressed. Incidentally, you can pick up the version/hardware from os.uname():
|
Beta Was this translation helpful? Give feedback.
-
I am successfully using I am doing this to leaving particular clocks (and 'parents') running during I also found issues with UART being functional after a sleep, so I keep the peripheral clock running (I need to update/resubmit the patch for that one). |
Beta Was this translation helpful? Give feedback.
-
I have code that worked great in 1.23 on a Pico ( not 2) and in 1.24 no longer works at all. I am using it to connect to a modem that is in deep sleep and I need to sync the two https://github.com/CrabbyPete/watchible/blob/1a3adbdcdd1f291458ea1193a4a8e1a1a67e1057/software/python/main.py#L756 Did something change? |
Beta Was this translation helpful? Give feedback.
-
I think the work by Carl here can help to figure this out. https://github.com/orgs/micropython/discussions/12573#discussioncomment-11514661 |
Beta Was this translation helpful? Give feedback.
-
Firstly thanks for creating and maintaining Micropython - its a fantastic resource.
Forgive me for opening this as a new issue, and its length, but this matter has been mentioned a lot of times in different ways and I could not find one to reply to that covered it comprehensively. The code below has been run against several Micropython versions as you can see. The key ones here are:
v1.24.1 on 2024-11-29 Raspberry Pi Pico2 with RP2350
v1.25.0-preview.73.g406bccc75 on 2024-12-03; Raspberry Pi Pico2 with RP2350
There seem to be 3 main issues which are causing difficulties.
I have included 1 output file below as an example. If anyone wishes to take this further please reply here.
output file:v1.25.0-preview.73.g406bccc75 on 2024-12-03; Raspberry Pi Pico2 with RP2350
Pass 1: Loop instance with for loops: 0 0
Pass 1: Loop instance with for loops: 1 5
Pass 1: Loop instance with for loops: 2 9
Pass 1: Loop instance with for loops: 3 14
Pass 1: Loop instance with for loops: 4 19
Pass 2: Loop instance with time.sleep and machine.lightsleep 0 23
Pass 2: Loop instance with time.sleep and machine.lightsleep 1 26
Pass 2: Loop instance with time.sleep and machine.lightsleep 2 28
Pass 2: Loop instance with time.sleep and machine.lightsleep 3 31
Pass 2: Loop instance with time.sleep and machine.lightsleep 4 34
Pass 3: Loop instance with machine.lightsleep 0 36
Pass 3: Loop instance with machine.lightsleep 1 36
Pass 3: Loop instance with machine.lightsleep 2 36
Pass 3: Loop instance with machine.lightsleep 3 36
Pass 3: Loop instance with machine.lightsleep 4 36
Pass 4: Loop instance with time.sleep 0 36
Pass 4: Loop instance with time.sleep 1 41
Pass 4: Loop instance with time.sleep 2 46
Pass 4: Loop instance with time.sleep 3 51
Pass 4: Loop instance with time.sleep 4 56
Pass 5: Loop instance with machine.lightsleep 0 61
Pass 5: Loop instance with machine.lightsleep 1 61
Pass 5: Loop instance with machine.lightsleep 2 61
Pass 5: Loop instance with machine.lightsleep 3 61
Pass 5: Loop instance with machine.lightsleep 4 61
Expected run time ~ 124 seconds Actual 115 sec
Beta Was this translation helpful? Give feedback.
All reactions