Datasheet

Table Of Contents
2.14.5. Resus
It is possible to write software that inadvertently stops clk_sys. This will normally cause an unrecoverable lock-up of the
cores and the on-chip debugger, leaving the user unable to trace the problem. To mitigate against that, an automatic
resuscitation circuit is provided which will switch clk_sys to a known good clock source if no edges are detected over a
user-defined interval. The known good source is clk_ref which can be driven from the XOSC, ROSC or an external source.
The resus block counts edges on clk_sys during a timeout interval controlled by clk_ref, and forces clk_sys to be driven
from clk_ref if no clk_sys edges are detected. The interval is programmable via CLK_SYS_RESUS_CTRL.
WARNING
There is no way for resus to revive the chip if clk_ref is also stopped.
To enable the resus, the programmer must set the timeout interval and then set the ENABLE bit in CLK_SYS_RESUS_CTRL.
To detect a resus event, the CLK_SYS_RESUS interrupt must be enabled by setting the interrupt enable bit in INTE. The
CLOCKS_DEFAULT_IRQ (see Section 2.3.2) must also be enabled at the processor.
Resus is intended as a debugging aid. The intention is for the user to trace the software error that triggered the resus, then
correct the error and reboot. It is possible to continue running after a resus event by reconfiguring clk_sys then clearing
the resus by writing the CLEAR bit in CLK_SYS_RESUS_CTRL However, it should be noted that a resus can be triggered by
clk_sys running more slowly than expected and that could result in a clk_sys glitch when resus is triggered. That glitch
could corrupt the chip. This would be a rare event but is tolerable in a debugging scenario. However it is unacceptable in
normal operation therefore it is recommended to only use resus for debug.
WARNING
Resus is a debugging aid and should not be used as a means of switching clocks in normal operation.
2.14.6. Programmer’s Model
2.14.6.1. Configuring a clock generator
The Pico SDK defines an enum of clocks:
Pico SDK: https://github.com/raspberrypi/pico-sdk/tree/pre_release/src/rp2040/hardware_structs/include/hardware/structs/clocks.h Lines 18 - 30
18 enum clock_index {
19 clk_gpout0 = 0, ///< GPIO Muxing 0
20 clk_gpout1, ///< GPIO Muxing 1
21 clk_gpout2, ///< GPIO Muxing 2
22 clk_gpout3, ///< GPIO Muxing 3
23 clk_ref, ///< Watchdog and timers reference clock
24 clk_sys, ///< Processors, bus fabric, memory, memory mapped registers
25 clk_peri, ///< Peripheral clock for UART and SPI
26 clk_usb, ///< USB clock
27 clk_adc, ///< ADC clock
28 clk_rtc, ///< Real time clock
29 CLK_COUNT
30 };
And also a struct to describe the registers of a clock generator:
RP2040 Datasheet
2.14. Clocks 168