2.15. Clocks
2.15.1. Overview
The clocks block provides independent clocks to on-chip and external components. It takes inputs from a variety of clock sources allowing the user to trade off performance against cost, board area and power consumption. From these sources it uses multiple clock generators to provide the required clocks. This architecture allows the user flexibility to start and stop clocks independently and to vary some clock frequencies whilst maintaining others at their optimum frequencies.
Figure 28. Clocks overview

For very low cost or low power applications where precise timing is not required, the chip can be run from the internal Ring Oscillator (ROSC). Alternatively the user can provide external clocks or construct simple relaxation oscillators using the GPIOs and appropriate external passive components. Where timing is more critical, the Crystal Oscillator (XOSC) can provide an accurate reference to the 2 on-chip PLLs to provide fast clocking at precise frequencies.
The clock generators select from the clock sources and optionally divide the selected clock before outputting through enable logic which provides automatic clock disabling in SLEEP mode (see Section 2.11.2 ).
An on-chip frequency counter facilitates debugging of the clock setup and also allows measurement of the frequencies of external clocks. The on-chip resus component restarts the system clock from a known good clock if it is accidentally stopped. This allows the software debugger to access registers and debug the problem.
The chip has an ultra-low power mode called DORMANT (see Section 2.11.3 ) in which all on-chip clock sources are stopped to save power. External sources are not stopped and can be used to provide a clock to the on-chip RTC which can provide an alarm to wake the chip from DORMANT mode. Alternatively the GPIO interrupts can be configured to wake the chip from DORMANT mode in response to an external event.
Up to 4 generated clocks can be output to GPIOs at up to 50MHz. This allows the user to supply clocks to external devices, thus reducing component counts in power, space and cost sensitive applications.
2.15.2. Clock sources
The RP2040 can be run from a variety of clock sources. This flexibility allows the user to optimise the clock setup for performance, cost, board area and power consumption. The sources include the on-chip Ring Oscillator ( Section 2.17 ), the Crystal Oscillator ( Section 2.16 ), external clocks from GPIOs ( Section 2.15.6.4 ) and the PLLs ( Section 2.18 ).
The list of clock sources is different per clock generator and can be found as enumerated values in the CTRL register. See
CLK_SYS_CTRL as an example.
2.15.2.1. Ring Oscillator
The on-chip Ring Oscillator ( Section 2.17 ) requires no external components. It runs automatically from power-up and is used to clock the chip during the initial boot stages. The startup frequency is typically 6MHz but varies with PVT (Process, Voltage and Temperature). The frequency is likely to be in the range 4-8MHz and is guaranteed to be in the range 1.8-12MHz.
For low cost applications where frequency accuracy is unimportant, the chip can continue to run from the ROSC. If greater performance is required the frequency can be increased by programming the registers as described in Section 2.17 . The frequency will vary with PVT (Process, Voltage and Temperature) so the user must take care to avoid exceeding the maximum frequencies described in the clock generators section. This variation can be mitigated in various ways (see Section 2.15.2.1.1 ) if the user wants to continue running from the ROSC at a frequency close to the maximum. Alternatively, the user can use an external clock or the XOSC to provide a stable reference clock and use the PLLs to generate higher frequencies. This will require external components, which will cost board area and increase power consumption.
If an external clock or the XOSC is used then the ROSC can be stopped to save power. However, the reference clock generator and the system clock generator must be switched to an alternate source before doing so.
The ROSC is not affected by SLEEP mode. If required the frequency can be reduced before entering SLEEP mode to save power. On entering DORMANT mode the ROSC is automatically stopped and is restarted in the same configuration when exiting DORMANT mode. If the ROSC is driving clocks at close to their maximum frequencies then it is recommended to drop the frequency before entering SLEEP or DORMANT mode to allow for frequency variation due to changes in environmental conditions during SLEEP or DORMANT mode.
If the user wants to use the ROSC clock externally then it can be output to a GPIO pin using one of the clk_gpclk0-3 generators.
The following sections describe techniques for mitigating PVT variation of the ROSC frequency. They also provide some interesting design challenges for use in teaching both the effects of PVT and writing software to control real time functions.
NOTE
The ROSC frequency varies with PVT so the user can send its output to the frequency counter and use it to measure any 1 of these 3 variables if the other 2 are known.
2.15.2.1.1. Mitigating ROSC frequency variation due to process
Process varies for two reasons. Firstly, chips leave the factory with a spread of process parameters which cause variation in the ROSC frequency across chips. Secondly, process parameters vary slightly as the chip ages, though this will only be observable over many thousands of hours of operation. To mitigate for process variation, the user can characterise individual chips and program the ROSC frequency accordingly. This is an adequate solution for small numbers of chips but is not suitable for volume production. In such applications the user should consider using the automatic mitigation techniques described below.
2.15.2.1.2. Mitigating ROSC frequency variation due to voltage
Supply voltage varies for two reasons. Firstly, the power supply itself may vary, and secondly, there will be varying on-chip IR drop as chip activity varies. If the application has a minimum performance target then the user needs to calibrate for that application and adjust the ROSC frequency to ensure it always exceeds the minimum required.
2.15.2.1.3. Mitigating ROSC frequency variation due to temperature
Temperature varies for two reasons. Firstly, the ambient temperature may vary, and secondly, the chip temperature will vary as chip activity varies due to self-heating. This can be mitigated by stabilising the temperature using a temperature
controlled environment and passive or active cooling. Alternatively the user can track the temperature using the on-chip temperature sensor and adjust the ROSC frequency so it remains within the required bounds.
2.15.2.1.4. Automatic mitigation of ROSC frequency variation due to PVT
Techniques for automatic ROSC frequency control avoid the need to calibrate individual chips but require periodic access to a clock reference or to a time reference. If a clock reference is available then it can be used to periodically measure the ROSC frequency and adjust it accordingly. The reference could be the on-chip XOSC which can be turned on periodically for this purpose. This may be useful in a very low power application where it is too costly to run the XOSC continuously and too costly to use the PLLs to achieve high frequencies. If a time reference is available then the user could clock the on-chip RTC from the ROSC and periodically compare it against the time reference, then adjust the ROSC frequency as necessary. Using these techniques the ROSC frequency will drift due to VT variation so the user must take care that these variations do not allow the ROSC frequency to drift out of the acceptable range.
2.15.2.1.5. Automatic overclocking using the ROSC
The datasheet maximum frequencies for any digital device are quoted for worst case PVT. Most chips in most normal environments can run significantly faster than the quoted maximum and can therefore be overclocked. If the RP2040 is running from the ROSC then both the ROSC and the digital components are similarly affected by PVT, so, as the ROSC gets faster, the processors can also run faster. This means the user can overclock from the ROSC then rely on the ROSC frequency tracking with PVT variations. The tracking of ROSC frequency and the processor capability is not perfect and currently there is insufficient data to specify a safe ROSC setting for this mode of operation, so some experimentation is required.
This mode of operation will maximise processor performance but will lead to variations in the time taken to complete a task, which may be unacceptable in some applications. Also, if the user wants to use frequency sensitive interfaces such as USB or UART then the XOSC and PLL must be used to provide a precise clock for those components.
2.15.2.2. Crystal Oscillator
The Crystal Oscillator ( Section 2.16 ) provides a precise, stable clock reference and should be used where accurate timing is required and no suitable external clocks are available. The frequency is determined by the external crystal and the oscillator supports frequencies in the range 1MHz to 15MHz. The on-chip PLLs can be used to synthesise higher frequencies if required. The RP2040 reference design (see the Minimal Design Example in Hardware design with RP2040 ) uses a 12MHz crystal. Using the XOSC and the PLLs, the on-chip components can be run at their maximum frequencies. Appropriate margin is built into the design to tolerate up to 1000ppm variation in the XOSC frequency.
The XOSC is inactive on power up. If required it must be enabled in software. XOSC startup takes several milliseconds and the software must wait for the XOSC_STABLE flag to be set before starting the PLLs and before changing any clock generators to use it. Prior to that the output from the XOSC may be non-existent or may have very short pulse widths which will corrupt logic if used. Once it is running the reference clock (clk_ref) and the system clock (clk_sys) can be switched to run from the XOSC and the ROSC can be stopped to save power.
The XOSC is not affected by SLEEP mode. It is automatically stopped and restarted in the same configuration when entering and exiting DORMANT mode.
If the user wants to use the XOSC clock externally then it can be output to a GPIO pin using one of the clk_gpclk0-3 generators. It cannot be taken directly from the XIN or XOUT pins.
2.15.2.3. External Clocks
If external clocks exist in your hardware design then they can be used to clock the RP2040 either on their own or in conjunction with the XOSC or ROSC. This will potentially save power and will allow components on the RP2040 to be run synchronously with external components to simplify data transfer between chips. External clocks can be input on the
GPIN0 & GPIN1 GPIO inputs and on the XIN input to the XOSC. If the XIN input is used in this way the XOSC must be configured to pass through the XIN signal. All 3 inputs are limited to 50MHz but the on-chip PLLs can be used to synthesise higher frequencies from the XIN input if required. If the frequency accuracy of the external clocks is poorer than 1000ppm then the generated clocks should not be run at their maximum frequencies because they may exceed their design margins.
Once the external clocks are running, the reference clock (clk_ref) and the system clock (clk_sys) can be switched to run from the external clocks and the ROSC can be stopped to save power.
The external clock sources are not affected by SLEEP mode or DORMANT mode.
2.15.2.4. Relaxation Oscillators
If the user wants to use external clocks to replace or supplement the other clock sources but does not have an appropriate clock available, then 1 or 2 relaxation oscillators can be constructed using external passive components. Simply send the clock source (GPIN0 or GPIN1) to one of the gpclk0-3 generators, invert it through the GPIO inverter OUTOVER and connect back to the clock source input via an RC circuit.
Figure 29. Simple relaxation oscillator example

