The Raspberry Pi Pico is an RP2040 board with 2 MB of flash and a USB port. It has no debugger on the board, and it does not need one to be programmed: the chip's boot ROM has a BOOTSEL mode that makes the board show up on USB as a drive named RPI-RP2, and as a second interface that takes commands. Normally a person holds a button, plugs the board in and drags a .uf2 file onto the drive.
A BenchPod can do both of those things itself. Its USB port runs as a USB host, so the pod plays the part of the computer: it writes the UF2 file to the Pico's drive, or talks to the boot ROM directly through PICOBOOT. This article is part of a series, one per chip we have run on real hardware: the overview of how the BenchPod flashes microcontrollers lists them all. It covers what the boot ROM offers, how the pod uses each path, when to pick which, the wiring, and what we measured.
What the boot ROM offers
Hold BOOTSEL while the board gets power and the RP2040 does not run the program in its flash. It runs its boot ROM instead, which enumerates on USB as 2E8A:0003 (the device string reads "RP2 Boot") with two things on it:
| Interface | What the host sees | What it is for |
|---|---|---|
| Mass storage | A small FAT drive named RPI-RP2 | Drag and drop a .uf2 file |
| PICOBOOT | A vendor interface with two bulk endpoints | Erase, write, read and reboot commands, no file system |
Both end in the same place: the new program is in flash and the board reboots into it. The difference is who does the work. With UF2 the host hands the ROM a file and the ROM decides what to program. With PICOBOOT the host does the programming itself, one command at a time, and can check its own work.
Path one: the UF2 drive
UF2 is a file format made for exactly this. A UF2 file is a series of 512-byte blocks, and every block carries its own destination, so the blocks do not have to arrive in order or even all be there at once. Each block holds 256 bytes of program data for the Pico, the address in flash where they go, its number and the total count, and a family ID that says which chip the file is for. Three magic numbers (two at the start, one at the end) mark it as UF2.
The pod handles it like this:
- It checks each block just before writing it: the magic numbers, a payload of 476 bytes or less, a nonzero block count and a block number below it. A file that is not whole blocks is refused, and a block that fails stops the write there, with
the file is not a UF2 file. - It writes each block as one 512-byte sector into the data area of the drive, in order, eight sectors per step so the pod keeps answering commands.
- The ROM sees each block arrive, reads its address, programs the flash, and after the last block it reboots the board. The drive disappears from the USB bus and the application enumerates in its place.
The pod does not copy a file onto the Pico's drive. It writes the blocks straight to the sectors, because the ROM does not care about file names: it looks at the blocks.
The pod can also check the result. With verify, and when the board is still in its loader afterwards, it compares each block of the file with the drive's CURRENT.UF2, which the ROM presents as the flash contents in UF2 form. In the normal case the board has already left BOOTSEL, so there is nothing to read back and the result's note says verify skipped: the board left its bootloader.
Path two: PICOBOOT
PICOBOOT is the vendor interface of the same boot ROM. Every command is a 32-byte block that starts with the magic 0x431FD10B, sent on a bulk endpoint, followed by a data stage if the command has one and an acknowledge the other way. The pod uses these:
| Command | What the pod uses it for |
|---|---|
EXCLUSIVE | Take exclusive access: the drive turns read-only while the pod works |
EXIT_XIP | Leave XIP mode, so the flash can be erased and written |
ERASE | Erase one 4 KB sector |
WRITE | Write one 256-byte page |
READ | Read one 256-byte page back |
REBOOT | Reboot into the new program, after 500 ms |
The image is a binary with its start address, 0x10000000 by default, which is the start of flash; the address has to be a multiple of 4096. The pod:
- resets the PICOBOOT interface, takes exclusive access and leaves XIP mode,
- erases every 4 KB sector the image covers,
- writes it in 256-byte pages,
- reads every page back and compares it with the file; a page that did not stick fails the flash and the result names the page's address,
- reboots the board into the new program. The board may drop off the bus before it acknowledges the reboot, which is fine.
With leave off, the pod skips the reboot and gives the drive back, so the board stays in BOOTSEL.
When to use which
| UF2 | PICOBOOT | |
|---|---|---|
| Input | A .uf2 file | A .bin or .hex file |
| Where it lands | Wherever the blocks say | At the address you give, 0x10000000 by default |
| Read-back | Only with verify, and only when the board stays in BOOTSEL | Always: every page, every time |
| Erase | The ROM decides | The pod erases the sectors the image covers |
| Chips | Boards with a UF2 drive: Pico, Pico 2, Adafruit and Seeed boards | RP2040 and RP2350 in BOOTSEL |
If your build produces a .uf2 (the Pico SDK does), use UF2: it is one file and there is nothing to configure. If your build produces a .bin or .hex, or you want every page checked, use PICOBOOT. The SDK and the CLI choose for you: a UF2 file goes to the drive, and a .bin or .hex for a Pico in BOOTSEL goes through PICOBOOT. A UF2 file is never sent through PICOBOOT.
Wiring
The pod has no pin to wire for this: it uses its USB port as a host port, with the board's normal USB cable. Today that is the pod's USB-C port through a USB-A breakout, with D+, D- and GND going to the board and the board's VBUS coming from a 5 V supply; the USB docs page has the details.
For the bench run below, the Pico sat on a USB-A breakout wired to the pod's USB-C port, and its VBUS came from the pod's switched 5 V output (eFuse 1). Because the pod switches that output, the board's power is under test control. The pod itself does not press BOOTSEL: the board has to be in BOOTSEL when the flash starts (hold the button while it gets power, as you would by hand). While the pod hosts a board, its own USB console and USB network are off, so reach the pod over Ethernet, Wi-Fi or the cloud.
Bench results
We ran an RP2040 Raspberry Pi Pico on the pod's USB host port, with VBUS from the 5 V output:
- In BOOTSEL the Pico enumerated as
RP2 Boot, 2E8A:0003. - A UF2 flash of a test image wrote 369 UF2 blocks in 2.45 s, about 77 KB/s of file. The drive was gone 0.5 s later, and the board came back as 2E8A:000A, the Pico running its application.
- PICOBOOT mode was also tested on an RP2040 and passed.
The speed is set by the Pico and the USB bus, not by the network between the host and the pod: the loader runs next to the USB port.
Things to know
- The board has to be in BOOTSEL when the flash starts. Neither path can start the boot ROM on a board that is already running its application.
- UF2 does not read back by default. The ROM programs the flash on its own and reboots, so the host only knows that every block was accepted. Use PICOBOOT when you want the flash contents compared;
verifyonly helps when the UF2 file keeps the board in BOOTSEL. - With PICOBOOT the address must be a multiple of 4096, because the erase unit is a 4 KB sector.
- The pod is a full-speed USB host, one board at a time.
Using it
Both paths need firmware 4.0.3 or later. From Python, with the pytest package:
from embeddedci.benchpod import BenchPod
with BenchPod("192.168.1.50") as bp:
# UF2 build output: written to the RPI-RP2 drive
r = bp.usb_flash("build/app.uf2")
print(r.mode, r.reason)
# A .bin or .hex for a Pico in BOOTSEL: PICOBOOT, every page read back
r = bp.usb_flash("build/app.bin", address=0x10000000)usb_flash starts USB host mode if it is off, picks the loader from the file and the device that mounted, and says why in result.reason. It raises UsbFlashError with the pod's reason on a failure. verify=True compares a UF2 flash with the drive's CURRENT.UF2 when the board stays in BOOTSEL, and leave=False keeps a board flashed through PICOBOOT in BOOTSEL.
From the command line:
benchpod usb-flash pico-app.uf2
benchpod usb-flash app.bin --mode picoboot --address 0x10000000The CLI uploads the file into the pod first, so it needs a direct link to the pod's network address. Over embeddedci.com use the Python SDK or the MCP server.
From an AI agent, the MCP server's usb_flash tool takes the same arguments: usb_flash(file="build/app.uf2"). The board has to be in BOOTSEL already when the flash starts.
Underneath all three is one JSON command. Stage the file with load_bin into the pod's memory, then:
{"cmd":"usb_host","enabled":true,"port":"usb_c","timeout_s":120}
{"cmd":"usb_flash","mode":"uf2","len":188928}
{"cmd":"usb_flash","mode":"picoboot","address":"0x10000000","len":262144}
{"cmd":"usb_flash"}The last command reads the state: the phase (start, descriptors, erase, write, verify, leave, done for PICOBOOT), the steps done out of the total, and at the end ok or the reason. The Pico 2 (RP2350) is supported on both paths too; we have not run one yet. The USB docs page lists what is tested on real hardware and what is not, and the API docs have the full command reference. Every chip and method we have verified is in How the BenchPod flashes microcontrollers.