Raspberry Pi Pico – Getting Started Guide

In this post, we are going to discuss the Raspberry Pi Pico development board which is the first development board from the Raspberry Pi in the microcontroller series. It can be programmed with micropython as well as  C/C++ SDK. Raspberry Pi Pico is a low-cost, high-performance board based on the Raspberry Pi RP2040 microcontroller chip. RP2040 chip contains a dual-core cortex M0+ microcontroller which can operate up to 133MHz This chip offers 26 multi-function GPIO pins and 2MB of onboard Flash memory. 

Raspberry Pi Pico development board

Raspberry Pi Pico Pinout 

The following picture shows the pinout diagram of the Raspberry Pi Pico development board. It provides a total of 40 pins including, 26 GPIO pins, eight GND, 3 debugging, and Vcc pins. The color marking at the bottom end of this pinout diagram shows Power, ground, UART, GPIO, PWM, ADC, SPI, I2C, system control, and Debugging pins. It is a 21×51 ‘DIP’ style 1mm thick PCB. 

Raspberry Pi Pico pinout diagram

All GPIO pins have multiple functions. For example, GP0 and GP1 pins can be used as digital input, digital output, I2C0 ( SDA and SCK pins), UART0 ( Rx and Tx). But only one alternate function can be used at a time. 

Raspberry Pi Pico Peripherals

Now let’s see the pin configuration details of all peripherals which are supported by the Raspberry Pi Pico development board: 

GPIO Pins

Raspberry Pi Pico exposes 26 multi-function GPIO pins from a total of 36 GPIO pins available in RP2040 microcontroller. Out of these 26 pins, 23 pins are digital pins, and only 3 pins have analog read capability. These digital pins are marked as GP0, GP1, and up to GP22. GP23, GP24, and GP25 are not exposed on the pinout. Therefore cannot be used. GP26, GP27, and GP28 are the next digital pins available. These 26 GPIO pins can be used both in digital input and digital output mode. 

GPIO Interrupt Pins

All GPIO pins can be configured as an external interrupt pin on the following four changes on the state of GPIO pins:

  1. Level high
  2. Level Low
  3. Positive edge ( transition from active low to active high)
  4. Negative edge ( transition from active high to active low)

Note: The Raspberry Pi Pico’s GPIOs are connected to the on-board 3.3V rail and are therefore fixed at 3.3V.

RPi Pico ADC Pins

It supports four 12-bit SAR based analog to digital converters. But only three analog channels are exposed to pinout. The fourth analog channel is internal connected to the internal temperature sensor. Therefore, if we want to measure temperature, we can directly use build-in temperature by reading the analog value of ADC4. The following table shows that the input signal for ADC0, ADC1, and ADC2 can be connected with GP26, GP27, and GP28 pins, respectively. 

ADC ModuleGPIO Pins
ADC0GP26
ADC1GP27
ADC2GP28

A/D conversion can be performed in polling, interrupt, and FIFO with DMA mode. 

ADC conversion speed per sample is 2μs that is 500kS/s. Because RP2040 microcontroller operates on 48MHZ clock frequency which comes from USB PLL. ADC takes 96 CPU clock cycles to perform one conversion. Therefore, the sampling frequency is 

96 x 1 / 48MHz) = 2 μs per sample (500kS/s).

I2C Pins

RP2040 chip has two I2C controllers. Both I2C controllers are accessible through GPIO pins of Raspberry Pi Pico. The following table shows the connection of GPIO pins with both I2C controllers. Each connection of the controller can be configured through multiple GPIO pins as shown in the figure. But before using an I2C controller, you should configure in software which GPIO pins you want to use with a specific I2C controller. 

I2C ControllerGPIO Pins
I2C0 – SDAGP0/GP4/GP8/GP12/GP16/GP20
I2C0 – SCLGP1/GP5/GP9/GP13/GP17/GP21
I2C1 – SDAGP2/GP6/GP10/GP14/GP18/GP26
I2C1 – SCLGP3/GP7/GP11/GP15/GP19/GP27

