raspberrypi / pico-extras

BSD 3-Clause "New" or "Revised" License
480 stars 120 forks source link

Update pico_sleep #79

Closed peterharperuk closed 2 weeks ago

peterharperuk commented 3 months ago

Fixed to work for RP2040 and RP2350 using pico_aon_timer.

pspeybro commented 2 months ago

Is there any chance that this update fixes the problem with locking up the pico after repeatedly calling stdio_init_all(); or stdio via USB that stops working after waking up? See this issue for some of the attempts to find a solution: https://github.com/raspberrypi/pico-extras/issues/41

peterharperuk commented 2 weeks ago

I'm going to merge this...

Lecostarius commented 1 week ago

Many thanks for looking into this!! Can anyone confirm that the code is working for the Pico 2 (RP2350)? For me, the examples in pico_playground work nicely for the RP2040 (Pico), but not for the Pico 2 - it does not wake up. I can see however that the current consumption on the Pico 2 drops a lot when put to sleep, so the problem appears to be in the wake up part.

peterharperuk commented 1 week ago

They worked for me! I pushed an update to pico_playground - can you check you have this change?

commit 3b2267d539738a36c054b93fad0715c3b2ee456f Merge: 9930bb0 54e7410 Author: Peter Harper 77111776+peterharperuk@users.noreply.github.com Date: Mon Nov 11 10:29:12 2024 +0000

Merge pull request #48 from peterharperuk/sleep_rp2350

Update pico_sleep examples
Lecostarius commented 6 days ago

OK, just saw your reply a moment ago. I will check it out and let you know. Thanks for the answer!

Lecostarius commented 1 day ago

I think I have used the latest update, but still no luck with pico2. I succeeded with switching it off completely using powman and it wakes up again, which is also solving my problem. I should note that I was using the Arduino IDE for that which most likely is not a good idea.

peterharperuk commented 1 day ago

@Lecostarius There are a few sleep examples, sleep and dormant, are none of them waking up? They should wake up when an interrupt goes off - it's odd that this wouldn't happen. Usually they don't go to sleep.

Lecostarius commented 1 day ago

They work on Pico. On Pico2, no wakeup. I could get the powman based example in pico-examples to work on the Pico2 though - shutdown and wakeup both work.

Probably the problem sits in front of the computer... if I find the time I will write an update here, but for now, I will go with the powman based shutdown.