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:
- • USB Controller
- • PIO
- • Peripherals such as UART, I2C, SPI, PWM, Timer, ADC
- • PLLs
- • IO and Pad registers
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:
- • reset : this register contains a bit for each peripheral that can be reset. If the bit is set to 1 then the reset is asserted. If the bit is cleared then the reset is deasserted.
- • wdsel : if the bit is set then this peripheral will be reset if the watchdog fires (note that the power on state machine can potentially reset the whole reset controller, which will reset everything)
- • reset_done : a bit for each peripheral, that gets set once the peripheral is out of reset. This allows software to wait for this status bit in case the peripheral has some initialisation to do before it can be used.
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
| Offset | Name | Info |
|---|---|---|
| 0x0 | RESET | Reset control. |
| 0x4 | WDSEL | Watchdog select. |
| 0x8 | RESET_DONE | Reset 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
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:25 | Reserved. | - | - |
| 24 | USBCTRL | RW | 0x1 |
| 23 | UART1 | RW | 0x1 |
| 22 | UART0 | RW | 0x1 |
| 21 | TIMER | RW | 0x1 |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 20 | TBMAN | RW | 0x1 |
| 19 | SYSINFO | RW | 0x1 |
| 18 | SYSCFG | RW | 0x1 |
| 17 | SPI1 | RW | 0x1 |
| 16 | SPI0 | RW | 0x1 |
| 15 | RTC | RW | 0x1 |
| 14 | PWM | RW | 0x1 |
| 13 | PLL_USB | RW | 0x1 |
| 12 | PLL_SYS | RW | 0x1 |
| 11 | PIO1 | RW | 0x1 |
| 10 | PIO0 | RW | 0x1 |
| 9 | PADS_QSPI | RW | 0x1 |
| 8 | PADS_BANK0 | RW | 0x1 |
| 7 | JTAG | RW | 0x1 |
| 6 | IO_QSPI | RW | 0x1 |
| 5 | IO_BANK0 | RW | 0x1 |
| 4 | I2C1 | RW | 0x1 |
| 3 | I2C0 | RW | 0x1 |
| 2 | DMA | RW | 0x1 |
| 1 | BUSCTRL | RW | 0x1 |
| 0 | ADC | RW | 0x1 |
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
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:25 | Reserved. | - | - |
| 24 | USBCTRL | RW | 0x0 |
| 23 | UART1 | RW | 0x0 |
| 22 | UART0 | RW | 0x0 |
| 21 | TIMER | RW | 0x0 |
| 20 | TBMAN | RW | 0x0 |
| 19 | SYSINFO | RW | 0x0 |
| 18 | SYSCFG | RW | 0x0 |
| 17 | SPI1 | RW | 0x0 |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 16 | SPI0 | RW | 0x0 |
| 15 | RTC | RW | 0x0 |
| 14 | PWM | RW | 0x0 |
| 13 | PLL_USB | RW | 0x0 |
| 12 | PLL_SYS | RW | 0x0 |
| 11 | PIO1 | RW | 0x0 |
| 10 | PIO0 | RW | 0x0 |
| 9 | PADS_QSPI | RW | 0x0 |
| 8 | PADS_BANK0 | RW | 0x0 |
| 7 | JTAG | RW | 0x0 |
| 6 | IO_QSPI | RW | 0x0 |
| 5 | IO_BANK0 | RW | 0x0 |
| 4 | I2C1 | RW | 0x0 |
| 3 | I2C0 | RW | 0x0 |
| 2 | DMA | RW | 0x0 |
| 1 | BUSCTRL | RW | 0x0 |
| 0 | ADC | RW | 0x0 |
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
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:25 | Reserved. | - | - |
| 24 | USBCTRL | RO | 0x0 |
| 23 | UART1 | RO | 0x0 |
| 22 | UART0 | RO | 0x0 |
| 21 | TIMER | RO | 0x0 |
| 20 | TBMAN | RO | 0x0 |
| 19 | SYSINFO | RO | 0x0 |
| 18 | SYSCFG | RO | 0x0 |
| 17 | SPI1 | RO | 0x0 |
| 16 | SPI0 | RO | 0x0 |
| 15 | RTC | RO | 0x0 |
| 14 | PWM | RO | 0x0 |
| 13 | PLL_USB | RO | 0x0 |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 12 | PLL_SYS | RO | 0x0 |
| 11 | PIO1 | RO | 0x0 |
| 10 | PIO0 | RO | 0x0 |
| 9 | PADS_QSPI | RO | 0x0 |
| 8 | PADS_BANK0 | RO | 0x0 |
| 7 | JTAG | RO | 0x0 |
| 6 | IO_QSPI | RO | 0x0 |
| 5 | IO_BANK0 | RO | 0x0 |
| 4 | I2C1 | RO | 0x0 |
| 3 | I2C0 | RO | 0x0 |
| 2 | DMA | RO | 0x0 |
| 1 | BUSCTRL | RO | 0x0 |
| 0 | ADC | RO | 0x0 |