Article by:
Date Published:
Last Modified:


The RP2040 is a 32-bit 133MHz dual-core ARM Cortex-M0+ microcontroller designed by Raspberry Pi Ltd. It was announced on Jan 21st, 2021 as is the first microcontroller designed by Raspberry Pi Ltd, with the intention of being a cheaper, real-time, hardware orientated computing platform to provide alongside the more powerful RaspberryPi. One distinguishing feature of the RP2040 compared to other microcontrollers is the unique Programmable I/O (PIO) subsystem.

Photo of the RP2040 IC in it's 56-pin 7x7mm QFN package[^bib-rpi-rp2040-product-page].

Photo of the RP2040 IC in it’s 56-pin 7x7mm QFN package1.

The datasheet for the RP2040 can be found at https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf.

The RP2040 is not a family of microcontrollers (as typical with other vendors), it is a single 56pin, 7x7mm QFN component with a 0.4mm pitch.

Pinout for the RP2040 microcontroller, which is in a QFN-56-7x7 package[^bib-rpi-rp2040-ds].

Pinout for the RP2040 microcontroller, which is in a QFN-56-7x7 package2.


The RP2040 contains the following2:

  • Dual ARM Cortex-M0+ @ 133MHz
  • 264kB on-chip SRAM in six independent banks
  • Support for up to 16MB of off-chip Flash memory via dedicated QSPI bus
  • DMA controller
  • Fully-connected AHB crossbar
  • Interpolator and integer divider peripherals
  • On-chip programmable LDO to generate core voltage
  • 2 on-chip PLLs to generate USB and core clocks
  • 30 GPIO pins, 4 of which can be used as analogue inputs
  • Peripherals
A system overview (functional block diagram) of the RP2040 microcontroller[^bib-rpi-rp2040-hardware-design].

A system overview (functional block diagram) of the RP2040 microcontroller3.

For needed peripherals that are not listed above, rather than having to bit-bang them, the 8 PIO state machines allow you to create custom hardware logic to perform these tasks.

For complex designs, the relatively small number of GPIO (30, with only four of them being able to be used as analogue inputs) may become a limiting factor, or may necessitate the use of IO expanders. Whilst the clock speed is blistering fast for a Cortex-M0+, this particular architecture does not contain a floating point unit (FPU), meaning float-point arithmetic has to be done in software.

The RP2040 has a large amount (256kB) of on-board RAM, but it does not contain any on-board flash (non-volatile memory). Application code must be provided on external NOR flash memory via a SPI, DSPI or QSPI interface (which is pretty standard thing to do amongst powerful microcontrollers, less-powerful microcontrollers generally contain on-board flash).

Dividing the SRAM into 6 banks, with dedicated AHB buses, allows bus masters to access different banks of memory at the same time (to increase processor performance).

Raspberry Pi Pico SDK

The Raspberry Pi Pico SDK is a collection of C headers, C libraries and a CMake build system for compiling bare metal applications for RP2040-based devices4. It can be used to build applications for the Raspberry Pi Pico, but is generalized to work with all board designs (even though the name suggests otherwise).

The following C code shows how to print Hello, world! to a UART using the SDK5:

int main() {
    // Initialise UART 0
    uart_init(uart0, 115200);
    // Set the GPIO pin mux to the UART - 0 is TX, 1 is RX
    gpio_set_function(0, GPIO_FUNC_UART);
    gpio_set_function(1, GPIO_FUNC_UART);
    uart_puts(uart0, "Hello world!");


  1. Raspberry Pi Ltd. RP2040 (product page). Retrieved 2022-06-07, from https://www.raspberrypi.com/products/rp2040/↩︎

  2. Raspberry Pi Ltd. RP2040 Datasheet: A microcontroller by Raspberry Pi.. Retrieved 2022-06-07, from https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf↩︎ ↩︎

  3. Raspberry Pi Ltd. Hardware design with RP2040: Using RP2040 microcontrollers to build boards and products. Retrieved 2022-06-07, from https://datasheets.raspberrypi.com/rp2040/hardware-design-with-rp2040.pdf↩︎

  4. Raspberry Pi Ltd. Raspberry Pi Pico SDK. Retrieved 2022-06-07, from https://raspberrypi.github.io/pico-sdk-doxygen/↩︎

  5. Raspberry Pi Ltd. Raspberry Pi Pico SDK: UART Example. Retrieved 2022-06-07, from https://raspberrypi.github.io/pico-sdk-doxygen/group__hardware__uart.html#uart_example↩︎


Geoffrey Hunter

Dude making stuff.

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License .

Related Content:


comments powered by Disqus