2.3. Processor subsystem
The RP2040 processor subsystem consists of two Arm Cortex-M0+ processors – each with its standard internal Arm CPU peripherals – alongside external peripherals for GPIO access and inter-core communication. Details of the Arm Cortex-M0+ processors, including the specific feature configuration used on RP2040, can be found in Section 2.4 .
Figure 6. Two Cortex-M0+ processors, each with a dedicated 32-bit AHB-Lite bus port, for code fetch, loads and stores. The SIO is connected to the single-cycle IOPORT bus of each processor, and provides GPIO access, two-way communications, and other core-local peripherals. Both processors can be debugged via a single multi-drop Serial Wire Debug bus. 26 interrupts (plus NMI) are routed to the NVIC and WIC on each processor.

i NOTE
The terms core0 and core1 , proc0 and proc1 are used interchangeably in RP2040's registers and documentation to refer to processor 0, and processor 1 respectively.
The processors use a number of interfaces to communicate with the rest of the system:
- • Each processor uses its own independent 32-bit AHB-Lite bus to access memory and memory-mapped peripherals (more detail in Section 2.1 )
- • The single-cycle IO block provides high-speed, deterministic access to GPIOs via each processor's IOPORT
- • 26 system-level interrupts are routed to both processors
- • A multi-drop Serial Wire Debug bus provides debug access to both processors from an external debug host
2.3.1. SIO
The Single-cycle IO block (SIO) contains several peripherals that require low-latency, deterministic access from the processors. It is accessed via each processor's IOPORT: this is an auxiliary bus port on the Cortex-M0+ which can perform rapid 32-bit reads and writes. The SIO has a dedicated bus interface for each processor's IOPORT, as shown in
Figure 7
. Processors access their IOPORT with normal load and store instructions, directed to the special IOPORT address segment,
0xd0000000...0xdfffffff. The SIO appears as memory-mapped hardware within the IOPORT space.
i NOTE
The SIO is not connected to the main system bus due to its tight timing requirements. It can only be accessed by the processors, or by the debugger via the processor debug ports.
Figure 7. The single-cycle IO block contains memory-mapped hardware which the processors must be able to access quickly. The FIFOs and spinlocks support message passing and synchronisation between the two cores. The shared GPIO registers provide fast and concurrency-safe direct access to GPIO-capable pins. Some core-local arithmetic hardware can be used to accelerate common tasks on the processors.

