-
Notifications
You must be signed in to change notification settings - Fork 140
Open
Description
Hi, thanks for providing this library.
I want to use dormant mode to reduce power consumption when not actively processing something. However this has several issues.
When the Pico wakes back up from IRQ it does not restart the clocks that were disabled by sleep_run_from_dormant_source()
I've attempted to re-enable all clocks using the following code, which is based on the recover_from_sleep()
function found here. This article is also useful.
// Save existing clock states
uint scb_orig = scb_hw->scr;
uint clock0_orig = clocks_hw->sleep_en0;
uint clock1_orig = clocks_hw->sleep_en1;
// Go to sleep until we see a low level on SLEEP_PIN
sleep_run_from_xosc();
sleep_goto_dormant_until_pin(SLEEP_PIN, 0, 0);
// Recover from sleep
rosc_write(&rosc_hw->ctrl, ROSC_CTRL_ENABLE_BITS);
scb_hw->scr = scb_orig;
clocks_hw->sleep_en0 = clock0_orig;
clocks_hw->sleep_en1 = clock1_orig;
clocks_init();
stdio_init_all();
While this does get all the clocks back up and running, there are still two issues that I'm aware of:
- The Pico cannot communicate via stdio_usb, only via stdio_uart. If UART is needed for purposes other than stdio this is a problem.
- The Pico can only enter dormant mode a handful of times before crashing/locking up.
I've looked around a bit to verify that I'm not the only one experiencing this issue.
Metadata
Metadata
Assignees
Labels
No labels