The frequency of clocks generated from relaxation oscillators will depend on the delay through the chip and the drive current from the GPIO output both of which vary with PVT. They will also depend on the quality and accuracy of the external components. It may be possible to improve the frequency accuracy using more elaborate external components such as ceramic resonators but that will increase cost and complexity and can never rival the XOSC. For that reason they are not discussed here. Given that these oscillators will not achieve 1000ppm then they cannot be used to drive internal clocks at their maximum frequencies.
The relaxation oscillators are not affected by SLEEP mode or DORMANT mode.
2.15.2.5. PLLs
The PLLs ( Section 2.18 ) are used to provide fast clocks when running from the XOSC (or an external clock source driven into the XIN pin). In a fully featured application the USB PLL provides a fixed 48MHz clock to the ADC and USB while clk_rtc and clk_ref are driven from the XOSC or external source. This allows the user to drive clk_sys from the system PLL and vary the frequency according to demand to save power without having to change the setups of the other clocks. clk_peri can be driven either from the fixed frequency USB PLL or from the variable frequency system PLL. If clk_sys never needs to exceed 48MHz then one PLL can be used and the divider in the clk_sys clock generator can be used to scale the clk_sys frequency according to demand.
When a PLL is started, its output cannot be used until the PLL locks as indicated by the LOCK bit in the STATUS register. Thereafter the PLL output cannot be used during changes to the reference clock divider, the output dividers or the bypass mode. The output can be used during feedback divisor changes with the proviso that the output frequency may overshoot or undershoot on large changes to the feedback divisor. For more information, see Section 2.18 .
If the PLL reference clock is accurate to 1000ppm then the PLLs can be used to drive clocks at their maximum frequency because the frequency of the generated clocks will be within the margins allowed in the design.
The PLLs are not affected by SLEEP mode. If the user wants to save power in SLEEP mode then all clock generators must be switched away from the PLLs and they must be stopped in software before entering SLEEP mode. The PLLs are not stopped and restarted automatically when entering and exiting DORMANT mode. If they are left running on entry to DORMANT mode they will be corrupted and will generate out of control clocks that will consume power unnecessarily. This happens because their reference clock from XOSC will be stopped. It is therefore essential to switch all clock generators away from the PLLs and stop the PLLs in software before entering DORMANT mode.
2.15.3. Clock Generators
The clock generators are built on a standard design which incorporates clock source multiplexing, division, duty cycle correction and SLEEP mode enabling. To save chip area and power, the individual clock generators do not support all features.
Figure 30. A generic clock generator

graph LR
CS[clock sources] --> MUX[multiplexer]
MUX --> G[Glitchless]
G --> D[Divider]
DE[Divider enable] --> D
D --> DCC[Duty cycle correction]
DCC --> WSE[Wake and Sleep enable]
WSE --> GC[Generated clock]2.15.3.1. Instances
RP2040 has several clock generators which are listed below.
Table 205. RP2040 clock generators
| Clock | Description | Nominal Frequency |
|---|---|---|
| clk_gpout0 | Clock output to GPIO. Can be used to clock external devices or debug on chip clocks with a logic analyser or oscilloscope. | N/A |
| clk_gpout1 | ||
| clk_gpout2 | ||
| clk_gpout3 | ||
| clk_ref | Reference clock that is always running unless in DORMANT mode. Runs from Ring Oscillator (ROSC) at power-up but can be switched to Crystal Oscillator (XOSC) for more accuracy. | 6 - 12MHz |
| clk_sys | System clock that is always running unless in DORMANT mode. Runs from clk_ref at power-up but is typically switched to a PLL. | 125MHz |
| clk_peri | Peripheral clock. Typically runs from clk_sys but allows peripherals to run at a consistent speed if clk_sys is changed by software. | 12 - 125MHz |
| clk_usb | USB reference clock. Must be 48MHz. | 48MHz |
| clk_adc | ADC reference clock. Must be 48MHz. | 48MHz |
| clk_rtc | RTC reference clock. The RTC divides this clock to generate a 1 second reference. | 46875Hz |
i NOTE
clk_sys (and clk_peri ) have a maximum frequency of 133MHz across all process, voltage and temperature variations. You can achieve 200MHz by running at an elevated core supply (DVDD) and setting VREG VSEL to 1.15V. For more information, see Section 2.10.6 .
For a full list of clock sources for each clock generator see the appropriate CTRL register. For example, CLK_SYS_CTRL .
2.15.3.2. Multiplexers
All clock generators have a multiplexer referred to as the auxiliary (aux) mux. This mux has a conventional design whose output will glitch when changing the select control. Two clock generators (
clk_sys and
clk_ref) have an additional multiplexer, referred to as the glitchless mux. The glitchless mux can switch between clock sources without generating a glitch on the output.
Clock glitches should be avoided at all costs because they may corrupt the logic running on that clock. This means that any clock generator with only an aux mux must be disabled while switching the clock source. If the clock generator has a glitchless mux (
clk_sys and
clk_ref), then the glitchless mux should switch away from the aux mux while changing the aux mux source. The clock generators require 2 cycles of the source clock to stop the output and 2 cycles of the new source to restart the output. The user must wait for the generator to stop before changing the auxiliary mux, and therefore must be aware of the source clock frequency.
The glitchless mux is only implemented for always-on clocks. On RP2040 the always-on clocks are the reference clock (
clk_ref) and the system clock (
clk_sys). Such clocks must run continuously unless the chip is in DORMANT mode. The glitchless mux has a status output (SELECTED) which indicates which source is selected and can be read from software to confirm that a change of clock source has been completed.
The recommended control sequences are as follows.
To switch the glitchless mux:
- • switch the glitchless mux to an alternate source
- • poll the SELECTED register until the switch is completed
To switch the auxiliary mux when the generator has a glitchless mux:
- • switch the glitchless mux to a source that isn't the aux mux
- • poll the SELECTED register until the switch is completed
- • change the auxiliary mux select control
- • switch the glitchless mux back to the aux mux
- • if required, poll the SELECTED register until the switch is completed
To switch the auxiliary mux when the generator does not have a glitchless mux:
- • disable the clock divider
- • wait for the generated clock to stop (2 cycles of the clock source)
- • change the auxiliary mux select control
- • enable the clock divider
- • if required, wait for the clock generator to restart (2 cycles of the clock source)
See Section 2.15.6.1 for a code example of this.
2.15.3.3. Divider
A fully featured divider divides by 1 or a fractional number in the range 2.0 to \( 2^{24} \cdot 0.01 \) . Fractional division is achieved by toggling between 2 integer divisors therefore it yields a jittery clock which may not be suitable for some applications. For example, when dividing by 2.4 the divider will divide by 2 for 3 cycles and by 3 for 2 cycles. For divisors with large integer components the jitter will be much smaller and less critical.
Figure 31. An example of fractional division.

A timing diagram illustrating fractional division. It shows a 'Clock source' as a regular square wave. Below it, the 'Generated clock' is shown as a square wave that changes its period. Horizontal arrows indicate the division factors: 'Divide by 2' for the first segment, 'Divide by 3' for the second segment, and 'Divide by 2.4' for the third segment. The generated clock's period increases when the divisor increases and decreases when the divisor decreases.
All dividers support on-the-fly divisor changes meaning the output clock will switch cleanly from one divisor to another. The clock generator does not need to be stopped during clock divisor changes. It does this by synchronising the divisor change to the end of the clock cycle. Similarly, the enable is synchronised to the end of the clock cycle so will not generate glitches when the clock generator is enabled or disabled. Clock generators for always-on clocks are permanently enabled and therefore do not have an enable control.
In the event that a clock generator locks up and never completes the current clock cycle it can be forced to stop using the KILL control. This may result in an output glitch which may corrupt the logic driven by the clock. It is therefore recommended the destination logic is reset prior to this operation. It is worth mentioning that this clock generator design has been used in numerous chips and has never been known to lock up. The KILL control is inelegant and unnecessary and should not be used as an alternative to the enable. Clock generators for always-on clocks are permanently active and therefore do not have a KILL control.
2.15.3.4. Duty Cycle Correction
The divider operates on the rising edge of the input clock and so does not generate an even duty cycle clock when dividing by odd numbers.
Divide by 3 will give a duty cycle of 33.3%, divide by 5 will be 40% etc. If enabled, the duty cycle correction logic will shift the falling edge of the output clock to the falling edge of the input clock and restore a 50% duty cycle. The duty cycle correction can be enabled and disabled while the clock is running. It will not operate when dividing by an even number.
Figure 32. An example of duty_cycle_correction.