I2C controller of RP4020 chip supports the following features: 

  • Master or Slave Mode ( Default salve address = 0x055)
  • Three speed modes such as Standard ( m 0 to 100 Kb/s) , Fast( ess than or equal to 400 Kb/s)  and Fast Plus mode ( s less than or equal to 1000 Kb/s)
  • Transmit and Recieve Buffers 
  • Can be used in interrupt and DMA mode

SPI Pins

RP2040 chip supports two SPI peripherals. Both SPI module pins are accessible through GPIO pins of Raspberry Pi Pico. The following table shows the connection of GPIO pins with both SPI modules. Each connection of SPI controller pins can be configured through multiple GPIO pins as shown in the figure. But before using SPI, you should configure in software which GPIO pins you want to use with a specific SP peripheral. 

SPI ControllerGPIO Pins
SPI0_RXGP0/GP4/GP16
SPI0_TXGP3/GP7/GP19
SPI0_CLKGP2/GP6/GP18
SPI0_CSnGP1/GP5/GP17
SPI1_RXGP8/GP12/
SPI1_TXGP11/GP15/
SPI1_CLKGP10/GP14/
SPI1_CSnGP9/GP13/

Each SPI controller supports master and slave mode and are compatible with the following four modes: 

  • Motorola SPI Interface
  • TI Serial Interface
  • National Semiconductor Serial Interface

It has 8 buffers for each transmitter and receiver of the SPI controller. Moreover, it can also be driven with interrupt or DMA. 

UART Pins

RP2040 contains two identical UART peripherals with separate 32×8 Tx and 32×12 Rx FIFOs. The following table lists the GPIO pins for both UART peripherals which are exposed on Raspberry Pi Pico development board pinouts. 

UART PinsGPIO Pins
UART0-TXGP0/GP12/GP16
UART0-RXGP1/GP13/GP17
UART1-TXGP4/GP8
UART1-RXGP5/GP9

Some of the prominent features of UART peripherals are: 

  • Programmable Buad rate generator
  • Supports standard asynhcronous communication bits such as start, stop and parity bit.
  • Programmable hardware serial flow control

PWM Pins

RP2040 microcontroller contains 8 PWM blocks and each PWM block provides two PWM signals. That means each slice can drive up to two PWM signals. Hence, there is a total of 16 PWM signal output available on Raspberry Pi Pico. All GPIO pins can be configured to get any PWM signal output.

Raspberry Pi Pico Features and Specifications

Feature Availability
MicrocontrollerRP2040
ArchitectureDual-core Arm Cortex M0+ processor
Flash2MB
SRAM264KB
GPIO Pins26
I2C2
UART2
SPI2
PWM8 PWM Blocks – 16 Outputs
ADC3 12-bit ADC
State Machines8 × Programmable I/O (PIO) state machines
DAC0
USBUSB 1.1 with device and host support
Timersingle 64-bit counter
Watchdogone 32-bit
Real time clock1- RTC

Raspberry Pi Pico Programming 

Raspberry Pi foundation provided two programming options to write programs for the Raspberry Pi Pico board such as C/C++ SDK and Micropython. They also provide their own SDKs for both C and Micropyhton.

We can also program Raspberry Pi Pico using Thonny IDE and support for the Pico board is available in thonny IDE. You can refer to this getting started guide of Thonny MicroPython IDE:

Datasheet

You can refer to the raspberry pi Pico datasheet to explore further:

In the coming tutorials, we will start writing our first program for the RPI Pico development board. Meanwhile, you may like to check these recent projects developed with Raspberry Pi Pico:

Raspberry Pi Pico Limitations 

Like ESP32 and ESP8266, Raspberry Pi Pico can be programmed with Micropython.  But unlike ESP32 and ESP8266, it doesn’t contain onboard WiFi, Bluetooth, and BLE peripherals. Hence, to use this board for IoT projects, we will have to connect external WiFi, Bluetooth, and BLE modules.  It is a great choice for low-cost applications. But adding WiFi, Bluetooth and BLE externally will make its price more than an ESP32 board.  This is the first development board in the microcontroller series from Raspberry Pi. Maybe they will add more onboard peripherals in the next versions of the development board.

1 thought on “Raspberry Pi Pico – Getting Started Guide”

Leave a Comment