The diagram illustrates the single-cycle IO block architecture. Two cores, Core 0 and Core 1, are shown at the top, each connected to the system via an IOPORT. These IOPORTs connect to a central block labeled 'Single-cycle IO'. Inside this block, there are two 'Bus Interface' blocks, one for each core. Between these interfaces are several shared peripherals: 'CPUID 0' and 'CPUID 1' (each connected to its respective core interface), 'FIFO 0 to 1' and 'FIFO 1 to 0' (bidirectional), 'Hardware Spinlock x32', and three pairs of arithmetic units: 'Integer Divider', 'Interpolator 0', and 'Interpolator 1'. At the bottom of the central block is a large 'GPIO Registers Shared, atomic set/clear/xor' block. This block is connected to the bus interfaces and has a 'GPIO x36' output line leading to 'To GPIO Muxing'.
All IOPORT reads and writes (and therefore all SIO accesses) take place in exactly one cycle, unlike the main AHB-Lite system bus, where the Cortex-M0+ requires two cycles for a load or store, and may have to wait longer due to contention from other system bus masters. This is vital for interfaces such as GPIO, which have tight timing requirements.
SIO registers are mapped to word-aligned addresses in the range
0xd0000000...0xd000017c. The remainder of the IOPORT space is reserved for future use.
The SIO peripherals are described in more detail in the following sections.
2.3.1.1. CPUID
The register
CPUID is the first register in the IOPORT space. Core 0 reads a value of 0 when accessing this address, and core 1 reads a value of 1. This is a convenient method for software to determine on which core it is running. This is checked during the initial boot sequence: both cores start running simultaneously, core 1 goes into a deep sleep state, and core 0 continues with the main boot sequence.
! IMPORTANT
CPUID should not be confused with the Cortex-M0+
CPUID register (Section 2.4.4.1.1) on each processor's internal Private Peripheral Bus, which lists the processor's part number and version.
2.3.1.2. GPIO Control
The processors have access to GPIO registers for fast and direct control of pins with GPIO functionality. There are two identical sets of registers:
- • GPIO_x for direct control of IO bank 0 (user GPIOs 0 to 29, starting at the LSB)
- • GPIO_HI_x for direct control of the QSPI IO bank (in the order SCLK, SSn, SD0, SD1, SD2, SD3, starting at the LSB)
NOTE
To drive a pin with the SIO's GPIO registers, the GPIO multiplexer for this pin must first be configured to select the SIO GPIO function. See Table 279 .
These GPIO registers are shared between the two cores, and both cores can access them simultaneously. There are three registers for each bank:
- • Output registers, GPIO_OUT and GPIO_HI_OUT , are used to set the output level of the GPIO (1/0 for high/low)
- • Output enable registers, GPIO_OE and GPIO_HI_OE , are used to enable the output driver. 0 for high-impedance, 1 for drive high/low based on GPIO_OUT and GPIO_HI_OUT .
- • Input registers, GPIO_IN and GPIO_HI_IN , allow the processor to sample the current state of the GPIOs
Reading GPIO_IN returns all 30 GPIO values (or 6 for GPIO_HI_IN ) in a single read. Software can then mask out individual pins it is interested in.
SDK: https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/hardware_gpio/include/hardware/gpio.h Lines 859 - 869
859 static inline bool gpio_get(uint gpio) {
860 #ifdef NUM_BANK0_GPIOS <= 32
861 return sio_hw->gpio_in & (1u << gpio);
862 #else
863 if (gpio < 32) {
864 return sio_hw->gpio_in & (1u << gpio);
865 } else {
866 return sio_hw->gpio_hi_in & (1u << (gpio - 32));
867 }
868 #endif
869 }The OUT and OE registers also have atomic SET, CLR, and XOR aliases, which allows software to update a subset of the pins in one operation. This is vital not only for safe parallel GPIO access between the two cores, but also safe concurrent GPIO access in an interrupt handler and foreground code running on one core.
SDK: https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/hardware_gpio/include/hardware/gpio.h Lines 908 - 914
908 static inline void gpio_set_mask(uint32_t mask) {
909 #ifdef PICO_USE_GPIO_COPROCESSOR
910 gpior_lo_out_set(mask);
911 #else
912 sio_hw->gpio_set = mask;
913 #endif
914 }SDK: https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/hardware_gpio/include/hardware/gpio.h Lines 955 - 961
955 static inline void gpio_clr_mask(uint32_t mask) {
956 #ifdef PICO_USE_GPIO_COPROCESSOR
957 gpior_lo_out_clr(mask);
958 #else
959 sio_hw->gpio_clr = mask;
960 #endif
961 }SDK: https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/hardware_gpio/include/hardware/gpio.h Lines 1145 - 1170
1145 static inline void gpio_put(uint gpio, bool value) {
1146 #ifdef PICO_USE_GPIO_COPROCESSOR
1147 gpioc_bit_out_put(gpio, value);
1148 #elif NUM_BANK0_GPIOS <= 32
1149 uint32_t mask = 1ul << gpio;
1150 if (value)
1151 gpio_set_mask(mask);
1152 else
1153 gpio_clr_mask(mask);
1154 #else
1155 uint32_t mask = 1ul << (gpio & 0x1fu);
1156 if (gpio < 32) {
1157 if (value) {
1158 sio_hw->gpio_set = mask;
1159 } else {
1160 sio_hw->gpio_clr = mask;
1161 }
1162 } else {
1163 if (value) {
1164 sio_hw->gpio_hi_set = mask;
1165 } else {
1166 sio_hw->gpio_hi_clr = mask;
1167 }
1168 }
1169 #endif
1170 }
If both processors write to an OUT or OE register (or any of its SET/CLR/XOR aliases) on the same clock cycle, the result is as though core 0 wrote first, and core 1 wrote immediately afterward. For example, if core 0 SETs a bit, and core 1 simultaneously XORs it, the bit will be set to 0, irrespective of its original value.
i NOTE
This is a conceptual model for the result that is produced when two cores write to a GPIO register simultaneously. The register does not actually contain this intermediate value at any point. In the previous example, if the pin is initially 0, and core 0 performs a SET while core 1 performs a XOR, the GPIO output remains low without any positive glitch.
2.3.1.3. Hardware Spinlocks
The SIO provides 32 hardware spinlocks, which can be used to manage mutually-exclusive access to shared software resources. Each spinlock is a one-bit flag, mapped to a different address (from SPINLOCK0 to SPINLOCK31 ). Software interacts with each spinlock with one of the following operations:
- • Read: attempt to claim the lock. Read value is nonzero if the lock was successfully claimed, or zero if the lock had already been claimed by a previous read.
- • Write (any value): release the lock. The next attempt to claim the lock will be successful.
If both cores try to claim the same lock on the same clock cycle, core 0 succeeds.
Generally software will acquire a lock by repeatedly polling the lock bit ("spinning" on the lock) until it is successfully claimed. This is inefficient if the lock is held for long periods, so generally the spinlocks should be used to protect the short critical sections of higher-level primitives such as mutexes, semaphores and queues.
For debugging purposes, the current state of all 32 spinlocks can be observed via SPINLOCK_ST .
2.3.1.4. Inter-processor FIFOs (Mailboxes)
The SIO contains two FIFOs for passing data, messages or ordered events between the two cores. Each FIFO is 32 bits wide, and eight entries deep. One of the FIFOs can only be written by core 0, and read by core 1. The other can only be written by core 1, and read by core 0.
Each core writes to its outgoing FIFO by writing to
FIFO_WR, and reads from its incoming FIFO by reading from
FIFO_RD. A status register,
FIFO_ST, provides the following status signals:
- • Incoming FIFO contains data (
VLD) - • Outgoing FIFO has room for more data (
RDY) - • The incoming FIFO was read from while empty at some point in the past (
ROE) - • The outgoing FIFO was written to while full at some point in the past (
WOF)
Writing to the outgoing FIFO while full, or reading from the incoming FIFO while empty, does not affect the FIFO state. The current contents and level of the FIFO is preserved. However, this does represent some loss of data or reception of invalid data by the software accessing the FIFO, so a sticky error flag is raised (
ROE or
WOF).
The SIO has a FIFO IRQ output for each core, mapped to system IRQ numbers 15 and 16. Each IRQ output is the logical OR of the
VLD,
ROE and
WOF bits in that core's
FIFO_ST register: that is, the IRQ is asserted if any of these three bits is high, and clears again when they are all low. The
ROE and
WOF flags are cleared by writing any value to
FIFO_ST, and the
VLD flag is cleared by reading data from the FIFO until empty.
If the corresponding interrupt line is enabled in the Cortex-M0+ NVIC, then the processor will take an interrupt each time data appears in its FIFO, or if it has performed some invalid FIFO operation (read on empty, write on full). Typically Core 0 will use IRQ15 and core 1 will use IRQ16. If the IRQs are used the other way round then it is difficult for the core that has been interrupted to correctly identify the reason for the interrupt as the core doesn't have access to the other core's FIFO status register.
i NOTE
ROE and
WOF only become set if software misbehaves in some way. Generally, the interrupt handler will trigger when data appears in the FIFO (raising the
VLD flag), and the interrupt handler clears the IRQ by reading data from the FIFO until
VLD goes low once more.
The inter-processor FIFOs and the Cortex-M0+ Event signals are used by the bootrom (Section 2.8)
wait_for_vector routine, where core 1 remains in a sleep state until it is woken, and provided with its initial stack pointer, entry point and vector table through the FIFO.
2.3.1.5. Integer Divider
The SIO provides one 8-cycle signed/unsigned divide/modulo module to each of the cores. Calculation is started by writing a dividend and divisor to the two argument registers,
DIVIDEND and
DIVISOR. The divider calculates the quotient / and remainder % of this division over the next 8 cycles, and on the 9th cycle the results can be read from the two result registers
DIV_QUOTIENT and
DIV_REMAINDER. A 'ready' bit in register
DIV_CSR can be polled to wait for the calculation to complete, or software can insert a fixed 8-cycle delay.
SDK: https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/hardware_divider/divider.S Lines 12 - 16
12 regular_func_with_section hw_divider_divmod_s32 13 ldr r3, =(SIO_BASE) 14 str r0, [r3, #SIO_DIV_SDIVIDEND_OFFSET] 15 str r1, [r3, #SIO_DIV_SDIVISOR_OFFSET] 16 b hw_divider_divmod_return
Image: Note icon
NOTESoftware is free to perform other non-divider operations during these 8 cycles.
There are two aliases of the operand registers: writing to the signed alias ( DIV_SDIVIDEND and DIV_SDIVISOR ) will initiate a signed calculation, and the other ( DIV_UDIVIDEND and DIV_UDIVISOR ) will initiate an unsigned calculation.
SDK: https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/hardware_divider/divider.S Lines 20 - 24
20 regular_func_with_section hw_divider_divmod_u32 21 ldr r3, =(SIO_BASE) 22 str r0, [r3, #SIO_DIV_UDIVIDEND_OFFSET] 23 str r1, [r3, #SIO_DIV_UDIVISOR_OFFSET] 24 b hw_divider_divmod_return
Image: Note icon
NOTEA new calculation begins immediately with every write to an operand register, and a new operand write immediately squashes any calculation currently in progress. For example, when dividing many numbers by the same divisor, only xDIVISOR needs to be written, and the signedness of each calculation is determined by whether SDIVIDEND or UDIVIDEND is written.
To support save and restore on interrupt handler entry/exit (or on e.g. an RTOS context switch), the result registers are also writable. Writing to a result register will cancel any operation in progress at the time. The DIV_CSR.DIRTY flag can help make save/restore more efficient: this flag is set when any divider register (operand or result) is written to, and cleared when the quotient is read.
Image: Note icon
NOTEWhen enabled, the default divider AEABI support maps C level
/ and
% to the hardware divider. When building software using the SDK and using the divider directly, it is important to read the quotient register
last
. This ensures the partial divider state will be correctly saved and restored by any interrupt code that uses the divider. You should read the quotient register whether you need the value or not.
The SDK module
pico_divider
https://github.com/raspberrypi/pico-sdk/blob/master/src/common/pico_divider_headers/include/pico/divider.h
provides both the AEABI implementation needed to hook the C
/ and
% operators for both 32-bit and 64-bit integer division, as well as some additional C functions that return quotients and remainders at the same time. All of these functions correctly save and restore the hardware divider state (when dirty) so that they can be used in either user or IRQ handler code.
The SDK module
hardware_divider
https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/hardware_divider/include/hardware/divider.h
provides lower level macros and helper functions for accessing the hardware divider, but these do not save and restore the hardware divider state (although this header does provide separate functions to do so).
2.3.1.6. Interpolator
Each core is equipped with two interpolators ( INTERP0 and INTERP1 ) which can accelerate tasks by combining certain pre-configured operations into a single processor cycle. Intended for cases where the pre-configured operation is repeated many times, this results in code which uses both fewer CPU cycles and fewer CPU registers in the time-critical sections of the code.
The interpolators are used to accelerate audio operations within the SDK, but their flexible configuration makes it possible to optimise many other tasks such as quantization and dithering, table lookup address generation, affine texture mapping, decompression and linear feedback.
Figure 8. An interpolator. The two accumulator registers and three base registers have single-cycle read/write access from the processor. The interpolator is organised into two lanes, which perform masking, shifting and sign-extension operations on the two accumulators. This produces three possible results, by adding the intermediate shift/mask values to the three base registers. From left to right, the multiplexers on each lane are controlled by the following flags in the CTRL registers: CROSS_RESULT, CROSS_INPUT, SIGNED, ADD_RAW.

The processor can write or read any interpolator register in one cycle, and the results are ready on the next cycle. The processor can also perform an addition on one of the two accumulators
ACCUM0 or
ACCUM1 by writing to the corresponding
ACCUMx_ADD register.
The three results are available in the read-only locations
PEEK0,
PEEK1,
PEEK2. Reading from these locations does not change the state of the interpolator. The results are also aliased at the locations
POP0,
POP1,
POP2; reading from a
POPx alias returns the same result as the corresponding
PEEKx, and simultaneously writes back the lane results to the accumulators. This can be used to advance the state of interpolator each time a result is read.
Additionally the interpolator supports simple fractional blending between two values as well as clamping values such that they lie within a given range.
The following example shows a trivial example of popping a lane result to produce simple iterative feedback.
Pico Examples: https://github.com/raspberrypi/pico-examples/blob/master/interp/hello_interp/hello_interp.c Lines 11 - 23
11 void times_table() {
12 puts("9 times table:");
13
14 // Initialise lane 0 on interp0 on this core
15 interp_config cfg = interp_default_config();
16 interp_set_config(interp0, 0, &cfg);
17
18 interp0->accum[0] = 0;
19 interp0->base[0] = 9;
20
21 for (int i = 0; i < 10; ++i)
22 printf("%d\n", interp0->pop[0]);
23 }NOTE
By sheer coincidence, the interpolators are extremely well suited to SNES MODE7-style graphics routines. For example, on each core,
INTERP0 can provide a stream of tile lookups for some affine transform, and
INTERP1 can provide offsets into the tiles for the same transform.
2.3.1.6.1. Lane Operations
Figure 9. Each lane of each interpolator can be configured to perform mask, shift and sign-extension on one of the accumulators. This is fed into adders which produces final results, which may optionally be fed back into the accumulators with each read. The datapath can be configured using a handful of 32-bit multiplexers. From left to right, these are controlled by the following CTRL flags: CROSS_RESULT, CROSS_INPUT, SIGNED, ADD_RAW.

Each lane performs these three operations, in sequence:
- • A right shift by
CTRL_LANE x _SHIFT(0 to 31 bits) - • A mask of bits from
CTRL_LANE x _MASK_LSBtoCTRL_LANE x _MASK_MSBinclusive (each ranging from bit 0 to bit 31) - • A sign extension from the top of the mask, i.e. take bit
CTRL_LANE x _MASK_MSBand OR it into all more-significant bits, ifCTRL_LANE x _SIGNEDis set
For example, if:
- •
ACCUM0 = 0xdeadbeef - •
CTRL_LANE0_SHIFT = 8 - •
CTRL_LANE0_MASK_LSB = 4 - •
CTRL_LANE0_MASK_MSB = 7 - •
CTRL_SIGNED = 1
Then lane 0 would produce the following results at each stage:
- • Right shift by 8 to produce
0x00deadbe - • Mask bits 7 to 4 to produce
0x00deadbe & 0x000000f0 = 0x000000b0 - • Sign-extend up from bit 7 to produce
0xffffffb0
In software:
Pico Examples: https://github.com/raspberrypi/pico-examples/blob/master/interp/hello_interp/hello_interp.c Lines 25 - 46
25 void moving_mask() {
26 interp_config cfg = interp_default_config();
27 interp0->accum[0] = 0x1234abcd;
28
29 puts("Masking:");
30 printf("ACCUM0 = %08x\n", interp0->accum[0]);
31 for (int i = 0; i < 8; ++i) {
32 // LSB, then MSB. These are inclusive, so 0,31 means "the entire 32 bit register"
33 interp_config_set_mask(&cfg, i * 4, i * 4 + 3);
34 interp_set_config(interp0, 0, &cfg);
35 // Reading from ACCUMx_ADD returns the raw lane shift and mask value, without BASEx
36 printf("Nibble %d: %08x\n", i, interp0->add_raw[0]);
37 }
38
39 puts("Masking with sign extension:");
40 interp_config_set_signed(&cfg, true);
41 for (int i = 0; i < 8; ++i) {
42 interp_config_set_mask(&cfg, i * 4, i * 4 + 3);
43 interp_set_config(interp0, 0, &cfg);
44 printf("Nibble %d: %08x\n", i, interp0->add_raw[0]);
45 }
46 }
The above example should print:
ACCUM0 = 1234abcd Nibble 0: 0000000d Nibble 1: 000000c0 Nibble 2: 00000b00 Nibble 3: 0000a000 Nibble 4: 00040000 Nibble 5: 00300000 Nibble 6: 02000000 Nibble 7: 10000000 Masking with sign extension: Nibble 0: ffffffff Nibble 1: ffffffff Nibble 2: fffffb00 Nibble 3: fffa0000 Nibble 4: 00040000 Nibble 5: 00300000 Nibble 6: 02000000 Nibble 7: 10000000
Changing the result and input multiplexers can create feedback between the accumulators. This is useful e.g. for audio dithering.
Pico Examples: https://github.com/raspberrypi/pico-examples/blob/master/interp/hello_interp/hello_interp.c Lines 48 - 66
48 void cross_lanes() {
49 interp_config cfg = interp_default_config();
50 interp_config_set_cross_result(&cfg, true);
51 // ACCUM0 gets lane 1 result:
52 interp_set_config(interp0, 0, &cfg);
53 // ACCUM1 gets lane 0 result:
54 interp_set_config(interp0, 1, &cfg);
55
56 interp0->accum[0] = 123;
57 interp0->accum[1] = 456;
58 interp0->base[0] = 1;
59 interp0->base[1] = 0;
60 puts("Lane result crossover:");
61 for (int i = 0; i < 10; ++i) {
62 uint32_t peek0 = interp0->peek[0];
63 uint32_t pop1 = interp0->pop[1];
64 printf("PEEK0, POP1: %d, %d\n", peek0, pop1);
65 }
66 }
This should print:
PEEK0, POP1: 124, 456 PEEK0, POP1: 457, 124 PEEK0, POP1: 125, 457 PEEK0, POP1: 458, 125 PEEK0, POP1: 126, 458 PEEK0, POP1: 459, 126 PEEK0, POP1: 127, 459 PEEK0, POP1: 460, 127 PEEK0, POP1: 128, 460 PEEK0, POP1: 461, 128
2.3.1.6.2. Blend Mode
Blend mode is available on INTERP0 on each core, and is enabled by the CTRL_LANE0_BLEN0 control flag. It performs linear interpolation, which we define as follows:
Where \( x_0 \) is the register BASE0 , \( x_1 \) is the register BASE1 , and \( \alpha \) is a fractional value formed from the least significant 8 bits of the lane 1 shift and mask value.
Blend mode has the following differences from normal mode:
- • PEEK0, POP0 return the 8-bit alpha value (the 8 LSBs of the lane 1 shift and mask value), with zeroes in result bits 31 down to 24.
- • PEEK1, POP1 return the linear interpolation between BASE0 and BASE1
- • PEEK2, POP2 do not include lane 1 result in the addition (i.e. it is BASE2 + lane 0 shift and mask value)
The result of the linear interpolation is equal to BASE0 when the alpha value is 0, and equal to BASE0 + 255/256 * ( BASE1 - BASE0 ) when the alpha value is all-ones.
Pico Examples: https://github.com/raspberrypi/pico-examples/blob/master/interp/hello_interp/hello_interp.c Lines 68 - 87
68 void simple_blend1() {
69 puts("Simple blend 1:");
70
71 interp_config cfg = interp_default_config();
72 interp_config_set_blend(&cfg, true);
73 interp_set_config(interp0, 0, &cfg);
74
75 cfg = interp_default_config();
76 interp_set_config(interp0, 1, &cfg);
77
78 interp0->base[0] = 500;
79 interp0->base[1] = 1000;
80
81 for (int i = 0; i <= 6; i++) {
82 // set fraction to value between 0 and 255
83 interp0->accum[1] = 255 * i / 6;
84 // ≈ 500 + (1000 - 500) * i / 6;
85 printf("%d\n", (int) interp0->peek[1]);
86 }
87 }This should print (note the 255/256 resulting in 998 not 1000):
500 582 666 748 832 914 998
CTRL_LANE1_SIGNED controls whether BASE0 and BASE1 are sign-extended for this interpolation (this sign extension is required because the interpolation produces an intermediate product value 40 bits in size). CTRL_LANE0_SIGNED continues to control the sign extension of the lane 0 intermediate result in PEEK2, POP2 as normal.
Pico Examples: https://github.com/raspberrypi/pico-examples/blob/master/interp/hello_interp/hello_interp.c Lines 90 - 121
90 void print_simple_blend2_results(bool is_signed) {
91 // lane 1 signed flag controls whether base 0/1 are treated as signed or unsigned
92 interp_config cfg = interp_default_config();
93 interp_config_set_signed(&cfg, is_signed);
94 interp_set_config(interp0, 1, &cfg);
95
96 for (int i = 0; i <= 6; i++) {
97 interp0->accum[1] = 255 * i / 6;
98 if (is_signed) {
99 printf("%d\n", (int) interp0->peek[1]);
100 } else {
101 printf("0x%08x\n", (uint) interp0->peek[1]);
102 }
103 }
104 }
105
106 void simple_blend2() {
107 puts("Simple blend 2:");
108
109 interp_config cfg = interp_default_config();
110 interp_config_set_blend(&cfg, true);
111 interp_set_config(interp0, 0, &cfg);
112
113 interp0->base[0] = (uint32_t) -1000;
114 interp0->base[1] = 1000;
115
116 puts("signed:");
117 print_simple_blend2_results(true);
118
119 puts("unsigned:");
120 print_simple_blend2_results(false);
121 }
This should print:
signed: -1000 -672 -336 -8 328 656 992 unsigned: 0xffffffc18 0xd5fffd60 0xaaffffeb0 0x80fffff8 0x56000148 0x2c000290 0x010003e0
Finally, in blend mode when using the
BASE_1AND0 register to send a 16-bit value to each of
BASE0 and
BASE1 with a single 32-bit write, the sign-extension of these 16-bit values to full 32-bit values during the write is controlled by
CTRL_LANE1_SIGNED for both bases, as opposed to non-blend-mode operation, where
CTRL_LANE0_SIGNED affects extension into
BASE0 and
CTRL_LANE1_SIGNED affects extension into
BASE1.
Pico Examples: https://github.com/raspberrypi/pico-examples/blob/master/interp/hello_interp/hello_interp.c Lines 124 - 145
124 void simple_blend3() {
125 puts("Simple blend 3:");
126
127 interp_config cfg = interp_default_config();
128 interp_config_set_blend(&cfg, true);
129 interp_set_config(interp0, 0, &cfg);
130
131 cfg = interp_default_config();
132 interp_set_config(interp0, 1, &cfg);
133
134 interp0->accum[1] = 128;
135 interp0->base01 = 0x30005000;
136 printf("0x%08x\n", (int) interp0->peek[1]);
137 interp0->base01 = 0xe000f000;
138 printf("0x%08x\n", (int) interp0->peek[1]);
139
140 interp_config_set_signed(&cfg, true);
141 interp_set_config(interp0, 1, &cfg);
142
143 interp0->base01 = 0xe000f000;
144 printf("0x%08x\n", (int) interp0->peek[1]);
145 }
This should print:
0x00004000 0x0000e800 0xffffe800
2.3.1.6.3. Clamp Mode
Clamp mode is available on INTERP1 on each core, and is enabled by the CTRL_LANE0_CLAMP control flag. In clamp mode, the PEEK0/POP0 result is the lane value (shifted, masked, sign-extended ACCUM0 ) clamped between BASE0 and BASE1 . In other words, if the lane value is greater than BASE1 , a value of BASE1 is produced; if less than BASE0 , a value of BASE0 is produced; otherwise, the value passes through. No addition is performed. The signedness of these comparisons is controlled by the CTRL_LANE0_SIGNED flag.
Other than this, the interpolator behaves the same as in normal mode.
Pico Examples: https://github.com/raspberrypi/pico-examples/blob/master/interp/hello_interp/hello_interp.c Lines 193 - 211
193 void clamp() {
194 puts("Clamp:");
195 interp_config cfg = interp_default_config();
196 interp_config_set_clamp(&cfg, true);
197 interp_config_set_shift(&cfg, 2);
198 // set mask according to new position of sign bit..
199 interp_config_set_mask(&cfg, 0, 29);
200 // ...so that the shifted value is correctly sign extended
201 interp_config_set_signed(&cfg, true);
202 interp_set_config(interp1, 0, &cfg);
203
204 interp1->base[0] = 0;
205 interp1->base[1] = 255;
206
207 for (int i = -1024; i <= 1024; i += 256) {
208 interp1->accum[0] = i;
209 printf("%d\t%d\n", i, (int) interp1->peek[0]);
210 }
211 }
This should print:
-1024 0 -768 0 -512 0 -256 0 0 0 256 64 512 128 768 192 1024 255
2.3.1.6.4. Sample Use Case: Linear Interpolation
Linear interpolation is a more complete example of using blend mode in conjunction with other interpolator functionality:
In this example,
ACCUM0 is used to track a fixed point (integer/fraction) position within a list of values to be interpolated. Lane 0 is used to produce an address into the value array for the integer part of the position. The fractional part of the position is shifted to produce a value from 0-255 for the blend. The blend is performed between two consecutive values in the array.
Finally the fractional position is updated via a single write to
ACCUM0_ADD_RAW.
Pico Examples: https://github.com/raspberrypi/pico-examples/blob/master/interp/hello_interp/hello_interp.c Lines 147 - 191
147 void linear_interpolation() {
148 puts("Linear interpolation:");
149 const int uv_fractional_bits = 12;
150
151 // for lane 0
152 // shift and mask XXXX XXXX XXXX XXXX XXXX FFFF FFFF FFFF (accum 0)
153 // to 0000 0000 000X XXXX XXXX XXXX XXXX XXX0
154 // i.e. non fractional part times 2 (for uint16_t)
155 interp_config cfg = interp_default_config();
156 interp_config_set_shift(&cfg, uv_fractional_bits - 1);
157 interp_config_set_mask(&cfg, 1, 32 - uv_fractional_bits);
158 interp_config_set_blend(&cfg, true);
159 interp_set_config(interp0, 0, &cfg);
160
161 // for lane 1
162 // shift XXXX XXXX XXXX XXXX XXXX FFFF FFFF FFFF (accum 0 via cross input)
163 // to 0000 XXXX XXXX XXXX XXXX FFFF FFFF FFFF
164
165 cfg = interp_default_config();
166 interp_config_set_shift(&cfg, uv_fractional_bits - 8);
167 interp_config_set_signed(&cfg, true);
168 interp_config_set_cross_input(&cfg, true); // signed blending
169 interp_set_config(interp0, 1, &cfg);
170
171 int16_t samples[] = {0, 10, -20, -1000, 500};
172
173 // step is 1/4 in our fractional representation
174 uint step = (1 << uv_fractional_bits) / 4;
175
176 interp0->accum[0] = 0; // initial sample_offset;
177 interp0->base[2] = (uintptr_t) samples;
178 for (int i = 0; i < 16; i++) {
179 // result2 = samples + (lane0 raw result)
180 // i.e. ptr to the first of two samples to blend between
181 int16_t *sample_pair = (int16_t *) interp0->peek[2];
182 interp0->base[0] = sample_pair[0];
183 interp0->base[1] = sample_pair[1];
184 uint32_t peek1 = interp0->peek[1];
185 uint32_t add_raw1 = interp0->add_raw[1];
186 printf("%d\t(%d%% between %d and %d)\n", (int) peek1,
187 100 * (add_raw1 & 0xff) / 0xff,
188 sample_pair[0], sample_pair[1]);
189 interp0->add_raw[0] = step;
190 }
191 }
This should print:
0 (0% between 0 and 10) 2 (25% between 0 and 10) 5 (50% between 0 and 10) 7 (75% between 0 and 10) 10 (0% between 10 and -20) 2 (25% between 10 and -20) -5 (50% between 10 and -20) -13 (75% between 10 and -20) -20 (0% between -20 and -1000) -265 (25% between -20 and -1000) -510 (50% between -20 and -1000) -755 (75% between -20 and -1000) -1000 (0% between -1000 and 500) -625 (25% between -1000 and 500) -250 (50% between -1000 and 500) 125 (75% between -1000 and 500)
This method is used for fast approximate audio upscaling in the SDK
2.3.1.6.5. Sample Use Case: Simple Affine Texture Mapping
Simple affine texture mapping can be implemented by using fixed point arithmetic for texture coordinates, and stepping a fixed amount in each coordinate for every pixel in a scanline. The integer part of the texture coordinates are used to form an address within the texture to lookup a pixel colour.
By using two lanes, all three base values and the
CTRL_LANE
x
_ADD_RAW flag, it is possible to reduce what would be quite an expensive CPU operation to a single cycle iteration using the interpolator.
Pico Examples: https://github.com/raspberrypi/pico-examples/blob/master/interp/hello_interp/hello_interp.c Lines 214 - 272
214 void texture_mapping_setup(uint8_t *texture, uint texture_width_bits, uint
texture_height_bits,
215 uint uv_fractional_bits) {
216 interp_config cfg = interp_default_config();
217 // set add_raw flag to use raw (un-shifted and un-masked) lane accumulator value when
adding
218 // it to the lane base to make the lane result
219 interp_config_set_add_raw(&cfg, true);
220 interp_config_set_shift(&cfg, uv_fractional_bits);
221 interp_config_set_mask(&cfg, 0, texture_width_bits - 1);
222 interp_set_config(interp0, 0, &cfg);
223
224 interp_config_set_shift(&cfg, uv_fractional_bits - texture_width_bits);
225 interp_config_set_mask(&cfg, texture_width_bits, texture_width_bits +
texture_height_bits - 1);
226 interp_set_config(interp0, 1, &cfg);
227
228 interp0->base[2] = (uintptr_t) texture;
229 }
230
231 void texture_mapped_span(uint8_t *output, uint32_t u, uint32_t v, uint32_t du, uint32_t dv,
uint count) {
232 // u, v are texture coordinates in fixed point with uv_fractional_bits fractional bits
233 // du, dv are texture coordinate steps across the span in same fixed point.
234 interp0->accum[0] = u;
235 interp0->base[0] = du;
236 interp0->accum[1] = v;
237 interp0->base[1] = dv;
238 for (uint i = 0; i < count; i++) {
239 // equivalent to
240 // uint32_t sm_result0 = (accum0 >> uv_fractional_bits) & (1 << (texture_width_bits -
1);
241 // uint32_t sm_result1 = (accum1 >> uv_fractional_bits) & (1 << (texture_height_bits -
1);
242 // uint8_t *address = texture + sm_result0 + (sm_result1 << texture_width_bits);
243 // output[i] = *address;
244 // accum0 = du + accum0;
245 // accum1 = dv + accum1;
246
247 // result2 is the texture address for the current pixel;
248 // popping the result advances to the next iteration
249 output[i] = *(uint8_t *) interp0->pop[2];
250 }
251 }
252
253 void texture_mapping() {
254 puts("Affine Texture mapping (with texture wrap):");
255
256 uint8_t texture[] = {
257 0x00, 0x01, 0x02, 0x03,
258 0x10, 0x11, 0x12, 0x13,
259 0x20, 0x21, 0x22, 0x23,
260 0x30, 0x31, 0x32, 0x33,
261 };
262 // 4x4 texture
263 texture_mapping_setup(texture, 2, 2, 16);
264 uint8_t output[12];
265 uint32_t du = 65536 / 2; // step of 1/2
266 uint32_t dv = 65536 / 3; // step of 1/3
267 texture_mapped_span(output, 0, 0, du, dv, 12);
268
269 for (uint i = 0; i < 12; i++) {
270 printf("0x%02x\n", output[i]);
271 }
272 }
This should print:
0x00
0x00
0x01
0x01
0x12
0x12
0x13
0x23
0x20
0x20
0x31
0x31
2.3.1.7. List of Registers
The SIO registers start at a base address of
0xd0000000(defined as
SIO_BASE in SDK).
Table 16. List of SIO registers
| Offset | Name | Info |
|---|---|---|
| 0x000 | CPUID | Processor core identifier |
| 0x004 | GPIO_IN | Input value for GPIO pins |
| 0x008 | GPIO_HI_IN | Input value for QSPI pins |
| 0x010 | GPIO_OUT | GPIO output value |
| 0x014 | GPIO_OUT_SET | GPIO output value set |
| 0x018 | GPIO_OUT_CLR | GPIO output value clear |
| 0x01c | GPIO_OUT_XOR | GPIO output value XOR |
| 0x020 | GPIO_OE | GPIO output enable |
| 0x024 | GPIO_OE_SET | GPIO output enable set |
| 0x028 | GPIO_OE_CLR | GPIO output enable clear |
| 0x02c | GPIO_OE_XOR | GPIO output enable XOR |
| 0x030 | GPIO_HI_OUT | QSPI output value |
| 0x034 | GPIO_HI_OUT_SET | QSPI output value set |
| 0x038 | GPIO_HI_OUT_CLR | QSPI output value clear |
| 0x03c | GPIO_HI_OUT_XOR | QSPI output value XOR |
| 0x040 | GPIO_HI_OE | QSPI output enable |
| 0x044 | GPIO_HI_OE_SET | QSPI output enable set |
| 0x048 | GPIO_HI_OE_CLR | QSPI output enable clear |
| 0x04c | GPIO_HI_OE_XOR | QSPI output enable XOR |
| 0x050 | FIFO_ST | Status register for inter-core FIFOs (mailboxes). |
| 0x054 | FIFO_WR | Write access to this core's TX FIFO |
| 0x058 | FIFO_RD | Read access to this core's RX FIFO |
| 0x05c | SPINLOCK_ST | Spinlock state |
| 0x060 | DIV_UDIVIDEND | Divider unsigned dividend |
| Offset | Name | Info |
|---|---|---|
| 0x064 | DIV_UDIVISOR | Divider unsigned divisor |
| 0x068 | DIV_SDIVIDEND | Divider signed dividend |
| 0x06c | DIV_SDIVISOR | Divider signed divisor |
| 0x070 | DIV_QUOTIENT | Divider result quotient |
| 0x074 | DIV_REMAINDER | Divider result remainder |
| 0x078 | DIV_CSR | Control and status register for divider. |
| 0x080 | INTERP0_ACCUM0 | Read/write access to accumulator 0 |
| 0x084 | INTERP0_ACCUM1 | Read/write access to accumulator 1 |
| 0x088 | INTERP0_BASE0 | Read/write access to BASE0 register. |
| 0x08c | INTERP0_BASE1 | Read/write access to BASE1 register. |
| 0x090 | INTERP0_BASE2 | Read/write access to BASE2 register. |
| 0x094 | INTERP0_POP_LANE0 | Read LANE0 result, and simultaneously write lane results to both accumulators (POP). |
| 0x098 | INTERP0_POP_LANE1 | Read LANE1 result, and simultaneously write lane results to both accumulators (POP). |
| 0x09c | INTERP0_POP_FULL | Read FULL result, and simultaneously write lane results to both accumulators (POP). |
| 0x0a0 | INTERP0_PEEK_LANE0 | Read LANE0 result, without altering any internal state (PEEK). |
| 0x0a4 | INTERP0_PEEK_LANE1 | Read LANE1 result, without altering any internal state (PEEK). |
| 0x0a8 | INTERP0_PEEK_FULL | Read FULL result, without altering any internal state (PEEK). |
| 0x0ac | INTERP0_CTRL_LANE0 | Control register for lane 0 |
| 0x0b0 | INTERP0_CTRL_LANE1 | Control register for lane 1 |
| 0x0b4 | INTERP0_ACCUM0_ADD | Values written here are atomically added to ACCUM0 |
| 0x0b8 | INTERP0_ACCUM1_ADD | Values written here are atomically added to ACCUM1 |
| 0x0bc | INTERP0_BASE_1AND0 | On write, the lower 16 bits go to BASE0, upper bits to BASE1 simultaneously. |
| 0x0c0 | INTERP1_ACCUM0 | Read/write access to accumulator 0 |
| 0x0c4 | INTERP1_ACCUM1 | Read/write access to accumulator 1 |
| 0x0c8 | INTERP1_BASE0 | Read/write access to BASE0 register. |
| 0x0cc | INTERP1_BASE1 | Read/write access to BASE1 register. |
| 0x0d0 | INTERP1_BASE2 | Read/write access to BASE2 register. |
| 0x0d4 | INTERP1_POP_LANE0 | Read LANE0 result, and simultaneously write lane results to both accumulators (POP). |
| 0x0d8 | INTERP1_POP_LANE1 | Read LANE1 result, and simultaneously write lane results to both accumulators (POP). |
| 0x0dc | INTERP1_POP_FULL | Read FULL result, and simultaneously write lane results to both accumulators (POP). |
| 0x0e0 | INTERP1_PEEK_LANE0 | Read LANE0 result, without altering any internal state (PEEK). |
| Offset | Name | Info |
|---|---|---|
| 0x0e4 | INTERP1_PEEK_LANE1 | Read LANE1 result, without altering any internal state (PEEK). |
| 0x0e8 | INTERP1_PEEK_FULL | Read FULL result, without altering any internal state (PEEK). |
| 0x0ec | INTERP1_CTRL_LANE0 | Control register for lane 0 |
| 0x0f0 | INTERP1_CTRL_LANE1 | Control register for lane 1 |
| 0x0f4 | INTERP1_ACCUM0_ADD | Values written here are atomically added to ACCUM0 |
| 0x0f8 | INTERP1_ACCUM1_ADD | Values written here are atomically added to ACCUM1 |
| 0x0fc | INTERP1_BASE_1AND0 | On write, the lower 16 bits go to BASE0, upper bits to BASE1 simultaneously. |
| 0x100 | SPINLOCK0 | Spinlock register 0 |
| 0x104 | SPINLOCK1 | Spinlock register 1 |
| 0x108 | SPINLOCK2 | Spinlock register 2 |
| 0x10c | SPINLOCK3 | Spinlock register 3 |
| 0x110 | SPINLOCK4 | Spinlock register 4 |
| 0x114 | SPINLOCK5 | Spinlock register 5 |
| 0x118 | SPINLOCK6 | Spinlock register 6 |
| 0x11c | SPINLOCK7 | Spinlock register 7 |
| 0x120 | SPINLOCK8 | Spinlock register 8 |
| 0x124 | SPINLOCK9 | Spinlock register 9 |
| 0x128 | SPINLOCK10 | Spinlock register 10 |
| 0x12c | SPINLOCK11 | Spinlock register 11 |
| 0x130 | SPINLOCK12 | Spinlock register 12 |
| 0x134 | SPINLOCK13 | Spinlock register 13 |
| 0x138 | SPINLOCK14 | Spinlock register 14 |
| 0x13c | SPINLOCK15 | Spinlock register 15 |
| 0x140 | SPINLOCK16 | Spinlock register 16 |
| 0x144 | SPINLOCK17 | Spinlock register 17 |
| 0x148 | SPINLOCK18 | Spinlock register 18 |
| 0x14c | SPINLOCK19 | Spinlock register 19 |
| 0x150 | SPINLOCK20 | Spinlock register 20 |
| 0x154 | SPINLOCK21 | Spinlock register 21 |
| 0x158 | SPINLOCK22 | Spinlock register 22 |
| 0x15c | SPINLOCK23 | Spinlock register 23 |
| 0x160 | SPINLOCK24 | Spinlock register 24 |
| 0x164 | SPINLOCK25 | Spinlock register 25 |
| 0x168 | SPINLOCK26 | Spinlock register 26 |
| 0x16c | SPINLOCK27 | Spinlock register 27 |
| Offset | Name | Info |
|---|---|---|
| 0x170 | SPINLOCK28 | Spinlock register 28 |
| 0x174 | SPINLOCK29 | Spinlock register 29 |
| 0x178 | SPINLOCK30 | Spinlock register 30 |
| 0x17c | SPINLOCK31 | Spinlock register 31 |
SIO: CPUID Register
Offset: 0x000
Description
Processor core identifier
Table 17. CPUID Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | Value is 0 when read from processor core 0, and 1 when read from processor core 1. | RO | - |
SIO: GPIO_IN Register
Offset: 0x004
Description
Input value for GPIO pins
Table 18. GPIO_IN Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:30 | Reserved. | - | - |
| 29:0 | Input value for GPIO0...29 | RO | 0x00000000 |
SIO: GPIO_HI_IN Register
Offset: 0x008
Description
Input value for QSPI pins
Table 19. GPIO_HI_IN Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:6 | Reserved. | - | - |
| 5:0 | Input value on QSPI IO in order 0..5: SCLK, SSn, SD0, SD1, SD2, SD3 | RO | 0x00 |
SIO: GPIO_OUT Register
Offset: 0x010
Description
GPIO output value
Table 20. GPIO_OUT Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:30 | Reserved. | - | - |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 29:0 | Set output level (1/0 → high/low) for GPIO0...29. Reading back gives the last value written, NOT the input value from the pins. If core 0 and core 1 both write to GPIO_OUT simultaneously (or to a SET/CLR/XOR alias), the result is as though the write from core 0 took place first, and the write from core 1 was then applied to that intermediate result. | RW | 0x00000000 |
SIO: GPIO_OUT_SET Register
Offset: 0x014
Description
GPIO output value set
Table 21.
GPIO_OUT_SET
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:30 | Reserved. | - | - |
| 29:0 | Perform an atomic bit-set on GPIO_OUT, i.e.
GPIO_OUT |= wdata | WO | 0x00000000 |
SIO: GPIO_OUT_CLR Register
Offset: 0x018
Description
GPIO output value clear
Table 22.
GPIO_OUT_CLR
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:30 | Reserved. | - | - |
| 29:0 | Perform an atomic bit-clear on GPIO_OUT, i.e.
GPIO_OUT &= ~wdata | WO | 0x00000000 |
SIO: GPIO_OUT_XOR Register
Offset: 0x01c
Description
GPIO output value XOR
Table 23.
GPIO_OUT_XOR
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:30 | Reserved. | - | - |
| 29:0 | Perform an atomic bitwise XOR on GPIO_OUT, i.e.
GPIO_OUT ^= wdata | WO | 0x00000000 |
SIO: GPIO_OE Register
Offset: 0x020
Description
GPIO output enable
Table 24. GPIO_OE
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:30 | Reserved. | - | - |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 29:0 | Set output enable (1/0 → output/input) for GPIO0...29. Reading back gives the last value written. If core 0 and core 1 both write to GPIO_OE simultaneously (or to a SET/CLR/XOR alias), the result is as though the write from core 0 took place first, and the write from core 1 was then applied to that intermediate result. | RW | 0x00000000 |
SIO: GPIO_OE_SET Register
Offset: 0x024
Description
GPIO output enable set
Table 25.
GPIO_OE_SET Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:30 | Reserved. | - | - |
| 29:0 | Perform an atomic bit-set on GPIO_OE, i.e. \( \text{GPIO\_OE} |= \text{wdata} \) | WO | 0x00000000 |
SIO: GPIO_OE_CLR Register
Offset: 0x028
Description
GPIO output enable clear
Table 26.
GPIO_OE_CLR Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:30 | Reserved. | - | - |
| 29:0 | Perform an atomic bit-clear on GPIO_OE, i.e. \( \text{GPIO\_OE} \&= \sim\text{wdata} \) | WO | 0x00000000 |
SIO: GPIO_OE_XOR Register
Offset: 0x02c
Description
GPIO output enable XOR
Table 27.
GPIO_OE_XOR
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:30 | Reserved. | - | - |
| 29:0 | Perform an atomic bitwise XOR on GPIO_OE, i.e. \( \text{GPIO\_OE} \wedge= \text{wdata} \) | WO | 0x00000000 |
SIO: GPIO_HI_OUT Register
Offset: 0x030
Description
QSPI output value
Table 28.
GPIO_HI_OUT Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:6 | Reserved. | - | - |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 5:0 | Set output level (1/0 → high/low) for QSPI IO0...5. Reading back gives the last value written, NOT the input value from the pins. If core 0 and core 1 both write to GPIO_HI_OUT simultaneously (or to a SET/CLR/XOR alias), the result is as though the write from core 0 took place first, and the write from core 1 was then applied to that intermediate result. | RW | 0x00 |
SIO: GPIO_HI_OUT_SET Register
Offset: 0x034
Description
QSPI output value set
Table 29.
GPIO_HI_OUT_SET
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:6 | Reserved. | - | - |
| 5:0 | Perform an atomic bit-set on GPIO_HI_OUT, i.e.
GPIO_HI_OUT |= wdata | WO | 0x00 |
SIO: GPIO_HI_OUT_CLR Register
Offset: 0x038
Description
QSPI output value clear
Table 30.
GPIO_HI_OUT_CLR
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:6 | Reserved. | - | - |
| 5:0 | Perform an atomic bit-clear on GPIO_HI_OUT, i.e.
GPIO_HI_OUT &= ~wdata | WO | 0x00 |
SIO: GPIO_HI_OUT_XOR Register
Offset: 0x03c
Description
QSPI output value XOR
Table 31.
GPIO_HI_OUT_XOR
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:6 | Reserved. | - | - |
| 5:0 | Perform an atomic bitwise XOR on GPIO_HI_OUT, i.e.
GPIO_HI_OUT ^= wdata | WO | 0x00 |
SIO: GPIO_HI_OE Register
Offset: 0x040
Description
QSPI output enable
Table 32. GPIO_HI_OE
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:6 | Reserved. | - | - |
| Bits | Description | Type | Reset |
|---|---|---|---|
| 5:0 | Set output enable (1/0 → output/input) for QSPI I00...5. Reading back gives the last value written. If core 0 and core 1 both write to GPIO_HI_OE simultaneously (or to a SET/CLR/XOR alias), the result is as though the write from core 0 took place first, and the write from core 1 was then applied to that intermediate result. | RW | 0x00 |
SIO: GPIO_HI_OE_SET Register
Offset: 0x044
Description
QSPI output enable set
Table 33.
GPIO_HI_OE_SET
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:6 | Reserved. | - | - |
| 5:0 | Perform an atomic bit-set on GPIO_HI_OE, i.e.
GPIO_HI_OE |= wdata | WO | 0x00 |
SIO: GPIO_HI_OE_CLR Register
Offset: 0x048
Description
QSPI output enable clear
Table 34.
GPIO_HI_OE_CLR
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:6 | Reserved. | - | - |
| 5:0 | Perform an atomic bit-clear on GPIO_HI_OE, i.e.
GPIO_HI_OE &= ~wdata | WO | 0x00 |
SIO: GPIO_HI_OE_XOR Register
Offset: 0x04c
Description
QSPI output enable XOR
Table 35.
GPIO_HI_OE_XOR
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:6 | Reserved. | - | - |
| 5:0 | Perform an atomic bitwise XOR on GPIO_HI_OE, i.e.
GPIO_HI_OE ^= wdata | WO | 0x00 |
SIO: FIFO_ST Register
Offset: 0x050
Description
Status register for inter-core FIFOs (mailboxes).
There is one FIFO in the core 0 → core 1 direction, and one core 1 → core 0. Both are 32 bits wide and 8 words deep.
Core 0 can see the read side of the 1 → 0 FIFO (RX), and the write side of 0 → 1 FIFO (TX).
Core 1 can see the read side of the 0 → 1 FIFO (RX), and the write side of 1 → 0 FIFO (TX).
The SIO IRQ for each core is the logical OR of the VLD, WOF and ROE fields of its FIFO_ST register.
Table 36. FIFO_ST Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:4 | Reserved. | - | - |
| 3 | ROE : Sticky flag indicating the RX FIFO was read when empty. This read was ignored by the FIFO. | WC | 0x0 |
| 2 | WOF : Sticky flag indicating the TX FIFO was written when full. This write was ignored by the FIFO. | WC | 0x0 |
| 1 | RDY : Value is 1 if this core's TX FIFO is not full (i.e. if FIFO_WR is ready for more data) | RO | 0x1 |
| 0 | VLD : Value is 1 if this core's RX FIFO is not empty (i.e. if FIFO_RD is valid) | RO | 0x0 |
SIO: FIFO_WR Register
Offset: 0x054
Table 37. FIFO_WR Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | Write access to this core's TX FIFO | WF | 0x00000000 |
SIO: FIFO_RD Register
Offset: 0x058
Table 38. FIFO_RD Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | Read access to this core's RX FIFO | RF | - |
SIO: SPINLOCK_ST Register
Offset: 0x05c
Table 39. SPINLOCK_ST Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | Spinlock state A bitmap containing the state of all 32 spinlocks (1=locked). Mainly intended for debugging. | RO | 0x00000000 |
SIO: DIV_UDIVIDEND Register
Offset: 0x060
Table 40. DIV_UDIVIDEND Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | Divider unsigned dividend Write to the DIVIDEND operand of the divider, i.e. the p in \( p / q \) . Any operand write starts a new calculation. The results appear in QUOTIENT, REMAINDER. UDIVIDEND/SDIVIDEND are aliases of the same internal register. The U alias starts an unsigned calculation, and the S alias starts a signed calculation. | RW | 0x00000000 |
SIO: DIV_UDIVISOR Register
Offset: 0x064
Table 41.
DIV_UDIVISOR
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | Divider unsigned divisor Write to the DIVISOR operand of the divider, i.e. the q in \( p / q \) . Any operand write starts a new calculation. The results appear in QUOTIENT, REMAINDER. UDIVISOR/SDIVISOR are aliases of the same internal register. The U alias starts an unsigned calculation, and the S alias starts a signed calculation. | RW | 0x00000000 |
SIO: DIV_SDIVIDEND Register
Offset: 0x068
Table 42.
DIV_SDIVIDEND
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | Divider signed dividend The same as UDIVIDEND, but starts a signed calculation, rather than unsigned. | RW | 0x00000000 |
SIO: DIV_SDIVISOR Register
Offset: 0x06c
Table 43.
DIV_SDIVISOR
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | Divider signed divisor The same as UDIVISOR, but starts a signed calculation, rather than unsigned. | RW | 0x00000000 |
SIO: DIV_QUOTIENT Register
Offset: 0x070
Table 44.
DIV_QUOTIENT
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | Divider result quotient The result of \( DIVIDEND / DIVISOR \) (division). Contents undefined while CSR_READY is low. For signed calculations, QUOTIENT is negative when the signs of DIVIDEND and DIVISOR differ. This register can be written to directly, for context save/restore purposes. This halts any in-progress calculation and sets the CSR_READY and CSR_DIRTY flags. Reading from QUOTIENT clears the CSR_DIRTY flag, so should read results in the order REMAINDER, QUOTIENT if CSR_DIRTY is used. | RW | 0x00000000 |
SIO: DIV_REMAINDER Register
Offset: 0x074
Table 45.
DIV_REMAINDER
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | Divider result remainder The result of DIVIDEND % DIVISOR (modulo). Contents undefined while CSR_READY is low. For signed calculations, REMAINDER is negative only when DIVIDEND is negative. This register can be written to directly, for context save/restore purposes. This halts any in-progress calculation and sets the CSR_READY and CSR_DIRTY flags. | RW | 0x00000000 |
SIO: DIV_CSR Register
Offset: 0x078
Description
Control and status register for divider.
Table 46. DIV_CSR
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:2 | Reserved. | - | - |
| 1 | DIRTY
: Changes to 1 when any register is written, and back to 0 when QUOTIENT is read. Software can use this flag to make save/restore more efficient (skip if not DIRTY). If the flag is used in this way, it's recommended to either read QUOTIENT only, or REMAINDER and then QUOTIENT, to prevent data loss on context switch. | RO | 0x0 |
| 0 | READY
: Reads as 0 when a calculation is in progress, 1 otherwise. Writing an operand (xDIVIDEND, xDIVISOR) will immediately start a new calculation, no matter if one is already in progress. Writing to a result register will immediately terminate any in-progress calculation and set the READY and DIRTY flags. | RO | 0x1 |
SIO: INTERP0_ACCUM0 Register
Offset: 0x080
Table 47.
INTERP0_ACCUM0
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | Read/write access to accumulator 0 | RW | 0x00000000 |
SIO: INTERP0_ACCUM1 Register
Offset: 0x084
Table 48.
INTERP0_ACCUM1
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | Read/write access to accumulator 1 | RW | 0x00000000 |
SIO: INTERP0_BASE0 Register
Offset: 0x088
Table 49.
INTERP0_BASE0
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | Read/write access to BASE0 register. | RW | 0x00000000 |
SIO: INTERP0_BASE1 Register
Offset: 0x08c
Table 50.
INTERP0_BASE1
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | Read/write access to BASE1 register. | RW | 0x00000000 |
SIO: INTERP0_BASE2 Register
Offset: 0x090
Table 51.
INTERP0_BASE2
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | Read/write access to BASE2 register. | RW | 0x00000000 |
SIO: INTERP0_POP_LANE0 Register
Offset: 0x094
Table 52.
INTERP0_POP_LANE0
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | Read LANE0 result, and simultaneously write lane results to both accumulators (POP). | RO | 0x00000000 |
SIO: INTERP0_POP_LANE1 Register
Offset: 0x098
Table 53.
INTERP0_POP_LANE1
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | Read LANE1 result, and simultaneously write lane results to both accumulators (POP). | RO | 0x00000000 |
SIO: INTERP0_POP_FULL Register
Offset: 0x09c
Table 54.
INTERP0_POP_FULL
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | Read FULL result, and simultaneously write lane results to both accumulators (POP). | RO | 0x00000000 |
SIO: INTERP0_PEEK_LANE0 Register
Offset: 0x0a0
Table 55.
INTERP0_PEEK_LANE
0 Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | Read LANE0 result, without altering any internal state (PEEK). | RO | 0x00000000 |
SIO: INTERP0_PEEK_LANE1 Register
Offset: 0x0a4
Table 56.
INTERP0_PEEK_LANE
1 Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | Read LANE1 result, without altering any internal state (PEEK). | RO | 0x00000000 |
SIO: INTERP0_PEEK_FULL Register
Offset: 0x0a8
Table 57.
INTERP0_PEEK_FULL
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | Read FULL result, without altering any internal state (PEEK). | RO | 0x00000000 |
SIO: INTERP0_CTRL_LANE0 Register
Offset: 0x0ac
Description
Control register for lane 0
Table 58.
INTERP0_CTRL_LANE
0 Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:26 | Reserved. | - | - |
| 25 | OVERF : Set if either OVERF0 or OVERF1 is set. | RO | 0x0 |
| 24 | OVERF1 : Indicates if any masked-off MSBs in ACCUM1 are set. | RO | 0x0 |
| 23 | OVERF0 : Indicates if any masked-off MSBs in ACCUM0 are set. | RO | 0x0 |
| 22 | Reserved. | - | - |
| 21 | BLEND
: Only present on INTERP0 on each core. If BLEND mode is enabled: - LANE1 result is a linear interpolation between BASE0 and BASE1, controlled by the 8 LSBs of lane 1 shift and mask value (a fractional number between 0 and 255/256ths) - LANE0 result does not have BASE0 added (yields only the 8 LSBs of lane 1 shift+mask value) - FULL result does not have lane 1 shift+mask value added (BASE2 + lane 0 shift+mask) LANE1 SIGNED flag controls whether the interpolation is signed or unsigned. | RW | 0x0 |
| 20:19 | FORCE_MSB
: ORed into bits 29:28 of the lane result presented to the processor on the bus. No effect on the internal 32-bit datapath. Handy for using a lane to generate sequence of pointers into flash or SRAM. | RW | 0x0 |
| 18 | ADD_RAW : If 1, mask + shift is bypassed for LANE0 result. This does not affect FULL result. | RW | 0x0 |
| 17 | CROSS_RESULT : If 1, feed the opposite lane's result into this lane's accumulator on POP. | RW | 0x0 |
| 16 | CROSS_INPUT
: If 1, feed the opposite lane's accumulator into this lane's shift + mask hardware. Takes effect even if ADD_RAW is set (the CROSS_INPUT mux is before the shift+mask bypass) | RW | 0x0 |
| 15 | SIGNED : If SIGNED is set, the shifted and masked accumulator value is sign-extended to 32 bits before adding to BASE0, and LANE0 PEEK/POP appear extended to 32 bits when read by processor. | RW | 0x0 |
| Bits 14:10 9:5 4:0 Bits | Description SHIFT Description | MASK_MSB : The most-significant bit allowed to pass by the mask (inclusive) MASK_LSB : The least-significant bit allowed to pass by the mask (inclusive) : Logical right-shift applied to accumulator before masking | Type RW RW RW Type | Reset 0x00 0x00 0x00 Reset |
|---|---|---|---|---|
| 1 Register 31:21 | Reserved. | - | - | |
| 20:19 | FORCE_MSB sequence | : ORed into bits 29:28 of the lane result presented to the processor on the bus. | RW | 0x0 |
| 18 | ADD_RAW | of pointers into flash or SRAM. : If 1, mask + shift is bypassed for LANE1 result. This does not affect FULL result. | RW | 0x0 |
| 17 | CROSS_RESULT | : If 1, feed the opposite lane’s result into this lane’s accumulator on POP. | RW | 0x0 |
| 16 | CROSS_INPUT | : If 1, feed the opposite lane’s accumulator into this lane’s shift + mask hardware. Takes effect even if ADD_RAW is set (the CROSS_INPUT mux is before the shift+mask bypass) | RW | 0x0 |
| 15 | SIGNED | : If SIGNED is set, the shifted and masked accumulator value is sign- extended to 32 bits before adding to BASE1, and LANE1 PEEK/POP appear extended to 32 bits when read by processor. | RW | 0x0 |
| 14:10 | MASK_MSB | : The most-significant bit allowed to pass by the mask (inclusive) Setting MSB < LSB may cause chip to turn inside-out | RW | 0x00 |
| 9:5 | MASK_LSB | : The least-significant bit allowed to pass by the mask (inclusive) | RW | 0x00 |
| 4:0 SIO | SHIFT | : Logical right-shift applied to accumulator before masking : INTERP0_ACCUM0_ADD Register | RW | 0x00 |
| Table 60. Offset Bits INTERP0_ACCUM0_AD | : 0x0b4 Description | Type | Reset | |
| D Register 31:24 | Reserved. | - | - | |
| 23:0 | Values written here are atomically added to ACCUM0 | RW | 0x000000 |
SIO: INTERP0_CTRL_LANE1 Register
Offset: 0x0b0
Description
Control register for lane 1
Table 59.
INTERP0_CTRL_LANE1 Register
SIO: INTERP0_ACCUM0_ADD Register
Offset: 0x0b4
Table 60.
INTERP0_ACCUM0_ADD Register
SIO: INTERP0_ACCUM1_ADD Register
Offset: 0x0b8
Table 61.
INTERP0_ACCUM1_AD
D Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:24 | Reserved. | - | - |
| 23:0 | Values written here are atomically added to ACCUM1 Reading yields lane 1's raw shift and mask value (BASE1 not added). | RW | 0x000000 |
SIO: INTERP0_BASE_1AND0 Register
Offset: 0x0bc
Table 62.
INTERP0_BASE_1AND
0 Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | On write, the lower 16 bits go to BASE0, upper bits to BASE1 simultaneously. Each half is sign-extended to 32 bits if that lane's SIGNED flag is set. | WO | 0x00000000 |
SIO: INTERP1_ACCUM0 Register
Offset: 0x0c0
Table 63.
INTERP1_ACCUM0
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | Read/write access to accumulator 0 | RW | 0x00000000 |
SIO: INTERP1_ACCUM1 Register
Offset: 0x0c4
Table 64.
INTERP1_ACCUM1
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | Read/write access to accumulator 1 | RW | 0x00000000 |
SIO: INTERP1_BASE0 Register
Offset: 0x0c8
Table 65.
INTERP1_BASE0
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | Read/write access to BASE0 register. | RW | 0x00000000 |
SIO: INTERP1_BASE1 Register
Offset: 0x0cc
Table 66.
INTERP1_BASE1
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | Read/write access to BASE1 register. | RW | 0x00000000 |
SIO: INTERP1_BASE2 Register
Offset: 0x0d0
Table 67.
INTERP1_BASE2
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | Read/write access to BASE2 register. | RW | 0x00000000 |
SIO: INTERP1_POP_LANE0 Register
Offset: 0x0d4
Table 68.
INTERP1_POP_LANE0
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | Read LANE0 result, and simultaneously write lane results to both accumulators (POP). | RO | 0x00000000 |
SIO: INTERP1_POP_LANE1 Register
Offset: 0x0d8
Table 69.
INTERP1_POP_LANE1
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | Read LANE1 result, and simultaneously write lane results to both accumulators (POP). | RO | 0x00000000 |
SIO: INTERP1_POP_FULL Register
Offset: 0x0dc
Table 70.
INTERP1_POP_FULL
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | Read FULL result, and simultaneously write lane results to both accumulators (POP). | RO | 0x00000000 |
SIO: INTERP1_PEEK_LANE0 Register
Offset: 0x0e0
Table 71.
INTERP1_PEEK_LANE
0 Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | Read LANE0 result, without altering any internal state (PEEK). | RO | 0x00000000 |
SIO: INTERP1_PEEK_LANE1 Register
Offset: 0x0e4
Table 72.
INTERP1_PEEK_LANE
1 Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | Read LANE1 result, without altering any internal state (PEEK). | RO | 0x00000000 |
SIO: INTERP1_PEEK_FULL Register
Offset: 0x0e8
Table 73.
INTERP1_PEEK_FULL
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | Read FULL result, without altering any internal state (PEEK). | RO | 0x00000000 |
SIO: INTERP1_CTRL_LANE0 Register
Offset: 0x0ec
Description
Control register for lane 0
Table 74.
INTERP1_CTRL_LANE
0 Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:26 | Reserved. | - | - |
| 25 | OVERF : Set if either OVERF0 or OVERF1 is set. | RO | 0x0 |
| 24 | OVERF1 : Indicates if any masked-off MSBs in ACCUM1 are set. | RO | 0x0 |
| 23 | OVERF0 : Indicates if any masked-off MSBs in ACCUM0 are set. | RO | 0x0 |
| Bits 14:10 9:5 4:0 Bits | Description SHIFT Description | MASK_MSB : The most-significant bit allowed to pass by the mask (inclusive) MASK_LSB : The least-significant bit allowed to pass by the mask (inclusive) : Logical right-shift applied to accumulator before masking | Type RW RW RW Type | Reset 0x00 0x00 0x00 Reset |
|---|---|---|---|---|
| 21 | Reserved. | - | - | |
| 20:19 | FORCE_MSB sequence | : ORed into bits 29:28 of the lane result presented to the processor on the bus. | RW | 0x0 |
| 18 | ADD_RAW | of pointers into flash or SRAM. : If 1, mask + shift is bypassed for LANE0 result. This does not affect FULL result. | RW | 0x0 |
| 17 | CROSS_RESULT | : If 1, feed the opposite lane’s result into this lane’s accumulator on POP. | RW | 0x0 |
| 16 | CROSS_INPUT | : If 1, feed the opposite lane’s accumulator into this lane’s shift + mask hardware. Takes effect even if ADD_RAW is set (the CROSS_INPUT mux is before the shift+mask bypass) | RW | 0x0 |
| 15 | SIGNED | : If SIGNED is set, the shifted and masked accumulator value is sign- extended to 32 bits before adding to BASE0, and LANE0 PEEK/POP appear extended to 32 bits when read by processor. | RW | 0x0 |
| 14:10 | MASK_MSB | : The most-significant bit allowed to pass by the mask (inclusive) Setting MSB < LSB may cause chip to turn inside-out | RW | 0x00 |
| 9:5 | MASK_LSB | : The least-significant bit allowed to pass by the mask (inclusive) | RW | 0x00 |
| 4:0 SIO | SHIFT | : Logical right-shift applied to accumulator before masking : INTERP1_CTRL_LANE1 Register | RW | 0x00 |
| Table 75. Description Bits INTERP1_CTRL_LANE | Description | Type | Reset | |
| 1 Register 31:21 | Reserved. | - | - | |
| 20:19 | FORCE_MSB sequence | : ORed into bits 29:28 of the lane result presented to the processor on the bus. | RW | 0x0 |
| 18 | ADD_RAW | of pointers into flash or SRAM. : If 1, mask + shift is bypassed for LANE1 result. This does not affect FULL result. | RW | 0x0 |
| 17 | CROSS_RESULT | : If 1, feed the opposite lane’s result into this lane’s accumulator on POP. | RW | 0x0 |
SIO: INTERP1_CTRL_LANE1 Register
Offset: 0x0f0
Description
Control register for lane 1
Table 75.
INTERP1_CTRL_LANE1 Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 16 | CROSS_INPUT
: If 1, feed the opposite lane's accumulator into this lane's shift + mask hardware. Takes effect even if ADD_RAW is set (the CROSS_INPUT mux is before the shift+mask bypass) | RW | 0x0 |
| 15 | SIGNED : If SIGNED is set, the shifted and masked accumulator value is sign-extended to 32 bits before adding to BASE1, and LANE1 PEEK/POP appear extended to 32 bits when read by processor. | RW | 0x0 |
| 14:10 | MASK_MSB
: The most-significant bit allowed to pass by the mask (inclusive) Setting MSB < LSB may cause chip to turn inside-out | RW | 0x00 |
| 9:5 | MASK_LSB : The least-significant bit allowed to pass by the mask (inclusive) | RW | 0x00 |
| 4:0 | SHIFT : Logical right-shift applied to accumulator before masking | RW | 0x00 |
SIO: INTERP1_ACCUM0_ADD Register
Offset: 0x0f4
Table 76.
INTERP1_ACCUM0_ADD
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:24 | Reserved. | - | - |
| 23:0 | Values written here are atomically added to ACCUM0 Reading yields lane 0's raw shift and mask value (BASE0 not added). | RW | 0x000000 |
SIO: INTERP1_ACCUM1_ADD Register
Offset: 0x0f8
Table 77.
INTERP1_ACCUM1_ADD
Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:24 | Reserved. | - | - |
| 23:0 | Values written here are atomically added to ACCUM1 Reading yields lane 1's raw shift and mask value (BASE1 not added). | RW | 0x000000 |
SIO: INTERP1_BASE_1AND0 Register
Offset: 0x0fc
Table 78.
INTERP1_BASE_1AND
0 Register
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | On write, the lower 16 bits go to BASE0, upper bits to BASE1 simultaneously. Each half is sign-extended to 32 bits if that lane's SIGNED flag is set. | WO | 0x00000000 |
SIO: SPINLOCK0, SPINLOCK1, ..., SPINLOCK30, SPINLOCK31 Registers
Offsets: 0x100, 0x104, ..., 0x178, 0x17c
Table 79. SPINLOCK0,
SPINLOCK1, ...,
SPINLOCK30,
SPINLOCK31
Registers
| Bits | Description | Type | Reset |
|---|---|---|---|
| 31:0 | Reading from a spinlock address will:
Writing (any value) releases the lock. If core 0 and core 1 attempt to claim the same lock simultaneously, core 0 wins. The value returned on success is \( 0x1 \ll \text{lock number} \) . | RW | 0x00000000 |
2.3.2. Interrupts
Each core is equipped with a standard ARM Nested Vectored Interrupt Controller (NVIC) which has 32 interrupt inputs. Each NVIC has the same interrupts routed to it, with the exception of the GPIO interrupts: there is one GPIO interrupt per bank, per core. These are completely independent, so e.g. core 0 can be interrupted by GPIO 0 in bank 0, and core 1 by GPIO 1 in the same bank.
On RP2040, only the lower 26 IRQ signals are connected on the NVIC, and IRQs 26 to 31 are tied to zero (never firing). The core can still be forced to enter the relevant interrupt handler by writing bits 26 to 31 in the NVIC ISPR register.
Table 80. Interrupts
| IRQ | Interrupt Source | IRQ | Interrupt Source | IRQ | Interrupt Source | IRQ | Interrupt Source | IRQ | Interrupt Source |
|---|---|---|---|---|---|---|---|---|---|
| 0 | TIMER_IRQ_0 | 6 | XIP_IRQ | 12 | DMA_IRQ_1 | 18 | SPI0_IRQ | 24 | I2C1_IRQ |
| 1 | TIMER_IRQ_1 | 7 | PIO0_IRQ_0 | 13 | IO_IRQ_BANK0 | 19 | SPI1_IRQ | 25 | RTC_IRQ |
| 2 | TIMER_IRQ_2 | 8 | PIO0_IRQ_1 | 14 | IO_IRQ_QSPI | 20 | UART0_IRQ | ||
| 3 | TIMER_IRQ_3 | 9 | PIO1_IRQ_0 | 15 | SIO_IRQ_PROC0 | 21 | UART1_IRQ | ||
| 4 | PWM_IRQ_WRAP | 10 | PIO1_IRQ_1 | 16 | SIO_IRQ_PROC1 | 22 | ADC_IRQ_FIFO | ||
| 5 | USBCTRL_IRQ | 11 | DMA_IRQ_0 | 17 | CLOCKS_IRQ | 23 | I2C0_IRQ |
i NOTE
XIP_IRQ is from the SSI block that makes up part of the XIP block. It could be used in a configuration where code is running from SRAM instead of flash. In this configuration, the XIP block could be used as a normal SSI peripheral.
Nested interrupts are supported in hardware: a lower-priority interrupt can be preempted by a higher-priority interrupt (or another exception e.g. HardFault), and the lower-priority interrupt will resume once higher-priority exceptions have completed. The priority order is determined by:
- • First, the dynamic priority level configured per interrupt by the NVIC_IPR0-7 registers. The Cortex-M0+ implements the two most significant bits of an 8-bit priority field, so four priority levels are available, and the numerically-lowest level (level 0) is the highest priority.
- • Second, for interrupts with the same dynamic priority level, the lower-numbered IRQ has higher priority (using the IRQ numbers given in the table above).
Some care has gone into arranging the RP2040 interrupt table to give a sensible default priority ordering, but individual interrupts can be raised or lowered in priority, using NVIC_IPR0 through NVIC_IPR7 , to suit a particular use case.
The 26 system IRQ signals are masked (NMI mask) and then ORed together creating the NMI signal for the core. The NMI mask for each core can be configured using PROC0_NMI_MASK and PROC1_NMI_MASK in the Syscfg register block. Each of these registers has one bit for each system interrupt, and the each core's NMI is asserted if a system interrupt is asserted and the corresponding NMI mask bit is set for that core.
⚠ CAUTIONIf the watchdog is armed, and some bits are set on the core 1 NMI mask, the RESETS block (and hence Syscfg) should be included in the watchdog reset list. Otherwise, following a watchdog event, core 1 NMI may be asserted when the core enter the bootrom. It is safe for core 0 to take an NMI when entering the bootrom (the handler will clear the NMI mask).
2.3.3. Event Signals
The Cortex-M0+ can enter a sleep state until an "event" (or interrupt) takes place, using the WFE instruction. It can also generate events, using the SEV instruction. On RP2040 the event signals are cross-wired between the two processors, so that an event sent by one processor will be received on the other.
i NOTEThe event flag is "sticky", so if both processors send an event ( SEV ) simultaneously, and then both go to sleep ( WFE ), they will both wake immediately, rather than getting stuck in a sleep state.
While in a WFE (or WFI ) sleep state, the processor can shut off its internal clock gates, consuming much less power. When both processors are sleeping, and the DMA is inactive, RP2040 as a whole can enter a sleep state, disabling clocks on unused infrastructure such as the busfabric, and waking automatically when one of the processors wakes. See Section 2.11.2 .
2.3.4. Debug
The 2-wire Serial Wire Debug (SWD) port provides access to hardware and software debug features including:
- • Loading firmware into SRAM or external flash memory
- • Control of processor execution: run/halt, step, set breakpoints, other standard Arm debug functionality
- • Access to processor architectural state
- • Access to memory and memory-mapped IO via the system bus
The SWD bus is exposed on two dedicated pins and is immediately available after power-on.
i NOTEWe recommend a max SWD frequency of 24MHz. This depends heavily on your setup. You may need to run much slower (1MHz) depending on the quality and length of your cables.
Debug access is via independent DAPs (one per core) attached to a shared multidrop SWD bus (SWD v2). Each DAP will only respond to debug commands if correctly addressed by a SWD TARGETSEL command; all others tristate their outputs. Additionally, a Rescue DP (see Section 2.3.4.2 ) is available which is connected to system control features. Default addresses of each debug port are given below:
- • Core 0: 0x01002927
- • Core 1: 0x11002927
- • Rescue DP: 0xf1002927
The Instance IDs (top 4 bits of ID above) can be changed via a sysconfig register which may be useful in a multichip application. However note that ID=0xf is reserved for the internal Rescue DP (see Section 2.3.4.2 ).
Figure 10. RP2040 Debugging

2.3.4.1. Software control of SWD pins
The SWD pins for Core 0 and Core 1 can be bit-banged via registers in syscfg (see DBGFORCE ). This means that Core 1 could run a USB application that allows debug of Core 0, or similar.
2.3.4.2. Rescue DP
The Rescue DP (debug port) is available over the SWD bus and is only intended for use in the specific case where the chip has locked up, for example if code has been programmed into flash which permanently halts the system clock: in such a case, the normal debugger can not communicate with the processors to return the system to a working state, so more drastic action is needed. A rescue is invoked by setting the CDBGPWRUPREQ bit in the Rescue DP’s CTRL/STAT register.
This causes a hard reset of the chip (functionally similar to a power-on-reset), and sets a flag in the Chip Level Reset block to indicate that a rescue reset took place. The bootrom checks this flag almost immediately in the initial boot process (before watchdog, flash or USB boot), acknowledges by clearing the bit, then halts the processor. This leaves the system in a safe state, with the system clock running, so that the debugger can reattach to the cores and load fresh code.
For a practical example of using the Rescue DP, see the Hardware design with RP2040 book.