2.14. Subsystem Resets

2.14.1. Overview

The reset controller allows software control of the resets to all of the peripherals that are not critical to boot the processor in RP2040. This includes:

The full list can be seen in the register descriptions.

Every peripheral reset by the reset controller is held in reset at power-up. It is up to software to deassert the reset of peripherals it intends to use. Note that if you are using the SDK some peripherals may already be out of reset.

2.14.2. Programmer's Model

The SDK defines a struct to represent the resets registers.

SDK: https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2040/hardware_structs/include/hardware/structs/resets.h Lines 59 - 146

59 typedef struct {
60     _REG_(RESETS_RESET_OFFSET) // RESETS_RESET
61     // Reset control.
62     // 0x01000000 [24] USBCTRL      (1)
63     // 0x00800000 [23] UART1       (1)
64     // 0x00400000 [22] UART0       (1)
65     // 0x00200000 [21] TIMER       (1)
66     // 0x00100000 [20] TBMAN        (1)
67     // 0x00080000 [19] SYSINFO      (1)
68     // 0x00040000 [18] SYSCFG       (1)
69     // 0x00020000 [17] SPI1         (1)
70     // 0x00010000 [16] SPI0         (1)
71     // 0x00008000 [15] RTC          (1)
72     // 0x00004000 [14] PWM          (1)
73     // 0x00002000 [13] PLL_USB      (1)
74     // 0x00001000 [12] PLL_SYS      (1)
75     // 0x00000800 [11] PIO1         (1)
76     // 0x00000400 [10] PIO0         (1)
77     // 0x00000200 [9] PADS_QSPI     (1)
78     // 0x00000100 [8] PADS_BANK0    (1)
79     // 0x00000080 [7] JTAG          (1)
80     // 0x00000040 [6] IO_QSPI       (1)
81     // 0x00000020 [5] IO_BANK0      (1)
82     // 0x00000010 [4] I2C1          (1)
83     // 0x00000008 [3] I2C0          (1)
84     // 0x00000004 [2] DMA           (1)
85     // 0x00000002 [1] BUSCTRL       (1)
86     // 0x00000001 [0] ADC           (1)
87     io_rw_32 reset;
88
89     _REG_(RESETS_WDSEL_OFFSET) // RESETS_WDSEL
90     // Watchdog select.
91     // 0x01000000 [24] USBCTRL      (0)
92     // 0x00800000 [23] UART1       (0)
93     // 0x00400000 [22] UART0       (0)
94     // 0x00200000 [21] TIMER       (0)
95     // 0x00100000 [20] TBMAN        (0)
96     // 0x00080000 [19] SYSINFO      (0)
97     // 0x00040000 [18] SYSCFG       (0)
98     // 0x00020000 [17] SPI1         (0)
99     // 0x00010000 [16] SPI0         (0)
100    // 0x00008000 [15] RTC          (0)
101    // 0x00004000 [14] PWM          (0)
102    // 0x00002000 [13] PLL_USB      (0)
103 // 0x00001000 [12] PLL_SYS (0)
104 // 0x00000800 [11] PIO1 (0)
105 // 0x00000400 [10] PIO0 (0)
106 // 0x00000200 [9] PADS_QSPI (0)
107 // 0x00000100 [8] PADS_BANK0 (0)
108 // 0x00000080 [7] JTAG (0)
109 // 0x00000040 [6] IO_QSPI (0)
110 // 0x00000020 [5] IO_BANK0 (0)
111 // 0x00000010 [4] I2C1 (0)
112 // 0x00000008 [3] I2C0 (0)
113 // 0x00000004 [2] DMA (0)
114 // 0x00000002 [1] BUSCTRL (0)
115 // 0x00000001 [0] ADC (0)
116 io_rw_32 wdsel;
117
118 _REG(RESETS_RESET_DONE_OFFSET) // RESETS_RESET_DONE
119 // Reset done.
120 // 0x01000000 [24] USBCTRL (0)
121 // 0x00800000 [23] UART1 (0)
122 // 0x00400000 [22] UART0 (0)
123 // 0x00200000 [21] TIMER (0)
124 // 0x00100000 [20] TBMAN (0)
125 // 0x00080000 [19] SYSINFO (0)
126 // 0x00040000 [18] SYSCFG (0)
127 // 0x00020000 [17] SPI1 (0)
128 // 0x00010000 [16] SPI0 (0)
129 // 0x00008000 [15] RTC (0)
130 // 0x00004000 [14] PWM (0)
131 // 0x00002000 [13] PLL_USB (0)
132 // 0x00001000 [12] PLL_SYS (0)
133 // 0x00000800 [11] PIO1 (0)
134 // 0x00000400 [10] PIO0 (0)
135 // 0x00000200 [9] PADS_QSPI (0)
136 // 0x00000100 [8] PADS_BANK0 (0)
137 // 0x00000080 [7] JTAG (0)
138 // 0x00000040 [6] IO_QSPI (0)
139 // 0x00000020 [5] IO_BANK0 (0)
140 // 0x00000010 [4] I2C1 (0)
141 // 0x00000008 [3] I2C0 (0)
142 // 0x00000004 [2] DMA (0)
143 // 0x00000002 [1] BUSCTRL (0)
144 // 0x00000001 [0] ADC (0)
145 io_ro_32 reset_done;
146 } resets_hw_t;

