Support for the RP2040 based Raspberry Pi Pico board. More...
Support for the RP2040 based Raspberry Pi Pico board.
The Raspberry Pi Pico is sold by the Raspberry Pi foundation for about 4 USD. It features the RP2040 MCU, a custom dual core ARM Cortex-M0+ MCU with relatively high CPU clock, plenty of RAM and some unique peripheral (the Programmable IO).
The Programmable IO (PIO) peripheral and the SSI/QSPI peripheral that supports execution from flash (XIP) are the most distinguishing features of the MCU. The latter is especially important, since the RP2040 contains no internal flash.
|Family||(2x) ARM Cortex-M0+|
|Flash||2 MiB (up to 16 MiB)|
|Frequency||up to 133 MHz|
|Timers||1 x 64-bit|
|ADCs||1x 12-bit (4 channels + temperature sensor)|
|USBs||1 (USB 2.0)|
|SSI/QSPI||1 (connected to flash, with XIP support)|
|Vcc||1.62V - 3.63V|
1 button (also used for boot selection) and 1 LED:
(*) Since the switch is connected to the chip-select pin of the QSPI interface the flash chip RIOT is running from via XIP, the switch is difficult to read out from software. This is currently not supported.
Connect the device to your Micro-USB cable while the button (labeled
BOOTSEL on the silkscreen of the PCB) is pressed to enter the bootloader. The pico will present itself as a storage medium to the system, to which a UF2 file can be copied perform the flashing of the device. This can be automated by running:
This is default flashing option using elf2uf2 PROGRAMMER. If the storage is not automatically mounted to
/media/<USER_NAME>/RPI-RP2, you can overwrite the path by exporting the shell environment variable
Currently (June 2021), only two methods for debugging via OpenOCD are supported:
Option 2 requires no additional hardware however, you need to first "flash" the gimme-cache variant of pico-debug into RAM using the UF2 bootloader. For this, plug in the USB cable while holding down the BOOTSEL button of the Pico and copy the
pico-debug-gimmecache.uf2 from the latest pico-debug release into the virtual FAT formatted drive the bootloader provides. Once this drive is unmounted again, this will result in the Raspberry Pi Pico showing up as CMSIS-DAP debugger. Afterwards run:
rpi-picovirtual debugger is not persistent and needs to be "flashed" into RAM again after each cold boot.
masterbranch from the upstream OpenOCD source. The OpenOCD fork of the Raspberry Pi foundation is incompatible with OpenOCD configuration provided, so please stick with upstream OpenOCD.
Connect the Board to an Segger J-Link debugger, e.g. the EDU mini debugger is relatively affordable, but limited to educational purposes. Afterwards run:
This board's default access to RIOT shell is via UART (UART0 TX - pin 1, UART0 RX - pin 2).
The default baud rate is 115 200.
The simplest way to connect to the shell is the execution of the command:
There are currently (June 2021) few hardware options for debugging the Raspberry Pi Pico:
In addition, a software-only option is possible using pico-debug. The default linker script reserved 16 KiB of RAM for this debugger, hence just "flash" the "gimme-cache" flavor into RAM using the UF2 bootloader. Once this is done, debugging is as simple as running:
rpi-pico virtual debugger is not persistent and needs to be "flashed" into RAM again after each cold boot. The initialization code of RIOT now seems to play well with the debugger, so it remains persistent on soft reboots. If you face issues with losing connection to the debugger on reboot, try
monitor reset init in GDB to soft-reboot instead.
Currently no support for the following peripherals is implemented:
|Board specific definitions for the Raspberry Pi Pico. |
|Board specific configuration of direct mapped GPIOs. |
|Configuration of CPU peripherals for the Raspberry Pi Pico. |