Datasheet

Table Of Contents
CAUTION
Memories must not be accessed when powered down. Doing so can corrupt memory contents.
When powering a memory back up, a 20 ns delay is required before accessing the memory again.
The XIP cache (see Execute-In-Place) can also be powered down, with CTRL.POWER_DOWN. The XIP hardware will not
generate cache accesses whilst the cache is powered down. Note that this is unlikely to produce a net power savings if
code continues to execute from XIP, due to the comparatively high voltages and switching capacitances of the external
QSPI bus.
2.10.5. Programmer’s Model
2.10.5.1. Sleep
The hello_sleep example, https://github.com/raspberrypi/pico-examples/tree/pre_release/sleep/hello_sleep/hello_sleep.c,
demonstrates sleep mode. The hello_sleep application (and underlying SDK functions) take the following steps:
Run all clocks in the system from XOSC
Configure an alarm in the RTC for 10 seconds in the future
Set clk_rtc as the only clock running in sleep mode using the SLEEP_ENx registers (see SLEEP_EN0)
Enable deep sleep in the processor
Call __wfi on processor which will put the processor into deep sleep until woken by the RTC interrupt
The RTC interrupt clears the alarm and then calls a user supplied callback function
The callback function ends the example application
NOTE
It is necessary to enable deep sleep on both proc0 and proc1 and call __wfi, as well as ensure the DMA is stopped to
enter sleep mode.
hello_sleep makes use of functions in hardware_sleep of the Pico SDK. In particular, sleep_goto_sleep_until puts the
processor to sleep until woken up by an RTC time assumed to be in the future.
Pico SDK: https://github.com/raspberrypi/pico-sdk/tree/pre_release/src/rp2_common/hardware_sleep/sleep.c Lines 105 - 120
105 void sleep_goto_sleep_until(datetime_t *t, rtc_callback_t callback) {
106 // We should have already called the sleep_run_from_dormant_source function
107 assert(dormant_source_valid(_dormant_source));
108
109 // Turn off all clocks when in sleep mode except for RTC
110 clocks_hw->sleep_en0 = CLOCKS_SLEEP_EN0_CLK_RTC_RTC_BITS;
111 clocks_hw->sleep_en1 = 0x0;
112
113 rtc_set_alarm(t, callback);
114
115 // Enable deep sleep at the proc
116 scb_hw->scr = M0PLUS_SCR_SLEEPDEEP_BITS;
117
118 // Go to sleep
119 __wfi();
120 }
RP2040 Datasheet
2.10. Power Control 146