RP2040

Everything about RP2040 controllers.

Overview

package

This new chip by the Raspberry Pi foundation finally replaces the outdated AVR microcontrollers and expensive/hard-to-get STM32 chips. It’s low cost coming in at just 1$ p.p. and most importantly it’s available in high volume!

The RP2040 features two ARM Cortex-M0+ 32-bit CPUs that operate at 133MHz, along with 264Kb of SRAM. For comparison the atmega32u4 chips used in Pro Micros only feature a single 8-bit RISC core operating at 16MHz, along with 2.5KB SRAM (they also have onboard flash, but sadly only 32KB).

So as you can tell it’s a pretty big upgrade from the 32U4 and I/O wise it’s also a beast:

  • 2 × UART, 2 × SPI controllers, 2 × I2C controllers, 16 × PWM channels
  • 1 × USB 1.1 controller and PHY, with host and device support
  • 8 × Programmable I/O (PIO) state machines for custom peripheral

The main star is the PIO making the use cases endless. Some options are ethernet, PIO USB host and much, much more.

floorplan

Power

The rp2040 needs 3.3V power instead of 5V like the 32u4.

3.3V

The easiest way to archive this is by using a 3.3V LDO to step down the 5V from the USB port.

1.1V

You might have spotted the voltage regulator in the floorplan image. it provides 1.1V for the cores.

Flash

Because the RP2040 doesn’t have built-in storage you need an external 3.3V (Q)SPI flash and you may use up to 128Mb / 16MB of it.

flash

For assembly/reflow soldering:

  • W25Q128JVPIQ | 16MB | WSON-8-EP(5x6mm)
  • W25Q64JVXGIQ | 8MB | XSON-8-EP(4x4mm)
  • W25Q32JVUUIQ | 4MB | USON-8(3x4mm)
  • W25Q16JVUXIQ | 2MB | USON-8-EP(2x3mm)

For hand soldering:

  • W25Q128JVSIQ | 16MB | SOIC-8-208mil
  • W25Q64JVSSIQ | 8MB | SOIC-8-208mil
  • W25Q32JVSSIQ | 4MB | SOIC-8-208mil
  • W25Q16JVSSIQ | 2MB | SOIC-8-208mil

Bootloader

The RP2040 comes with a bootloader etched into ROM (Read Only Memory).

After that, a second-stage bootloader takes over and runs code from the flash.

Entering the bootloader

To enter the bootloader you have to disable the flash chip on startup:

pull and hold QSPI_SS_N low and reset the controller by pulling RUN low.

You will see a new flash drive appear on your computer and you can drag and drop .uf2 files onto it to flash them.

Pinout

pinout

GPIO functions

Every GPIO can serve multiple functions thanks to the PIO fabric.

This for example enables you to place full duplex split transport almost anywhere on the chip (see col. F2):

GPIOF1F2F3F4F5F6F7F8F9
0SPI0 RXUART0 TXI2C0 SDAPWM0 ASIOPIO0PIO1USB OVCUR DET
1SPI0 CSnUART0 RXI2C0 SCLPWM0 BSIOPIO0PIO1USB VBUS DET
2SPI0 SCKUART0 CTSI2C1 SDAPWM1 ASIOPIO0PIO1USB VBUS EN
3SPI0 TXUART0 RTSI2C1 SCLPWM1 BSIOPIO0PIO1USB OVCUR DET
4SPI0 RXUART1 TXI2C0 SDAPWM2 ASIOPIO0PIO1USB VBUS DET
5SPI0 CSnUART1 RXI2C0 SCLPWM2 BSIOPIO0PIO1USB VBUS EN
6SPI0 SCKUART1 CTSI2C1 SDAPWM3 ASIOPIO0PIO1USB OVCUR DET
7SPI0 TXUART1 RTSI2C1 SCLPWM3 BSIOPIO0PIO1USB VBUS DET
8SPI1 RXUART1 TXI2C0 SDAPWM4 ASIOPIO0PIO1USB VBUS EN
9SPI1 CSnUART1 RXI2C0 SCLPWM4 BSIOPIO0PIO1USB OVCUR DET
10SPI1 SCKUART1 CTSI2C1 SDAPWM5 ASIOPIO0PIO1USB VBUS DET
11SPI1 TXUART1 RTSI2C1 SCLPWM5 BSIOPIO0PIO1USB VBUS EN
12SPI1 RXUART0 TXI2C0 SDAPWM6 ASIOPIO0PIO1USB OVCUR DET
13SPI1 CSnUART0 RXI2C0 SCLPWM6 BSIOPIO0PIO1USB VBUS DET
14SPI1 SCKUART0 CTSI2C1 SDAPWM7 ASIOPIO0PIO1USB VBUS EN
15SPI1 TXUART0 RTSI2C1 SCLPWM7 BSIOPIO0PIO1USB OVCUR DET
16SPI0 RXUART0 TXI2C0 SDAPWM0 ASIOPIO0PIO1USB VBUS DET
17SPI0 CSnUART0 RXI2C0 SCLPWM0 BSIOPIO0PIO1USB VBUS EN
18SPI0 SCKUART0 CTSI2C1 SDAPWM1 ASIOPIO0PIO1USB OVCUR DET
19SPI0 TXUART0 RTSI2C1 SCLPWM1 BSIOPIO0PIO1USB VBUS DET
20SPI0 RXUART1 TXI2C0 SDAPWM2 ASIOPIO0PIO1CLOCK GPIN0USB VBUS EN
21SPI0 CSnUART1 RXI2C0 SCLPWM2 BSIOPIO0PIO1CLOCK GPOUT0USB OVCUR DET
22SPI0 SCKUART1 CTSI2C1 SDAPWM3 ASIOPIO0PIO1CLOCK GPIN1USB VBUS DET
23SPI0 TXUART1 RTSI2C1 SCLPWM3 BSIOPIO0PIO1CLOCK GPOUT1USB VBUS EN
24SPI1 RXUART1 TXI2C0 SDAPWM4 ASIOPIO0PIO1CLOCK GPOUT2USB OVCUR DET
25SPI1 CSnUART1 RXI2C0 SCLPWM4 BSIOPIO0PIO1CLOCK GPOUT3USB VBUS DET
26SPI1 SCKUART1 CTSI2C1 SDAPWM5 ASIOPIO0PIO1USB VBUS EN
27SPI1 TXUART1 RTSI2C1 SCLPWM5 BSIOPIO0PIO1USB OVCUR DET
28SPI1 RXUART0 TXI2C0 SDAPWM6 ASIOPIO0PIO1USB VBUS DET
29SPI1 CSnUART0 RXI2C0 SCLPWM6 BSIOPIO0PIO1USB VBUS EN

QMKs naming for GPIO

To reference the RP2040s GPIO you use GP* where * is the GPIO number (not the pin number).

Die Shot

Look at this beauty: die

Top