How the RP2040 pin functions repeat
Unlike the ESP32, the RP2040 has no GPIO matrix: each peripheral signal can only appear on certain pins. The good news is that the table follows a regular pattern, so you can work it out without a datasheet.
I²C alternates every two pins: GP0 and GP1 are I²C0 SDA and SCL, GP2 and GP3 are I²C1, GP4 and GP5 are I²C0 again, and so on. SDA is always on an even pin and SCL on an odd one, and the two must belong to the same controller: GP4 with GP5 works, and so does GP4 with GP9.
SPI comes in groups of four pins, in the order RX (MISO), CSn, SCK and TX (MOSI). GP0 to GP7 belong to SPI0, GP8 to GP15 to SPI1, GP16 to GP23 to SPI0 again. UART follows a similar pattern, with TX on the first pin of each group of four and RX on the second.
PWM has 8 slices with two outputs each, A on even pins and B on odd ones. GP0 and GP16 both connect to slice 0 output A: if you use both, they carry the same signal. Two pins on the same slice, such as GP2 and GP3, share the frequency but can have different duty cycles.
Pins the board keeps for itself
Four RP2040 GPIOs are not on the header. GP23 controls the power-save mode of the switching converter, GP24 detects USB power, GP25 drives the onboard LED and GP29 measures VSYS through a divider on ADC3. On the Pico W, GP23 to GP25 are used by the wireless chip, GP29 is shared between its clock and the VSYS measurement, and the LED is controlled through the wireless chip.
Full Raspberry Pi Pico GPIO table
| GPIO | Pin | I²C | SPI | UART | PWM | ADC |
|---|---|---|---|---|---|---|
| GP0 | 1 | I2C0 SDA | SPI0 RX | UART0 TX | PWM0 A | — |
| GP1 | 2 | I2C0 SCL | SPI0 CSn | UART0 RX | PWM0 B | — |
| GP2 | 4 | I2C1 SDA | SPI0 SCK | UART0 CTS | PWM1 A | — |
| GP3 | 5 | I2C1 SCL | SPI0 TX | UART0 RTS | PWM1 B | — |
| GP4 | 6 | I2C0 SDA | SPI0 RX | UART1 TX | PWM2 A | — |
| GP5 | 7 | I2C0 SCL | SPI0 CSn | UART1 RX | PWM2 B | — |
| GP6 | 9 | I2C1 SDA | SPI0 SCK | UART1 CTS | PWM3 A | — |
| GP7 | 10 | I2C1 SCL | SPI0 TX | UART1 RTS | PWM3 B | — |
| GP8 | 11 | I2C0 SDA | SPI1 RX | UART1 TX | PWM4 A | — |
| GP9 | 12 | I2C0 SCL | SPI1 CSn | UART1 RX | PWM4 B | — |
| GP10 | 14 | I2C1 SDA | SPI1 SCK | UART1 CTS | PWM5 A | — |
| GP11 | 15 | I2C1 SCL | SPI1 TX | UART1 RTS | PWM5 B | — |
| GP12 | 16 | I2C0 SDA | SPI1 RX | UART0 TX | PWM6 A | — |
| GP13 | 17 | I2C0 SCL | SPI1 CSn | UART0 RX | PWM6 B | — |
| GP14 | 19 | I2C1 SDA | SPI1 SCK | UART0 CTS | PWM7 A | — |
| GP15 | 20 | I2C1 SCL | SPI1 TX | UART0 RTS | PWM7 B | — |
| GP16 | 21 | I2C0 SDA | SPI0 RX | UART0 TX | PWM0 A | — |
| GP17 | 22 | I2C0 SCL | SPI0 CSn | UART0 RX | PWM0 B | — |
| GP18 | 24 | I2C1 SDA | SPI0 SCK | UART0 CTS | PWM1 A | — |
| GP19 | 25 | I2C1 SCL | SPI0 TX | UART0 RTS | PWM1 B | — |
| GP20 | 26 | I2C0 SDA | SPI0 RX | UART1 TX | PWM2 A | — |
| GP21 | 27 | I2C0 SCL | SPI0 CSn | UART1 RX | PWM2 B | — |
| GP22 | 29 | I2C1 SDA | SPI0 SCK | UART1 CTS | PWM3 A | — |
| GP26 | 31 | I2C1 SDA | SPI1 SCK | UART1 CTS | PWM5 A | ADC0 |
| GP27 | 32 | I2C1 SCL | SPI1 TX | UART1 RTS | PWM5 B | ADC1 |
| GP28 | 34 | I2C0 SDA | SPI1 RX | UART0 TX | PWM6 A | ADC2 |
Default pins of the Pico SDK: I²C0 on GP4/GP5, SPI0 on GP16 to GP19, UART0 on GP0/GP1. MicroPython and Arduino cores can use other defaults, so check the documentation of the one you use.
Frequently asked questions
Is the Raspberry Pi Pico 5 V tolerant?
No. The RP2040 GPIOs work at 3.3 V and are not 5 V tolerant. Use a level shifter or a resistor divider for 5 V signals. VSYS accepts up to 5.5 V, but that is a power input, not a signal pin.
Which Pico pins are analog?
GP26, GP27 and GP28, on physical pins 31, 32 and 34, are the three ADC inputs on the header. A fourth channel, GP29, measures VSYS on the board, and a fifth reads the internal temperature sensor.
Can I use any pins for I2C on the Pico?
Not any pin, but many: the I²C functions alternate every two pins between I²C0 and I²C1. Pick SDA on an even pin and SCL on an odd pin of the same controller, for example GP4 and GP5 for I²C0, GP6 and GP7 for I²C1, or GP4 and GP9, both on I²C0.
Why do two PWM pins change together?
Pins whose numbers differ by 16, such as GP0 and GP16, connect to the same PWM slice and output. Setting one changes the other. Pick pins on different slices, or on the A and B outputs of the same slice if the same frequency is fine.
Does this pinout apply to the Pico W and the Pico 2?
The Pico W has the same header layout; only the internal pins GP23 to GP25 and GP29 change role, because they connect to the wireless chip. The Pico 2 also keeps the same header layout, but its RP2350 chip adds functions, so check its datasheet for the details.