A timing diagram illustrating duty cycle correction. It shows three waveforms: 'Clock source' (a regular square wave), 'Generated clock without DCC' (a square wave with a duty cycle less than 50%), and 'Generated clock with DCC' (a square wave with a 50% duty cycle). The 'Generated clock with DCC' waveform is shifted so that its falling edges align with the falling edges of the 'Clock source'.
2.15.3.5. Clock Enables
Each clock goes to multiple destinations and, with a few exceptions, there are 2 enables for each destination. The
WAKE_EN registers are used to enable the clocks when the system is awake and the
SLEEP_EN registers are used to enable the clocks when the system is in sleep mode. The purpose of these enables is to reduce power in the clock distribution networks for components that are not being used. It is worth noting that a component which is not clocked will retain its configuration so can be restarted quickly.
NOTE
The
WAKE_EN and
SLEEP_EN registers reset to
0x1, which means that by default all clocks are enabled. The programmer only needs to use this feature if they desire a low-power design.
2.15.3.5.1. Clock Enable Exceptions
The processor cores do not have clock enables because they require a clock at all times to manage their own power saving features.
clk_sys_busfabric cannot be disabled in wake mode because that would prevent the cores from accessing any chip registers, including those that control the clock enables.
clk_sys_clocks does not have a wake mode enable because disabling it would prevent the cores from accessing the clocks control registers.
The gpclks do not have clock enables.
2.15.3.5.2. System Sleep Mode
System sleep mode is entered automatically when both cores are in sleep and the DMA has no outstanding transactions. In system sleep mode, the clock enables described in the previous paragraphs are switched from the
WAKE_EN registers to the
SLEEP_EN registers. The intention is to reduce power consumed in the clock distribution networks when the chip is inactive. If the user has not configured the
WAKE_EN and
SLEEP_EN registers then system sleep will do nothing.
There is little value in using system sleep without taking other measures to reduce power before the cores are put to sleep. Things to consider include:
- • stop unused clock sources such as the PLLs and Crystal Oscillator
- • reduce the frequencies of generated clocks by increasing the clock divisors
- • stop external clocks
For maximum power saving when the chip is inactive, the user should consider DORMANT (see Section 2.11.3 ) mode in which clocks are sourced from the Crystal Oscillator and/or the Ring Oscillator and those clock sources are stopped.
2.15.4. Frequency Counter
The frequency counter measures the frequency of internal and external clocks by counting the clock edges seen over a test interval. The interval is defined by counting cycles of
clk_ref which must be driven either from XOSC or from a stable external source of known frequency.
The user can pick between accuracy and test time using the
FC0_INTERVAL register.
Table 206
shows the trade off.
Table 206. Frequency Counter Test Interval vs Accuracy
| Interval Register | Test Interval | Accuracy |
|---|---|---|
| 0 | 1µs | 2048kHz |
| 1 | 2µs | 1024kHz |
| 2 | 4µs | 512kHz |
| 3 | 8µs | 256kHz |
| 4 | 16µs | 128kHz |
| 5 | 32µs | 64kHz |
| 6 | 64µs | 32kHz |
| 7 | 125µs | 16kHz |
| 8 | 250µs | 8kHz |
| 9 | 500µs | 4kHz |
| 10 | 1ms | 2kHz |
| 11 | 2ms | 1kHz |
| 12 | 4ms | 500Hz |
| 13 | 8ms | 250Hz |
| Interval Register | Test Interval | Accuracy |
|---|---|---|
| 14 | 16ms | 125Hz |
| 15 | 32ms | 62.5Hz |
2.15.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.15.6. Programmer's Model
2.15.6.1. Configuring a clock generator
The SDK defines an enum of clocks:
SDK: https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2040/hardware_structs/include/hardware/structs/clocks.h Lines 30 - 42
30 typedef enum clock_num_rp2040 {
31 clk_gpout0 = 0, ///< Select CLK_GPOUT0 as clock source
32 clk_gpout1 = 1, ///< Select CLK_GPOUT1 as clock source
33 clk_gpout2 = 2, ///< Select CLK_GPOUT2 as clock source
34 clk_gpout3 = 3, ///< Select CLK_GPOUT3 as clock source
35 clk_ref = 4, ///< Select CLK_REF as clock source
36 clk_sys = 5, ///< Select CLK_SYS as clock source
37 clk_peri = 6, ///< Select CLK_PERI as clock source
38 clk_usb = 7, ///< Select CLK_USB as clock source
39 clk_adc = 8, ///< Select CLK_ADC as clock source
40 clk_rtc = 9, ///< Select CLK_RTC as clock source
41 CLK_COUNT
42 } clock_num_t;
And also a struct to describe the registers of a clock generator:
SDK: https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2040/hardware_structs/include/hardware/structs/clocks.h Lines 100 - 121
100 typedef struct {
101 _REG_(CLOCKS_CLK_GPOUT0_CTRL_OFFSET) // CLOCKS_CLK_GPOUT0_CTRL
102 // Clock control, can be changed on-the-fly (except for auxsrc)
103 // 0x00100000 [20] NUDGE (0) An edge on this signal shifts the phase of the
output by...
104 // 0x00030000 [17:16] PHASE (0x0) This delays the enable signal by up to 3 cycles
of the...
105 // 0x00001000 [12] DC50 (0) Enables duty cycle correction for odd divisors
106 // 0x00000800 [11] ENABLE (0) Starts and stops the clock generator cleanly
107 // 0x00000400 [10] KILL (0) Asynchronously kills the clock generator
108 // 0x000001e0 [8:5] AUXSRC (0x0) Selects the auxiliary clock source, will glitch
when switching
109 io_rw_32 ctrl;
110
111 _REG_(CLOCKS_CLK_GPOUT0_DIV_OFFSET) // CLOCKS_CLK_GPOUT0_DIV
112 // Clock divisor, can be changed on-the-fly
113 // 0xffffffff00 [31:8] INT (0x000001) Integer component of the divisor, 0 ->
divide by 2^16
114 // 0x000000ff [7:0] FRAC (0x00) Fractional component of the divisor
115 io_rw_32 div;
116
117 _REG_(CLOCKS_CLK_GPOUT0_SELECTED_OFFSET) // CLOCKS_CLK_GPOUT0_SELECTED
118 // Indicates which SRC is currently selected by the glitchless mux (one-hot)
119 // 0xffffffff [31:0] CLK_GPOUT0_SELECTED (0x00000001) This slice does not have a
glitchless mux (only the...
120 io_ro_32 selected;
121 } clock_hw_t;To configure a clock, we need to know the following pieces of information:
- • The frequency of the clock source
- • The mux / aux mux position of the clock source
- • The desired output frequency
The SDK provides
clock_configure to configure a clock:
SDK: https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/hardware_clocks/clocks.c Lines 40 - 133
40 static void clock_configure_internal(clock_handle_t clock, uint32_t src, uint32_t auxsrc,
uint32_t actual_freq, uint32_t div) {
41 clock_hw_t *clock_hw = &clocks_hw->clk[clock];
42
43 // If increasing divisor, set divisor before source. Otherwise set source
44 // before divisor. This avoids a momentary overspeed when e.g. switching
45 // to a faster source and increasing divisor to compensate.
46 if (div > clock_hw->div)
47 clock_hw->div = div;
48
49 // If switching a glitchless slice (ref or sys) to an aux source, switch
50 // away from aux *first* to avoid passing glitches when changing aux mux.
51 // Assume (!!!) glitchless source 0 is no faster than the aux source.
52 if (has_glitchless_mux(clock) && src ==
CLOCKS_CLK_SYS_CTRL_SRC_VALUE_CLKSRC_CLK_SYS_AUX) {
53 hw_clear_bits(&clock_hw->ctrl, CLOCKS_CLK_REF_CTRL_SRC_BITS);
54 while (!(clock_hw->selected & 1u))
55 tight_loop_contents();
56 }
57 // If no glitchless mux, cleanly stop the clock to avoid glitches
58 // propagating when changing aux mux. Note it would be a really bad idea
59 // to do this on one of the glitchless clocks (clk_sys, clk_ref).
60 else {
61 // Disable clock. On clk_ref and clk_sys this does nothing,
62 // all other clocks have the ENABLE bit in the same position.
63 hw_clear_bits(&clock_hw->ctrl, CLOCKS_CLK_GPOUT0_CTRL_ENABLE_BITS);
64 if (configured_freq[clock] > 0) {
65 // Delay for 3 cycles of the target clock, for ENABLE propagation.
66 // Note XOSC_COUNT is not helpful here because XOSC is not
67 // necessarily running, nor is timer...
68 uint delay_cyc = configured_freq[clk_sys] / configured_freq[clock] + 1;
69 busy_wait_at_least_cycles(delay_cyc * 3);
70 }
71 }
72
73 // Set aux mux first, and then glitchless mux if this clock has one
74 hw_write_masked(&clock_hw->ctrl,
75 (auxsrc << CLOCKS_CLK_SYS_CTRL_AUXSRC_LSB),
76 CLOCKS_CLK_SYS_CTRL_AUXSRC_BITS
77 );
78
79 if (has_glitchless_mux(clock)) {
80 hw_write_masked(&clock_hw->ctrl,
81 src << CLOCKS_CLK_REF_CTRL_SRC_LSB,
82 CLOCKS_CLK_REF_CTRL_SRC_BITS
83 );
84 while (!(clock_hw->selected & (1u << src)))
85 tight_loop_contents();
86 }
87
88 // Enable clock. On clk_ref and clk_sys this does nothing,
89 // all other clocks have the ENABLE bit in the same position.
90 hw_set_bits(&clock_hw->ctrl, CLOCKS_CLK_GPOUT0_CTRL_ENABLE_BITS);
91
92 // Now that the source is configured, we can trust that the user-supplied
93 // divisor is a safe value.
94 clock_hw->div = div;
95 configured_freq[clock] = actual_freq;
96 }
97
98 bool clock_configure(clock_handle_t clock, uint32_t src, uint32_t auxsrc, uint32_t src_freq,
99 uint32_t freq) {
100 assert(src_freq >= freq);
101
102 if (freq > src_freq)
103 return false;
104
105 uint64_t div64 = (((uint64_t) src_freq) << CLOCKS_CLK_GPOUT0_DIV_INT_LSB) / freq;
106 uint32_t div, actual_freq;
107 if (div64 >> 32) {
108 // set div to 0 for maximum clock divider
109 div = 0;
110 actual_freq = src_freq >> (32 - CLOCKS_CLK_GPOUT0_DIV_INT_LSB);
111 } else {
112 div = (uint32_t) div64;
113 // on RP2040 only clock divider of 1, or >= 2 are supported
114 if (div < (2u << CLOCKS_CLK_GPOUT0_DIV_INT_LSB)) {
115 div = (1u << CLOCKS_CLK_GPOUT0_DIV_INT_LSB);
116 }
117 actual_freq = (uint32_t) (((uint64_t) src_freq) << CLOCKS_CLK_GPOUT0_DIV_INT_LSB) /
div);
117 }
118
119 clock_configure_internal(clock, src, auxsrc, actual_freq, div);
120 // Store the configured frequency
121 return true;
122 }
123
124 void clock_configure_int_divider(clock_handle_t clock, uint32_t src, uint32_t auxsrc,
uint32_t src_freq, uint32_t int_divider) {
125 clock_configure_internal(clock, src, auxsrc, src_freq / int_divider, int_divider <<
CLOCKS_CLK_GPOUT0_DIV_INT_LSB);
126 }
127
128 void clock_configure_undivided(clock_handle_t clock, uint32_t src, uint32_t auxsrc, uint32_t
src_freq) {
129 clock_configure_internal(clock, src, auxsrc, src_freq, 1u <<
CLOCKS_CLK_GPOUT0_DIV_INT_LSB);
130 }
It is called in
clocks_init for each clock. The following example shows the
clk_sys configuration:
SDK: https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/pico_runtime_init/runtime_init_clocks.c Lines 100 - 104
100 // CLK SYS = PLL SYS (usually) 125MHz / 1 = 125MHz 101 clock_configure_undivided(clk_sys, 102 CLOCKS_CLK_SYS_CTRL_SRC_VALUE_CLKSRC_CLK_SYS_AUX, 103 CLOCKS_CLK_SYS_CTRL_AUXSRC_VALUE_CLKSRC_PLL_SYS, 104 SYS_CLK_HZ);
Once a clock is configured,
clock_get_hz can be called to get the output frequency in Hz.
SDK: https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/hardware_clocks/clocks.c Lines 137 - 139
137 uint32_t clock_get_hz(clock_handle_t clock) {
138 return configured_freq[clock];
139 }
⚠ WARNING
It is assumed the source frequency the programmer provides is correct. If it is not then the frequency returned by
clock_get_hz will be inaccurate.
2.15.6.2. Using the frequency counter
To use the frequency counter, the programmer must:
- • Set the reference frequency:
clk_ref - • Set the mux position of the source they want to measure. See FC0_SRC
- • Wait for the
DONEstatus bit in FC0_STATUS to be set - • Read the result
The SDK defines a
frequency_count function which takes the source as an argument and returns the frequency in kHz:
SDK: https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/hardware_clocks/clocks.c Lines 147 - 174
147 uint32_t frequency_count_khz(uint src) {
148 fc_hw_t *fc = &clocks_hw->fc0;
149
150 // If frequency counter is running need to wait for it. It runs even if the source is NULL
151 while(fc->status & CLOCKS_FC0_STATUS_RUNNING_BITS) {
152 tight_loop_contents();
153 }
154
155 // Set reference freq
156 fc->ref_khz = clock_get_hz(clk_ref) / 1000;
157
158 // FIXME: Don't pick random interval. Use best interval
159 fc->interval = 10;
160
161 // No min or max
162 fc->min_khz = 0;
163 fc->max_khz = 0xffffffff;
164
165 // Set SRC which automatically starts the measurement
166 fc->src = src;
167
168 while(!(fc->status & CLOCKS_FC0_STATUS_DONE_BITS)) {
169 tight_loop_contents();
170 }
171
172 // Return the result
173 return fc->result >> CLOCKS_FC0_RESULT_KHZ_LSB;
174 }
There is also a wrapper function to change the unit to MHz:
SDK: https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/hardware_clocks/include/hardware/clocks.h Lines 377 - 379
377 static inline float frequency_count_mhz(uint src) {
378 return ((float) (frequency_count_khz(src))) / KHZ;
379 }
i NOTE
The frequency counter can also be used in a test mode. This allows the hardware to check if the frequency is within a minimum frequency and a maximum frequency, set in FC0_MIN_KHZ and FC0_MAX_KHZ . In this mode, the PASS bit in FC0_STATUS will be set when DONE is set if the frequency is within the specified range. Otherwise, either the FAST or SLOW bit will be set.
If the programmer attempts to count a stopped clock, or the clock stops running then the DIED bit will be set. If any of DIED , FAST , or SLOW are set then FAIL will be set.
2.15.6.3. Configuring a GPIO output clock
SDK: https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/hardware_clocks/clocks.c Lines 245 - 276
245 void clock_gpio_init_int_frac16(uint gpio, uint src, uint32_t div_int, uint16_t div_frac16)
246 {
247 // Bit messy but it's as much code to loop through a lookup
248 // table. The sources for each gpout generators are the same
248 // so just call with the sources from GP0
249 uint gpclk = 0;
250 if (gpio == 21) gpclk = clk_gpout0;
251 else if (gpio == 23) gpclk = clk_gpout1;
252 else if (gpio == 24) gpclk = clk_gpout2;
253 else if (gpio == 25) gpclk = clk_gpout3;
254 else {
255 invalid_params_if(HARDWARE_CLOCKS, true);
256 }
257
258 invalid_params_if(HARDWARE_CLOCKS, div_int >> REG_FIELD_WIDTH(
CLOCKS_CLK_GPOUT0_DIV_INT));
259 // Set up the gpclk generator
260 clocks_hw->clk[gpclk].ctrl = (src << CLOCKS_CLK_GPOUT0_CTRL_AUXSRC_LSB) |
261 CLOCKS_CLK_GPOUT0_CTRL_ENABLE_BITS;
262 #ifdef REG_FIELD_WIDTH(CLOCKS_CLK_GPOUT0_DIV_FRAC) == 16
263 clocks_hw->clk[gpclk].div = (div_int << CLOCKS_CLK_GPOUT0_DIV_INT_LSB) | (div_frac16 <<
CLOCKS_CLK_GPOUT0_DIV_FRAC_LSB);
264 #elif REG_FIELD_WIDTH(CLOCKS_CLK_GPOUT0_DIV_FRAC) == 8
265 clocks_hw->clk[gpclk].div = (div_int << CLOCKS_CLK_GPOUT0_DIV_INT_LSB) | ((div_frac16
>> 8u) << CLOCKS_CLK_GPOUT0_DIV_FRAC_LSB);
266 #else
267 #error unsupported number of fractional bits
268 #endif
269
270 // Set gpio pin to gpclock function
271 gpio_set_function(gpio, GPIO_FUNC_GPCK);
272 }
2.15.6.4. Configuring a GPIO input clock
SDK: https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2-common/hardware_clocks/clocks.c Lines 313 - 343
313 bool clock_configure_gpin(clock_handle_t clock, uint gpio, uint32_t src_freq, uint32_t freq)
314 {
315 // Configure a clock to run from a GPIO input
316 uint gpin = 0;
317 if (gpio == 20) gpin = 0;
318 else if (gpio == 22) gpin = 1;
319 else {
320 invalid_params_if(HARDWARE_CLOCKS, true);
321 }
322
323 // Work out sources. GPIN is always an auxsrc
324 uint src = 0;
325
326 // GPIN1 == GPIN0 + 1
327 uint auxsrc = gpin0_src[clock] + gpin;
328
329 if (has_glitchless_mux(clock)) {
330 // AUX src is always 1
331 src = 1;
332 }
333
334 // Set the GPIO function
335 gpio_set_function(gpio, GPIO_FUNC_GPCK);
336
337 // Now we have the src, auxsrc, and configured the gpio input
338 // call clock configure to run the clock from a gpio
339 return clock_configure(clock, src, auxsrc, src_freq, freq);
339 }
2.15.6.5. Enabling resus
SDK: https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/hardware_clocks/clocks.c Lines 221 - 243
221 void clocks_enable_resus(resus_callback_t resus_callback) {
222 // Restart clk_sys if it is stopped by forcing it
223 // to the default source of clk_ref. If clk_ref stops running this will
224 // not work.
225
226 // Store user's resus callback
227 _resus_callback = resus_callback;
228
229 irq_set_exclusive_handler(CLOCKS_IRQ, clocks_irq_handler);
230
231 // Enable the resus interrupt in clocks
232 clocks_hw->inte = CLOCKS_INTE_CLK_SYS_RESUS_BITS;
233
234 // Enable the clocks irq
235 irq_set_enabled(CLOCKS_IRQ, true);
236
237 // 2 * clk_ref freq / clk_sys_min_freq;
238 // assume clk_ref is 3MHz and we want clk_sys to be no lower than 1MHz
239 uint timeout = 2 * 3 * 1;
240
241 // Enable resus with the maximum timeout
242 clocks_hw->resus.ctrl = CLOCKS_CLK_SYS_RESUS_CTRL_ENABLE_BITS | timeout;
243 }2.15.6.6. Configuring sleep mode
Sleep mode is active when neither processor core or the DMA are requesting clocks. For example, the DMA is not active and both
core0
and
core1
are waiting for an interrupt. The
SLEEP_EN
registers set what clocks are running in sleep mode. The
hello_sleep example (
https://github.com/raspberrypi/pico-playground/blob/master/sleep/hello_sleep/hello_sleep_aon.c
) illustrates how to put the chip to sleep until the RTC fires. In this case, only the RTC clock is enabled in the
SLEEP_EN0
register.
i NOTE
clk_sys is always sent to
proc0 and
proc1 during sleep mode as some logic needs to be clocked for the processor to wake up again.
Pico Extras: https://github.com/raspberrypi/pico-extras/blob/master/src/rp2_common/pico_sleep/sleep.c Lines 159 - 183
159 void sleep_goto_sleep_until(struct timespec *ts, aon_timer_alarm_handler_t callback)
160 {
161
162 // We should have already called the sleep_run_from_dormant_source function
163 // This is only needed for dormancy although it saves power running from xosc while
164 // sleeping
165 //assert(dormant_source_valid(_dormant_source));
166
167 clocks_hw->sleep_en0 = CLOCKS_SLEEP_EN0_CLK_RTC_RTC_BITS;
168 clocks_hw->sleep_en1 = 0x0;168 169 aon_timer_enable_alarm(ts, callback, false); 170 171 stdio_flush(); 172 173 // Enable deep sleep at the proc 174 processor_deep_sleep(); 175 176 // Go to sleep 177 __wfi(); 178 }
2.15.7. List of Registers
The Clocks registers start at a base address of
0x40008000(defined as
CLOCKS_BASE in SDK).
Table 207. List of CLOCKS registers
| Offset | Name | Info |
|---|---|---|
| 0x00 | CLK_GPOUT0_CTRL | Clock control, can be changed on-the-fly (except for auxsrc) |
| 0x04 | CLK_GPOUT0_DIV | Clock divisor, can be changed on-the-fly |
| 0x08 | CLK_GPOUT0_SELECTED | Indicates which SRC is currently selected by the glitchless mux (one-hot). |
| 0x0c | CLK_GPOUT1_CTRL | Clock control, can be changed on-the-fly (except for auxsrc) |
| 0x10 | CLK_GPOUT1_DIV | Clock divisor, can be changed on-the-fly |
| 0x14 | CLK_GPOUT1_SELECTED | Indicates which SRC is currently selected by the glitchless mux (one-hot). |
| 0x18 | CLK_GPOUT2_CTRL | Clock control, can be changed on-the-fly (except for auxsrc) |
| 0x1c | CLK_GPOUT2_DIV | Clock divisor, can be changed on-the-fly |
| 0x20 | CLK_GPOUT2_SELECTED | Indicates which SRC is currently selected by the glitchless mux (one-hot). |
| 0x24 | CLK_GPOUT3_CTRL | Clock control, can be changed on-the-fly (except for auxsrc) |
| 0x28 | CLK_GPOUT3_DIV | Clock divisor, can be changed on-the-fly |
| 0x2c | CLK_GPOUT3_SELECTED | Indicates which SRC is currently selected by the glitchless mux (one-hot). |
| 0x30 | CLK_REF_CTRL | Clock control, can be changed on-the-fly (except for auxsrc) |
| 0x34 | CLK_REF_DIV | Clock divisor, can be changed on-the-fly |
| 0x38 | CLK_REF_SELECTED | Indicates which SRC is currently selected by the glitchless mux (one-hot). |
| 0x3c | CLK_SYS_CTRL | Clock control, can be changed on-the-fly (except for auxsrc) |
| 0x40 | CLK_SYS_DIV | Clock divisor, can be changed on-the-fly |
| 0x44 | CLK_SYS_SELECTED | Indicates which SRC is currently selected by the glitchless mux (one-hot). |
| 0x48 | CLK_PERI_CTRL | Clock control, can be changed on-the-fly (except for auxsrc) |
| 0x50 | CLK_PERI_SELECTED | Indicates which SRC is currently selected by the glitchless mux (one-hot). |
| Offset | Name | Info |
|---|---|---|
| 0x54 | CLK_USB_CTRL | Clock control, can be changed on-the-fly (except for auxsrc) |
| 0x58 | CLK_USB_DIV | Clock divisor, can be changed on-the-fly |
| 0x5c | CLK_USB_SELECTED | Indicates which SRC is currently selected by the glitchless mux (one-hot). |
| 0x60 | CLK_ADC_CTRL | Clock control, can be changed on-the-fly (except for auxsrc) |
| 0x64 | CLK_ADC_DIV | Clock divisor, can be changed on-the-fly |
| 0x68 | CLK_ADC_SELECTED | Indicates which SRC is currently selected by the glitchless mux (one-hot). |
| 0x6c | CLK_RTC_CTRL | Clock control, can be changed on-the-fly (except for auxsrc) |
| 0x70 | CLK_RTC_DIV | Clock divisor, can be changed on-the-fly |
| 0x74 | CLK_RTC_SELECTED | Indicates which SRC is currently selected by the glitchless mux (one-hot). |
| 0x78 | CLK_SYS_RESUS_CTRL | |
| 0x7c | CLK_SYS_RESUS_STATUS | |
| 0x80 | FC0_REF_KHZ | Reference clock frequency in kHz |
| 0x84 | FC0_MIN_KHZ | Minimum pass frequency in kHz. This is optional. Set to 0 if you are not using the pass/fail flags |
| 0x88 | FC0_MAX_KHZ | Maximum pass frequency in kHz. This is optional. Set to 0x1fffff if you are not using the pass/fail flags |
| 0x8c | FC0_DELAY | Delays the start of frequency counting to allow the mux to settle Delay is measured in multiples of the reference clock period |
| 0x90 | FC0_INTERVAL | The test interval is
\(
0.98\mu s * 2^{**}interval
\)
, but let's call it
\(
1\mu s * 2^{**}interval
\) The default gives a test interval of 250us |
| 0x94 | FC0_SRC | Clock sent to frequency counter, set to 0 when not required Writing to this register initiates the frequency count |
| 0x98 | FC0_STATUS | Frequency counter status |
| 0x9c | FC0_RESULT | Result of frequency measurement, only valid when status_done=1 |
| 0xa0 | WAKE_EN0 | enable clock in wake mode |
| 0xa4 | WAKE_EN1 | enable clock in wake mode |
| 0xa8 | SLEEP_EN0 | enable clock in sleep mode |
| 0xac | SLEEP_EN1 | enable clock in sleep mode |
| 0xb0 | ENABLED0 | indicates the state of the clock enable |
| 0xb4 | ENABLED1 | indicates the state of the clock enable |
| 0xb8 | INTR | Raw Interrupts |
| 0xbc | INTE | Interrupt Enable |
| 0xc0 | INTF | Interrupt Force |
| 0xc4 | INTS | Interrupt status after masking & forcing |
Clock control, can be changed on-the-fly (except for auxsrc)
Table 208.CLK_GPOUT0_CTRL
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:21 | Reserved. | - | - |
| 20 | NUDGE:
An edge on this signal shifts the phase of the output by 1 cycle of the input clock This can be done at any time | RW | 0x0 |
| 19:18 | Reserved. | - | - |
| 17:16 | PHASE:
This delays the enable signal by up to 3 cycles of the input clock This must be set before the clock is enabled to have any effect | RW | 0x0 |
| 15:13 | Reserved. | - | - |
| 12 | DC50: Enables duty cycle correction for odd divisors | RW | 0x0 |
| 11 | ENABLE: Starts and stops the clock generator cleanly | RW | 0x0 |
| 10 | KILL: Asynchronously kills the clock generator | RW | 0x0 |
| 9 | Reserved. | - | - |
| 8:5 | AUXSRC: Selects the auxiliary clock source, will glitch when switching | RW | 0x0 |
| Enumerated values: | |||
| 0x0 → CLKSRC_PLL_SYS | |||
| 0x1 → CLKSRC_GPIN0 | |||
| 0x2 → CLKSRC_GPIN1 | |||
| 0x3 → CLKSRC_PLL_USB | |||
| 0x4 → ROSC_CLKSRC | |||
| 0x5 → XOSC_CLKSRC | |||
| 0x6 → CLK_SYS | |||
| 0x7 → CLK_USB | |||
| 0x8 → CLK_ADC | |||
| 0x9 → CLK_RTC | |||
| 0xa → CLK_REF | |||
| 4:0 | Reserved. | - | - |
Clock divisor, can be changed on-the-fly
Table 209.
CLK_GPOUT0_DIV
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:8 | INT : Integer component of the divisor, 0 → divide by 2 16 | RW | 0x000001 |
| 7:0 | FRAC : Fractional component of the divisor | RW | 0x00 |
CLOCKS: CLK_GPOUT0_SELECTED Register
Offset: 0x08
Description
Indicates which SRC is currently selected by the glitchless mux (one-hot).
Table 210.
CLK_GPOUT0_SELECT
ED Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | This slice does not have a glitchless mux (only the AUX_SRC field is present, not SRC) so this register is hardwired to 0x1. | RO | 0x00000001 |
CLOCKS: CLK_GPOUT1_CTRL Register
Offset: 0x0c
Description
Clock control, can be changed on-the-fly (except for auxsrc)
Table 211.
CLK_GPOUT1_CTRL
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:21 | Reserved. | - | - |
| 20 | NUDGE
: An edge on this signal shifts the phase of the output by 1 cycle of the input clock This can be done at any time | RW | 0x0 |
| 19:18 | Reserved. | - | - |
| 17:16 | PHASE
: This delays the enable signal by up to 3 cycles of the input clock This must be set before the clock is enabled to have any effect | RW | 0x0 |
| 15:13 | Reserved. | - | - |
| 12 | DC50 : Enables duty cycle correction for odd divisors | RW | 0x0 |
| 11 | ENABLE : Starts and stops the clock generator cleanly | RW | 0x0 |
| 10 | KILL : Asynchronously kills the clock generator | RW | 0x0 |
| 9 | Reserved. | - | - |
| 8:5 | AUXSRC : Selects the auxiliary clock source, will glitch when switching | RW | 0x0 |
| Enumerated values: | |||
| 0x0 → CLKSRC_PLL_SYS | |||
| 0x1 → CLKSRC_GPIN0 | |||
| 0x2 → CLKSRC_GPIN1 | |||
| 0x3 → CLKSRC_PLL_USB | |||
| 0x4 → ROSC_CLKSRC | |||
| 0x5 → XOSC_CLKSRC | |||
| 0x6 → CLK_SYS | |||
| 0x7 → CLK_USB |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 0x8 → CLK_ADC | |||
| 0x9 → CLK_RTC | |||
| 0xa → CLK_REF | |||
| 4:0 | Reserved. | - | - |
CLOCKS: CLK_GPOUT1_DIV Register
Offset: 0x10
Description
Clock divisor, can be changed on-the-fly
Table 212.
CLK_GPOUT1_DIV
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:8 | INT : Integer component of the divisor, 0 → divide by 2 16 | RW | 0x000001 |
| 7:0 | FRAC : Fractional component of the divisor | RW | 0x00 |
CLOCKS: CLK_GPOUT1_SELECTED Register
Offset: 0x14
Description
Indicates which SRC is currently selected by the glitchless mux (one-hot).
Table 213.
CLK_GPOUT1_SELECTED
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | This slice does not have a glitchless mux (only the AUX_SRC field is present, not SRC) so this register is hardwired to 0x1. | RO | 0x00000001 |
CLOCKS: CLK_GPOUT2_CTRL Register
Offset: 0x18
Description
Clock control, can be changed on-the-fly (except for auxsrc)
Table 214.
CLK_GPOUT2_CTRL
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:21 | Reserved. | - | - |
| 20 | NUDGE
: An edge on this signal shifts the phase of the output by 1 cycle of the input clock This can be done at any time | RW | 0x0 |
| 19:18 | Reserved. | - | - |
| 17:16 | PHASE
: This delays the enable signal by up to 3 cycles of the input clock This must be set before the clock is enabled to have any effect | RW | 0x0 |
| 15:13 | Reserved. | - | - |
| 12 | DC50 : Enables duty cycle correction for odd divisors | RW | 0x0 |
| 11 | ENABLE : Starts and stops the clock generator cleanly | RW | 0x0 |
| 10 | KILL : Asynchronously kills the clock generator | RW | 0x0 |
| 9 | Reserved. | - | - |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 8:5 | AUXSRC : Selects the auxiliary clock source, will glitch when switching | RW | 0x0 |
| Enumerated values: | |||
| 0x0 → CLKSRC_PLL_SYS | |||
| 0x1 → CLKSRC_GPIN0 | |||
| 0x2 → CLKSRC_GPIN1 | |||
| 0x3 → CLKSRC_PLL_USB | |||
| 0x4 → ROSC_CLKSRC_PH | |||
| 0x5 → XOSC_CLKSRC | |||
| 0x6 → CLK_SYS | |||
| 0x7 → CLK_USB | |||
| 0x8 → CLK_ADC | |||
| 0x9 → CLK_RTC | |||
| 0xa → CLK_REF | |||
| 4:0 | Reserved. | - | - |
CLOCKS: CLK_GPOUT2_DIV Register
Offset: 0x1c
Description
Clock divisor, can be changed on-the-fly
Table 215.
CLK_GPOUT2_DIV
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:8 | INT : Integer component of the divisor, 0 → divide by 2 16 | RW | 0x000001 |
| 7:0 | FRAC : Fractional component of the divisor | RW | 0x00 |
CLOCKS: CLK_GPOUT2_SELECTED Register
Offset: 0x20
Description
Indicates which SRC is currently selected by the glitchless mux (one-hot).
Table 216.
CLK_GPOUT2_SELECTED
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | This slice does not have a glitchless mux (only the AUX_SRC field is present, not SRC) so this register is hardwired to 0x1. | RO | 0x00000001 |
CLOCKS: CLK_GPOUT3_CTRL Register
Offset: 0x24
Description
Clock control, can be changed on-the-fly (except for auxsrc)
Table 217.
CLK_GPOUT3_CTRL
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:21 | Reserved. | - | - |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 20 | NUDGE
: An edge on this signal shifts the phase of the output by 1 cycle of the input clock This can be done at any time | RW | 0x0 |
| 19:18 | Reserved. | - | - |
| 17:16 | PHASE
: This delays the enable signal by up to 3 cycles of the input clock This must be set before the clock is enabled to have any effect | RW | 0x0 |
| 15:13 | Reserved. | - | - |
| 12 | DC50 : Enables duty cycle correction for odd divisors | RW | 0x0 |
| 11 | ENABLE : Starts and stops the clock generator cleanly | RW | 0x0 |
| 10 | KILL : Asynchronously kills the clock generator | RW | 0x0 |
| 9 | Reserved. | - | - |
| 8:5 | AUXSRC : Selects the auxiliary clock source, will glitch when switching | RW | 0x0 |
| Enumerated values: | |||
| 0x0 → CLKSRC_PLL_SYS | |||
| 0x1 → CLKSRC_GPIN0 | |||
| 0x2 → CLKSRC_GPIN1 | |||
| 0x3 → CLKSRC_PLL_USB | |||
| 0x4 → ROSC_CLKSRC_PH | |||
| 0x5 → XOSC_CLKSRC | |||
| 0x6 → CLK_SYS | |||
| 0x7 → CLK_USB | |||
| 0x8 → CLK_ADC | |||
| 0x9 → CLK_RTC | |||
| 0xa → CLK_REF | |||
| 4:0 | Reserved. | - | - |
CLOCKS: CLK_GPOUT3_DIV Register
Offset: 0x28
Description
Clock divisor, can be changed on-the-fly
Table 218.
CLK_GPOUT3_DIV
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:8 | INT : Integer component of the divisor, 0 → divide by 2 16 | RW | 0x000001 |
| 7:0 | FRAC : Fractional component of the divisor | RW | 0x00 |
CLOCKS: CLK_GPOUT3_SELECTED Register
Offset: 0x2c
DescriptionIndicates which SRC is currently selected by the glitchless mux (one-hot).
Table 219.
CLK_GPOUT3_SELECT
ED Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | This slice does not have a glitchless mux (only the AUX_SRC field is present, not SRC) so this register is hardwired to 0x1. | RO | 0x00000001 |
Offset: 0x30
DescriptionClock control, can be changed on-the-fly (except for auxsrc)
Table 220.
CLK_REF_CTRL
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:7 | Reserved. | - | - |
| 6:5 | AUXSRC: Selects the auxiliary clock source, will glitch when switching | RW | 0x0 |
| Enumerated values: | |||
| 0x0 → CLKSRC_PLL_USB | |||
| 0x1 → CLKSRC_GPIN0 | |||
| 0x2 → CLKSRC_GPIN1 | |||
| 4:2 | Reserved. | - | - |
| 1:0 | SRC: Selects the clock source glitchlessly, can be changed on-the-fly | RW | - |
| Enumerated values: | |||
| 0x0 → ROSC_CLKSRC_PH | |||
| 0x1 → CLKSRC_CLK_REF_AUX | |||
| 0x2 → XOSC_CLKSRC |
Offset: 0x34
DescriptionClock divisor, can be changed on-the-fly
Table 221.
CLK_REF_DIV Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:10 | Reserved. | - | - |
| 9:8 | INT: Integer component of the divisor, 0 → divide by 2 16 | RW | 0x1 |
| 7:0 | Reserved. | - | - |
Offset: 0x38
DescriptionIndicates which SRC is currently selected by the glitchless mux (one-hot).
Table 222.
CLK_REF_SELECTED
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | The glitchless multiplexer does not switch instantaneously (to avoid glitches), so software should poll this register to wait for the switch to complete. This register contains one decoded bit for each of the clock sources enumerated in the CTRL SRC field. At most one of these bits will be set at any time, indicating that clock is currently present at the output of the glitchless mux. Whilst switching is in progress, this register may briefly show all-0s. | RO | 0x00000001 |
CLOCKS: CLK_SYS_CTRL Register
Offset: 0x3c
Description
Clock control, can be changed on-the-fly (except for auxsrc)
Table 223.
CLK_SYS_CTRL
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:8 | Reserved. | - | - |
| 7:5 | AUXSRC: Selects the auxiliary clock source, will glitch when switching | RW | 0x0 |
| Enumerated values: | |||
| 0x0 → CLKSRC_PLL_SYS | |||
| 0x1 → CLKSRC_PLL_USB | |||
| 0x2 → ROSC_CLKSRC | |||
| 0x3 → XOSC_CLKSRC | |||
| 0x4 → CLKSRC_GPIN0 | |||
| 0x5 → CLKSRC_GPIN1 | |||
| 4:1 | Reserved. | - | - |
| 0 | SRC: Selects the clock source glitchlessly, can be changed on-the-fly | RW | 0x0 |
| Enumerated values: | |||
| 0x0 → CLK_REF | |||
| 0x1 → CLKSRC_CLK_SYS_AUX |
CLOCKS: CLK_SYS_DIV Register
Offset: 0x40
Description
Clock divisor, can be changed on-the-fly
Table 224.
CLK_SYS_DIV Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:8 | INT: Integer component of the divisor, 0 → divide by 2 16 | RW | 0x000001 |
| 7:0 | FRAC: Fractional component of the divisor | RW | 0x00 |
CLOCKS: CLK_SYS_SELECTED Register
Offset: 0x44
Description
Indicates which SRC is currently selected by the glitchless mux (one-hot).
Table 225.
CLK_SYS_SELECTED
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | The glitchless multiplexer does not switch instantaneously (to avoid glitches), so software should poll this register to wait for the switch to complete. This register contains one decoded bit for each of the clock sources enumerated in the CTRL SRC field. At most one of these bits will be set at any time, indicating that clock is currently present at the output of the glitchless mux. Whilst switching is in progress, this register may briefly show all-0s. | RO | 0x00000001 |
CLOCKS: CLK_PERI_CTRL Register
Offset: 0x48
Description
Clock control, can be changed on-the-fly (except for auxsrc)
Table 226.
CLK_PERI_CTRL
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:12 | Reserved. | - | - |
| 11 | ENABLE: Starts and stops the clock generator cleanly | RW | 0x0 |
| 10 | KILL: Asynchronously kills the clock generator | RW | 0x0 |
| 9:8 | Reserved. | - | - |
| 7:5 | AUXSRC: Selects the auxiliary clock source, will glitch when switching | RW | 0x0 |
| Enumerated values: | |||
| 0x0 → CLK_SYS | |||
| 0x1 → CLKSRC_PLL_SYS | |||
| 0x2 → CLKSRC_PLL_USB | |||
| 0x3 → ROOSC_CLKSRC_PH | |||
| 0x4 → XOOSC_CLKSRC | |||
| 0x5 → CLKSRC_GPIN0 | |||
| 0x6 → CLKSRC_GPIN1 | |||
| 4:0 | Reserved. | - | - |
CLOCKS: CLK_PERI_SELECTED Register
Offset: 0x50
Description
Indicates which SRC is currently selected by the glitchless mux (one-hot).
Table 227.
CLK_PERI_SELECTED
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | This slice does not have a glitchless mux (only the AUX_SRC field is present, not SRC) so this register is hardwired to 0x1. | RO | 0x00000001 |
CLOCKS: CLK_USB_CTRL Register
Offset: 0x54
Description
Clock control, can be changed on-the-fly (except for auxsrc)
Table 228.
CLK_USB_CTRL
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:21 | Reserved. | - | - |
| 20 | NUDGE
: An edge on this signal shifts the phase of the output by 1 cycle of the input clock This can be done at any time | RW | 0x0 |
| 19:18 | Reserved. | - | - |
| 17:16 | PHASE
: This delays the enable signal by up to 3 cycles of the input clock This must be set before the clock is enabled to have any effect | RW | 0x0 |
| 15:12 | Reserved. | - | - |
| 11 | ENABLE : Starts and stops the clock generator cleanly | RW | 0x0 |
| 10 | KILL : Asynchronously kills the clock generator | RW | 0x0 |
| 9:8 | Reserved. | - | - |
| 7:5 | AUXSRC : Selects the auxiliary clock source, will glitch when switching | RW | 0x0 |
| Enumerated values: | |||
| 0x0 → CLKSRC_PLL_USB | |||
| 0x1 → CLKSRC_PLL_SYS | |||
| 0x2 → ROSC_CLKSRC_PH | |||
| 0x3 → XOSC_CLKSRC | |||
| 0x4 → CLKSRC_GPIN0 | |||
| 0x5 → CLKSRC_GPIN1 | |||
| 4:0 | Reserved. | - | - |
CLOCKS: CLK_USB_DIV Register
Offset: 0x58
Description
Clock divisor, can be changed on-the-fly
Table 229.
CLK_USB_DIV Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:10 | Reserved. | - | - |
| 9:8 | INT : Integer component of the divisor, 0 → divide by 2 16 | RW | 0x1 |
| 7:0 | Reserved. | - | - |
CLOCKS: CLK_USB_SELECTED Register
Offset: 0x5c
Description
Indicates which SRC is currently selected by the glitchless mux (one-hot).
Table 230.
CLK_USB_SELECTED
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | This slice does not have a glitchless mux (only the AUX_SRC field is present, not SRC) so this register is hardwired to 0x1. | RO | 0x00000001 |
CLOCKS: CLK_ADC_CTRL Register
Offset: 0x60
Description
Clock control, can be changed on-the-fly (except for auxsrc)
Table 231.
CLK_ADC_CTRL
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:21 | Reserved. | - | - |
| 20 | NUDGE
: An edge on this signal shifts the phase of the output by 1 cycle of the input clock This can be done at any time | RW | 0x0 |
| 19:18 | Reserved. | - | - |
| 17:16 | PHASE
: This delays the enable signal by up to 3 cycles of the input clock This must be set before the clock is enabled to have any effect | RW | 0x0 |
| 15:12 | Reserved. | - | - |
| 11 | ENABLE : Starts and stops the clock generator cleanly | RW | 0x0 |
| 10 | KILL : Asynchronously kills the clock generator | RW | 0x0 |
| 9:8 | Reserved. | - | - |
| 7:5 | AUXSRC : Selects the auxiliary clock source, will glitch when switching | RW | 0x0 |
| Enumerated values: | |||
| 0x0 → CLKSRC_PLL_USB | |||
| 0x1 → CLKSRC_PLL_SYS | |||
| 0x2 → ROSC_CLKSRC_PH | |||
| 0x3 → XOSC_CLKSRC | |||
| 0x4 → CLKSRC_GPIN0 | |||
| 0x5 → CLKSRC_GPIN1 | |||
| 4:0 | Reserved. | - | - |
CLOCKS: CLK_ADC_DIV Register
Offset: 0x64
Description
Clock divisor, can be changed on-the-fly
Table 232.
CLK_ADC_DIV Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:10 | Reserved. | - | - |
| 9:8 | INT : Integer component of the divisor, 0 → divide by 2 16 | RW | 0x1 |
| 7:0 | Reserved. | - | - |
Indicates which SRC is currently selected by the glitchless mux (one-hot).
Table 233.
CLK_ADC_SELECTED
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | This slice does not have a glitchless mux (only the AUX_SRC field is present, not SRC) so this register is hardwired to 0x1. | RO | 0x00000001 |
Clock control, can be changed on-the-fly (except for auxsrc)
Table 234.
CLK_RTC_CTRL
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:21 | Reserved. | - | - |
| 20 | NUDGE:
An edge on this signal shifts the phase of the output by 1 cycle of the input clock This can be done at any time | RW | 0x0 |
| 19:18 | Reserved. | - | - |
| 17:16 | PHASE:
This delays the enable signal by up to 3 cycles of the input clock This must be set before the clock is enabled to have any effect | RW | 0x0 |
| 15:12 | Reserved. | - | - |
| 11 | ENABLE: Starts and stops the clock generator cleanly | RW | 0x0 |
| 10 | KILL: Asynchronously kills the clock generator | RW | 0x0 |
| 9:8 | Reserved. | - | - |
| 7:5 | AUXSRC: Selects the auxiliary clock source, will glitch when switching | RW | 0x0 |
| Enumerated values: | |||
| 0x0 → CLKSRC_PLL_USB | |||
| 0x1 → CLKSRC_PLL_SYS | |||
| 0x2 → ROSC_CLKSRC_PH | |||
| 0x3 → XOSC_CLKSRC | |||
| 0x4 → CLKSRC_GPIN0 | |||
| 0x5 → CLKSRC_GPIN1 | |||
| 4:0 | Reserved. | - | - |
Clock divisor, can be changed on-the-fly
Table 235.
CLK_RTC_DIV Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:8 | INT : Integer component of the divisor, 0 → divide by 2 16 | RW | 0x000001 |
| 7:0 | FRAC : Fractional component of the divisor | RW | 0x00 |
CLOCKS: CLK_RTC_SELECTED Register
Offset: 0x74
Description
Indicates which SRC is currently selected by the glitchless mux (one-hot).
Table 236.
CLK_RTC_SELECTED Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | This slice does not have a glitchless mux (only the AUX_SRC field is present, not SRC) so this register is hardwired to 0x1. | RO | 0x00000001 |
CLOCKS: CLK_SYS_RESUS_CTRL Register
Offset: 0x78
Table 237.
CLK_SYS_RESUS_CTRL Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:17 | Reserved. | - | - |
| 16 | CLEAR : For clearing the resus after the fault that triggered it has been corrected | RW | 0x0 |
| 15:13 | Reserved. | - | - |
| 12 | FRCE : Force a resus, for test purposes only | RW | 0x0 |
| 11:9 | Reserved. | - | - |
| 8 | ENABLE : Enable resus | RW | 0x0 |
| 7:0 | TIMEOUT : This is expressed as a number of clk_ref cycles and must be >= 2x clk_ref_freq/min_clk_tst_freq | RW | 0xff |
CLOCKS: CLK_SYS_RESUS_STATUS Register
Offset: 0x7c
Table 238.
CLK_SYS_RESUS_STATUS Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:1 | Reserved. | - | - |
| 0 | RESUSSED : Clock has been resuscitated, correct the error then send ctrl_clear=1 | RO | 0x0 |
CLOCKS: FC0_REF_KHZ Register
Offset: 0x80
Table 239.
FC0_REF_KHZ Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:20 | Reserved. | - | - |
| 19:0 | Reference clock frequency in kHz | RW | 0x00000 |
CLOCKS: FC0_MIN_KHZ Register
Offset: 0x84
Table 240.
FC0_MIN_KHZ
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:25 | Reserved. | - | - |
| 24:0 | Minimum pass frequency in kHz. This is optional. Set to 0 if you are not using the pass/fail flags | RW | 0x0000000 |
CLOCKS: FC0_MAX_KHZ Register
Offset: 0x88
Table 241.
FC0_MAX_KHZ
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:25 | Reserved. | - | - |
| 24:0 | Maximum pass frequency in kHz. This is optional. Set to 0x1ffffff if you are not using the pass/fail flags | RW | 0x1ffffff |
CLOCKS: FC0_DELAY Register
Offset: 0x8c
Table 242. FC0_DELAY
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:3 | Reserved. | - | - |
| 2:0 | Delays the start of frequency counting to allow the mux to settle Delay is measured in multiples of the reference clock period | RW | 0x1 |
CLOCKS: FC0_INTERVAL Register
Offset: 0x90
Table 243.
FC0_INTERVAL
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:4 | Reserved. | - | - |
| 3:0 | The test interval is
\(
0.98\mu s * 2^{**interval}
\)
, but let's call it
\(
1\mu s * 2^{**interval}
\) The default gives a test interval of 250us | RW | 0x8 |
CLOCKS: FC0_SRC Register
Offset: 0x94
Table 244. FC0_SRC
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:8 | Reserved. | - | - |
| 7:0 | Clock sent to frequency counter, set to 0 when not required Writing to this register initiates the frequency count | RW | 0x00 |
| Enumerated values: | |||
| 0x00 → NULL |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 0x01 → PLL_SYS_CLKSRC_PRIMARY | |||
| 0x02 → PLL_USB_CLKSRC_PRIMARY | |||
| 0x03 → ROSC_CLKSRC | |||
| 0x04 → ROSC_CLKSRC_PH | |||
| 0x05 → XOSC_CLKSRC | |||
| 0x06 → CLKSRC_GPIN0 | |||
| 0x07 → CLKSRC_GPIN1 | |||
| 0x08 → CLK_REF | |||
| 0x09 → CLK_SYS | |||
| 0x0a → CLK_PERI | |||
| 0x0b → CLK_USB | |||
| 0x0c → CLK_ADC | |||
| 0x0d → CLK_RTC |
CLOCKS: FC0_STATUS Register
Offset: 0x98
Description
Frequency counter status
Table 245.
FC0_STATUS Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:29 | Reserved. | - | - |
| 28 | DIED: Test clock stopped during test | RO | 0x0 |
| 27:25 | Reserved. | - | - |
| 24 | FAST: Test clock faster than expected, only valid when status_done=1 | RO | 0x0 |
| 23:21 | Reserved. | - | - |
| 20 | SLOW: Test clock slower than expected, only valid when status_done=1 | RO | 0x0 |
| 19:17 | Reserved. | - | - |
| 16 | FAIL: Test failed | RO | 0x0 |
| 15:13 | Reserved. | - | - |
| 12 | WAITING: Waiting for test clock to start | RO | 0x0 |
| 11:9 | Reserved. | - | - |
| 8 | RUNNING: Test running | RO | 0x0 |
| 7:5 | Reserved. | - | - |
| 4 | DONE: Test complete | RO | 0x0 |
| 3:1 | Reserved. | - | - |
| 0 | PASS: Test passed | RO | 0x0 |
CLOCKS: FC0_RESULT Register
Offset: 0x9c DescriptionResult of frequency measurement, only valid when status_done=1
Table 246.FC0_RESULT Register
| Offset 0x0 0x4 0x8 0xc Bits | Name FRCE_ON FRCE_OFF WDSEL DONE Description | Info Force block out of reset (i.e. power it on) Force into reset (i.e. power it off) Set to 1 if this peripheral should be reset when the watchdog Indicates the peripheral’s registers are ready to access. Type | Reset |
|---|---|---|---|
| 31:30 | Reserved. | - | - |
| 29:5 | KHZ | RO | 0x0000000 |
| 4:0 | FRAC | RO | 0x00 |
| Bits | enable clock in wake mode Description | Type | Reset |
| 31 | CLK_SYS_SRAM3 | RW | 0x1 |
| 30 | CLK_SYS_SRAM2 | RW | 0x1 |
| 29 | CLK_SYS_SRAM1 | RW | 0x1 |
| 28 | CLK_SYS_SRAM0 | RW | 0x1 |
| 27 | CLK_SYS_SPI1 | RW | 0x1 |
| 26 | CLK_PERI_SPI1 | RW | 0x1 |
| 25 | CLK_SYS_SPI0 | RW | 0x1 |
| 24 | CLK_PERI_SPI0 | RW | 0x1 |
| 23 | CLK_SYS_SIO | RW | 0x1 |
| 22 | CLK_SYS_RTC | RW | 0x1 |
| 21 | CLK_RTC_RTC | RW | 0x1 |
| 20 | CLK_SYS_ROSC | RW | 0x1 |
| 19 | CLK_SYS_ROM | RW | 0x1 |
| 18 | CLK_SYS_RESETS | RW | 0x1 |
| 17 | CLK_SYS_PWM | RW | 0x1 |
| 16 | CLK_SYS_PSM | RW | 0x1 |
| 15 | CLK_SYS_PLL_USB | RW | 0x1 |
| 14 | CLK_SYS_PLL_SYS | RW | 0x1 |
| 13 | CLK_SYS_PIO1 | RW | 0x1 |
| 12 | CLK_SYS_PIO0 | RW | 0x1 |
| 11 | CLK_SYS_PADS | RW | 0x1 |
| 10 | CLK_SYS_VREG_AND_CHIP_RESET | RW | 0x1 |
| 9 | CLK_SYS_JTAG | RW | 0x1 |
| 8 | CLK_SYS_IO | RW | 0x1 |
enable clock in wake mode
Table 247. WAKE_EN0Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 7 | CLK_SYS_I2C1 | RW | 0x1 |
| 6 | CLK_SYS_I2C0 | RW | 0x1 |
| 5 | CLK_SYS_DMA | RW | 0x1 |
| 4 | CLK_SYS_BUSFABRIC | RW | 0x1 |
| 3 | CLK_SYS_BUSCTRL | RW | 0x1 |
| 2 | CLK_SYS_ADC | RW | 0x1 |
| 1 | CLK_ADC_ADC | RW | 0x1 |
| 0 | CLK_SYS_CLOCKS | RW | 0x1 |
CLOCKS: WAKE_EN1 Register
Offset: 0xa4
Description
enable clock in wake mode
Table 248. WAKE_EN1 Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:15 | Reserved. | - | - |
| 14 | CLK_SYS_XOSC | RW | 0x1 |
| 13 | CLK_SYS_XIP | RW | 0x1 |
| 12 | CLK_SYS_WATCHDOG | RW | 0x1 |
| 11 | CLK_USB_USBCTRL | RW | 0x1 |
| 10 | CLK_SYS_USBCTRL | RW | 0x1 |
| 9 | CLK_SYS_UART1 | RW | 0x1 |
| 8 | CLK_PERI_UART1 | RW | 0x1 |
| 7 | CLK_SYS_UART0 | RW | 0x1 |
| 6 | CLK_PERI_UART0 | RW | 0x1 |
| 5 | CLK_SYS_TIMER | RW | 0x1 |
| 4 | CLK_SYS_TBMAN | RW | 0x1 |
| 3 | CLK_SYS_SYSINFO | RW | 0x1 |
| 2 | CLK_SYS_SYSCFG | RW | 0x1 |
| 1 | CLK_SYS_SRAM5 | RW | 0x1 |
| 0 | CLK_SYS_SRAM4 | RW | 0x1 |
CLOCKS: SLEEP_EN0 Register
Offset: 0xa8
Description
enable clock in sleep mode
Table 249. SLEEP_EN0 Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31 | CLK_SYS_SRAM3 | RW | 0x1 |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 30 | CLK_SYS_SRAM2 | RW | 0x1 |
| 29 | CLK_SYS_SRAM1 | RW | 0x1 |
| 28 | CLK_SYS_SRAM0 | RW | 0x1 |
| 27 | CLK_SYS_SPI1 | RW | 0x1 |
| 26 | CLK_PERI_SPI1 | RW | 0x1 |
| 25 | CLK_SYS_SPI0 | RW | 0x1 |
| 24 | CLK_PERI_SPI0 | RW | 0x1 |
| 23 | CLK_SYS_SIO | RW | 0x1 |
| 22 | CLK_SYS_RTC | RW | 0x1 |
| 21 | CLK_RTC_RTC | RW | 0x1 |
| 20 | CLK_SYS_ROSC | RW | 0x1 |
| 19 | CLK_SYS_ROM | RW | 0x1 |
| 18 | CLK_SYS_RESETS | RW | 0x1 |
| 17 | CLK_SYS_PWM | RW | 0x1 |
| 16 | CLK_SYS_PSM | RW | 0x1 |
| 15 | CLK_SYS_PLL_USB | RW | 0x1 |
| 14 | CLK_SYS_PLL_SYS | RW | 0x1 |
| 13 | CLK_SYS_PIO1 | RW | 0x1 |
| 12 | CLK_SYS_PIO0 | RW | 0x1 |
| 11 | CLK_SYS_PADS | RW | 0x1 |
| 10 | CLK_SYS_VREG_AND_CHIP_RESET | RW | 0x1 |
| 9 | CLK_SYS_JTAG | RW | 0x1 |
| 8 | CLK_SYS_IO | RW | 0x1 |
| 7 | CLK_SYS_I2C1 | RW | 0x1 |
| 6 | CLK_SYS_I2C0 | RW | 0x1 |
| 5 | CLK_SYS_DMA | RW | 0x1 |
| 4 | CLK_SYS_BUSFABRIC | RW | 0x1 |
| 3 | CLK_SYS_BUSCTRL | RW | 0x1 |
| 2 | CLK_SYS_ADC | RW | 0x1 |
| 1 | CLK_ADC_ADC | RW | 0x1 |
| 0 | CLK_SYS_CLOCKS | RW | 0x1 |
CLOCKS: SLEEP_EN1 Register
Offset: 0xac
Description
enable clock in sleep mode
Table 250. SLEEP_EN1 Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:15 | Reserved. | - | - |
| 14 | CLK_SYS_XOSC | RW | 0x1 |
| 13 | CLK_SYS_XIP | RW | 0x1 |
| 12 | CLK_SYS_WATCHDOG | RW | 0x1 |
| 11 | CLK_USB_USBCTRL | RW | 0x1 |
| 10 | CLK_SYS_USBCTRL | RW | 0x1 |
| 9 | CLK_SYS_UART1 | RW | 0x1 |
| 8 | CLK_PERI_UART1 | RW | 0x1 |
| 7 | CLK_SYS_UART0 | RW | 0x1 |
| 6 | CLK_PERI_UART0 | RW | 0x1 |
| 5 | CLK_SYS_TIMER | RW | 0x1 |
| 4 | CLK_SYS_TBMAN | RW | 0x1 |
| 3 | CLK_SYS_SYSINFO | RW | 0x1 |
| 2 | CLK_SYS_SYSCFG | RW | 0x1 |
| 1 | CLK_SYS_SRAM5 | RW | 0x1 |
| 0 | CLK_SYS_SRAM4 | RW | 0x1 |
CLOCKS: ENABLED0 Register
Offset: 0xb0
Description
indicates the state of the clock enable
Table 251. ENABLED0 Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31 | CLK_SYS_SRAM3 | RO | 0x0 |
| 30 | CLK_SYS_SRAM2 | RO | 0x0 |
| 29 | CLK_SYS_SRAM1 | RO | 0x0 |
| 28 | CLK_SYS_SRAM0 | RO | 0x0 |
| 27 | CLK_SYS_SPI1 | RO | 0x0 |
| 26 | CLK_PERI_SPI1 | RO | 0x0 |
| 25 | CLK_SYS_SPI0 | RO | 0x0 |
| 24 | CLK_PERI_SPI0 | RO | 0x0 |
| 23 | CLK_SYS_SIO | RO | 0x0 |
| 22 | CLK_SYS_RTC | RO | 0x0 |
| 21 | CLK_RTC_RTC | RO | 0x0 |
| 20 | CLK_SYS_ROSC | RO | 0x0 |
| 19 | CLK_SYS_ROM | RO | 0x0 |
| 18 | CLK_SYS_RESETS | RO | 0x0 |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 17 | CLK_SYS_PWM | RO | 0x0 |
| 16 | CLK_SYS_PSM | RO | 0x0 |
| 15 | CLK_SYS_PLL_USB | RO | 0x0 |
| 14 | CLK_SYS_PLL_SYS | RO | 0x0 |
| 13 | CLK_SYS_PIO1 | RO | 0x0 |
| 12 | CLK_SYS_PIO0 | RO | 0x0 |
| 11 | CLK_SYS_PADS | RO | 0x0 |
| 10 | CLK_SYS_VREG_AND_CHIP_RESET | RO | 0x0 |
| 9 | CLK_SYS_JTAG | RO | 0x0 |
| 8 | CLK_SYS_IO | RO | 0x0 |
| 7 | CLK_SYS_I2C1 | RO | 0x0 |
| 6 | CLK_SYS_I2C0 | RO | 0x0 |
| 5 | CLK_SYS_DMA | RO | 0x0 |
| 4 | CLK_SYS_BUSFABRIC | RO | 0x0 |
| 3 | CLK_SYS_BUSCTRL | RO | 0x0 |
| 2 | CLK_SYS_ADC | RO | 0x0 |
| 1 | CLK_ADC_ADC | RO | 0x0 |
| 0 | CLK_SYS_CLOCKS | RO | 0x0 |
CLOCKS: ENABLED1 Register
Offset: 0xb4
Description
indicates the state of the clock enable
Table 252. ENABLED1 Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:15 | Reserved. | - | - |
| 14 | CLK_SYS_XOSC | RO | 0x0 |
| 13 | CLK_SYS_XIP | RO | 0x0 |
| 12 | CLK_SYS_WATCHDOG | RO | 0x0 |
| 11 | CLK_USB_USBCTRL | RO | 0x0 |
| 10 | CLK_SYS_USBCTRL | RO | 0x0 |
| 9 | CLK_SYS_UART1 | RO | 0x0 |
| 8 | CLK_PERI_UART1 | RO | 0x0 |
| 7 | CLK_SYS_UART0 | RO | 0x0 |
| 6 | CLK_PERI_UART0 | RO | 0x0 |
| 5 | CLK_SYS_TIMER | RO | 0x0 |
| 4 | CLK_SYS_TBMAN | RO | 0x0 |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 3 | CLK_SYS_SYSINFO | RO | 0x0 |
| 2 | CLK_SYS_SYSCFG | RO | 0x0 |
| 1 | CLK_SYS_SRAM5 | RO | 0x0 |
| 0 | CLK_SYS_SRAM4 | RO | 0x0 |
CLOCKS: INTR Register
Offset: 0xb8
Description
Raw Interrupts
Table 253. INTR Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:1 | Reserved. | - | - |
| 0 | CLK_SYS_RESUS | RO | 0x0 |
CLOCKS: INTE Register
Offset: 0xbc
Description
Interrupt Enable
Table 254. INTE Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:1 | Reserved. | - | - |
| 0 | CLK_SYS_RESUS | RW | 0x0 |
CLOCKS: INTF Register
Offset: 0xc0
Description
Interrupt Force
Table 255. INTF Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:1 | Reserved. | - | - |
| 0 | CLK_SYS_RESUS | RW | 0x0 |
CLOCKS: INTS Register
Offset: 0xc4
Description
Interrupt status after masking & forcing
Table 256. INTS Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:1 | Reserved. | - | - |
| 0 | CLK_SYS_RESUS | RO | 0x0 |