Three registers are defined:

The reset functions in the SDK are defined as follows:

SDK: https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2-common/hardware_resets/include/hardware/resets.h Lines 121 - 123

121 static __force_inline void reset_block(uint32_t bits) {
122     reset_block_mask(bits);
123 }

SDK: https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/hardware_resets/include/hardware/resets.h Lines 125 - 127

125 static __force_inline void unreset_block(uint32_t bits) {
126     unreset_block_mask(bits);
127 }

SDK: https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/hardware_resets/include/hardware/resets.h Lines 129 - 131

129 static __force_inline void unreset_block_wait(uint32_t bits) {
130     return unreset_block_mask_wait_blocking(bits);
131 }

An example use of these is in the UART driver, where the driver defines a uart_reset function, selecting a different bit of the reset register depending on the uart specified:

SDK: https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/hardware_uart/uart.c Lines 32 - 38

32 static inline void uart_reset(uart_inst_t *uart) {
33     reset_block_num(uart_get_reset_num(uart));
34 }
35
36 static inline void uart_unreset(uart_inst_t *uart) {
37     unreset_block_num_wait_blocking(uart_get_reset_num(uart));
38 }

2.14.3. List of Registers

The reset controller registers start at a base address of 0x4000c000(defined as RESETS_BASE in SDK).

Table 201. List of RESETS registers

OffsetNameInfo
0x0RESETReset control.
0x4WDSELWatchdog select.
0x8RESET_DONEReset done.

RESETS: RESET Register

Offset: 0x0

Description

Reset control. If a bit is set it means the peripheral is in reset. 0 means the peripheral's reset is deasserted.

Table 202. RESET Register

BitsDescriptionTypeReset
31:25Reserved.--
24USBCTRLRW0x1
23UART1RW0x1
22UART0RW0x1
21TIMERRW0x1
BitsDescriptionTypeReset
20TBMANRW0x1
19SYSINFORW0x1
18SYSCFGRW0x1
17SPI1RW0x1
16SPI0RW0x1
15RTCRW0x1
14PWMRW0x1
13PLL_USBRW0x1
12PLL_SYSRW0x1
11PIO1RW0x1
10PIO0RW0x1
9PADS_QSPIRW0x1
8PADS_BANK0RW0x1
7JTAGRW0x1
6IO_QSPIRW0x1
5IO_BANK0RW0x1
4I2C1RW0x1
3I2C0RW0x1
2DMARW0x1
1BUSCTRLRW0x1
0ADCRW0x1

RESETS: WDSSEL Register

Offset: 0x4

Description

Watchdog select. If a bit is set then the watchdog will reset this peripheral when the watchdog fires.

Table 203. WDSSEL Register

BitsDescriptionTypeReset
31:25Reserved.--
24USBCTRLRW0x0
23UART1RW0x0
22UART0RW0x0
21TIMERRW0x0
20TBMANRW0x0
19SYSINFORW0x0
18SYSCFGRW0x0
17SPI1RW0x0
BitsDescriptionTypeReset
16SPI0RW0x0
15RTCRW0x0
14PWMRW0x0
13PLL_USBRW0x0
12PLL_SYSRW0x0
11PIO1RW0x0
10PIO0RW0x0
9PADS_QSPIRW0x0
8PADS_BANK0RW0x0
7JTAGRW0x0
6IO_QSPIRW0x0
5IO_BANK0RW0x0
4I2C1RW0x0
3I2C0RW0x0
2DMARW0x0
1BUSCTRLRW0x0
0ADCRW0x0

RESETS: RESET_DONE Register

Offset: 0x8

Description

Reset done. If a bit is set then a reset done signal has been returned by the peripheral. This indicates that the peripheral's registers are ready to be accessed.

Table 204.
RESET_DONE Register

BitsDescriptionTypeReset
31:25Reserved.--
24USBCTRLRO0x0
23UART1RO0x0
22UART0RO0x0
21TIMERRO0x0
20TBMANRO0x0
19SYSINFORO0x0
18SYSCFGRO0x0
17SPI1RO0x0
16SPI0RO0x0
15RTCRO0x0
14PWMRO0x0
13PLL_USBRO0x0
BitsDescriptionTypeReset
12PLL_SYSRO0x0
11PIO1RO0x0
10PIO0RO0x0
9PADS_QSPIRO0x0
8PADS_BANK0RO0x0
7JTAGRO0x0
6IO_QSPIRO0x0
5IO_BANK0RO0x0
4I2C1RO0x0
3I2C0RO0x0
2DMARO0x0
1BUSCTRLRO0x0
0ADCRO0x0