Raspberry Pi Pico 2 and Debug Probe
This skill covers development with Raspberry Pi Pico 2 (RP2350) boards and the Raspberry Pi Debug Probe. It includes hardware specs, SDK setup, build configuration, debugging workflows, and common pitfalls.
Reference Files
Consult these for detailed technical content. Read only the file relevant to the current task:
references/pico2-hardware.md - RP2350 specs, RP2040 vs RP2350 comparison, pin layout, wireless variant, security features, chip variants
references/debug-probe.md - Debug Probe hardware, wiring diagrams, OpenOCD setup, GDB workflow, UART serial, RTT, VS Code integration, rescue mode, troubleshooting
references/sdk-toolchain.md - pico-sdk setup, CMake configuration, ARM vs RISC-V builds, picotool commands, MicroPython/CircuitPython, project structure
Quick Reference
Board Selection (CMake)
| Board |
CMake Flag |
Platform |
| Pico 1 |
-DPICO_BOARD=pico (default) |
rp2040 |
| Pico 1 W |
-DPICO_BOARD=pico_w |
rp2040 |
| Pico 2 |
-DPICO_BOARD=pico2 |
rp2350-arm-s |
| Pico 2 W |
-DPICO_BOARD=pico2_w |
rp2350-arm-s |
| Pico 2 RISC-V |
-DPICO_BOARD=pico2 -DPICO_PLATFORM=rp2350-riscv |
rp2350-riscv |
Debug Probe Wiring (SWD)
| Debug Probe "D" Pin |
Wire Colour |
Pico 2 SWD Pad |
| SC |
Orange |
SWCLK |
| GND |
Black |
GND |
| SD |
Yellow |
SWDIO |
Debug Probe Wiring (UART)
| Debug Probe "U" Pin |
Wire Colour |
Pico 2 Pin |
GPIO |
| TX |
Orange |
Pin 2 |
GP1 (RX) |
| RX |
Yellow |
Pin 1 |
GP0 (TX) |
| GND |
Black |
Pin 3 |
GND |
Note the crossover: probe TX to Pico RX, probe RX to Pico TX.
OpenOCD Target Configs
| Target |
Config File |
| Pico 1 (RP2040) |
target/rp2040.cfg |
| Pico 2 (RP2350) |
target/rp2350.cfg |
| Pico 2 RISC-V |
target/rp2350.cfg with -c "set USE_CORE { rv0 rv1 }" |
| Rescue (RP2350) |
target/rp2350.cfg with -c "set RESCUE 1" |
Typical Debug Session
# Terminal 1: OpenOCD
openocd -f interface/cmsis-dap.cfg -f target/rp2350.cfg -c "adapter speed 5000"
# Terminal 2: GDB
arm-none-eabi-gdb my_app.elf
(gdb) target remote localhost:3333
(gdb) monitor reset init
(gdb) load
(gdb) break main
(gdb) continue
Flash via SWD
openocd -f interface/cmsis-dap.cfg -f target/rp2350.cfg \
-c "adapter speed 5000" \
-c "program my_app.elf verify reset exit"
Use the .elf file for SWD flashing, not .uf2.
Gotchas
These are the most common mistakes and non-obvious behaviours. Pay close attention.
SDK defaults to Pico 1. You must explicitly pass -DPICO_BOARD=pico2 to target RP2350. Forgetting this builds for RP2040 and the binary will not run on a Pico 2.
Use the Raspberry Pi fork of OpenOCD. Upstream OpenOCD (0.12.0) lacks full RP2350 support. Clone from https://github.com/raspberrypi/openocd.git branch rpi-common.
Wrong target config = failed connection. Using rp2040.cfg with a Pico 2 silently fails. Always match the target config to the chip.
SWD uses .elf, BOOTSEL uses .uf2. These are different formats for different flashing methods. Do not try to flash a .uf2 via OpenOCD/SWD.
Debug builds required for meaningful debugging. Always pass -DCMAKE_BUILD_TYPE=Debug to cmake. Release builds optimise away variable state and reorder code, making breakpoints unreliable.
RISC-V mode has no FPU. The hardware floating-point unit is only available on Cortex-M33. RISC-V mode uses software float, which is significantly slower for float-heavy code.
RISC-V requires a clean build directory. When switching between ARM and RISC-V, delete the build directory and re-run cmake. In-place switching does not work.
RISC-V debugging requires pre-selection. The RP2350 boots into Cortex-M33 by default. To debug RISC-V: picotool reboot -u -c riscv, then use OpenOCD with set USE_CORE { rv0 rv1 }.
Debug Probe does not power the target. The Pico 2 must be powered via its own USB or VSYS. The SWD connector carries no power.
LED pin differs on wireless models. Non-wireless Pico 2 uses GP25 for the onboard LED. Pico 2 W uses WL_GPIO0 through the CYW43439 wireless chip. Code must be conditional.
Git submodules are required. The pico-sdk needs git submodule update --init to pull tinyusb, cyw43-driver, lwip, btstack, and mbedtls. Missing submodules cause cryptic build failures.
OTP is irreversible. Writing OTP bits is permanent. Misconfiguring secure boot (setting SECURE_BOOT_ENABLE without a boot key and with PICOBOOT disabled) permanently bricks the device.
Wireless SPI pin sharing. On Pico 2 W, the VSYS ADC reading and CYW43439 IRQ checking are blocked during SPI transactions to the wireless chip.
Connect GND first. When the Pico 2 is powered from a separate source, connect GND between the target and Debug Probe before any signal lines. Voltage differences can damage the probe.
macOS: OpenOCD needs hidapi and libusb. Install via brew install hidapi libusb. If OpenOCD cannot find the probe, check no other process (VS Code, another OpenOCD instance) holds the USB device.
Multiple debug probes. If multiple CMSIS-DAP devices are connected, specify the serial number: adapter serial <serial_number> in your OpenOCD config.
1---2name: raspberry-pi-pico23description: Use when developing with Raspberry Pi Pico 2 or the Pi Debug Probe.4---5
6# Raspberry Pi Pico 2 and Debug Probe
7
8This skill covers development with Raspberry Pi Pico 2 (RP2350) boards and the Raspberry Pi Debug Probe. It includes hardware specs, SDK setup, build configuration, debugging workflows, and common pitfalls.
9
10## Reference Files
11
12Consult these for detailed technical content. Read only the file relevant to the current task:
13
14- `references/pico2-hardware.md` - RP2350 specs, RP2040 vs RP2350 comparison, pin layout, wireless variant, security features, chip variants
15- `references/debug-probe.md` - Debug Probe hardware, wiring diagrams, OpenOCD setup, GDB workflow, UART serial, RTT, VS Code integration, rescue mode, troubleshooting
16- `references/sdk-toolchain.md` - pico-sdk setup, CMake configuration, ARM vs RISC-V builds, picotool commands, MicroPython/CircuitPython, project structure
17
18## Quick Reference
19
20### Board Selection (CMake)
21
22| Board | CMake Flag | Platform |
23|-------|-----------|----------|
24| Pico 1 | `-DPICO_BOARD=pico` (default) | rp2040 |
25| Pico 1 W | `-DPICO_BOARD=pico_w` | rp2040 |
26| Pico 2 | `-DPICO_BOARD=pico2` | rp2350-arm-s |
27| Pico 2 W | `-DPICO_BOARD=pico2_w` | rp2350-arm-s |
28| Pico 2 RISC-V | `-DPICO_BOARD=pico2 -DPICO_PLATFORM=rp2350-riscv` | rp2350-riscv |
29
30### Debug Probe Wiring (SWD)
31
32| Debug Probe "D" Pin | Wire Colour | Pico 2 SWD Pad |
33|---------------------|-------------|-----------------|
34| SC | Orange | SWCLK |
35| GND | Black | GND |
36| SD | Yellow | SWDIO |
37
38### Debug Probe Wiring (UART)
39
40| Debug Probe "U" Pin | Wire Colour | Pico 2 Pin | GPIO |
41|---------------------|-------------|------------|------|
42| TX | Orange | Pin 2 | GP1 (RX) |
43| RX | Yellow | Pin 1 | GP0 (TX) |
44| GND | Black | Pin 3 | GND |
45
46Note the crossover: probe TX to Pico RX, probe RX to Pico TX.
47
48### OpenOCD Target Configs
49
50| Target | Config File |
51|--------|------------|
52| Pico 1 (RP2040) | `target/rp2040.cfg` |
53| Pico 2 (RP2350) | `target/rp2350.cfg` |
54| Pico 2 RISC-V | `target/rp2350.cfg` with `-c "set USE_CORE { rv0 rv1 }"` |
55| Rescue (RP2350) | `target/rp2350.cfg` with `-c "set RESCUE 1"` |
56
57### Typical Debug Session
58
59```bash
60# Terminal 1: OpenOCD
61openocd -f interface/cmsis-dap.cfg -f target/rp2350.cfg -c "adapter speed 5000"
62
63# Terminal 2: GDB
64arm-none-eabi-gdb my_app.elf
65(gdb) target remote localhost:3333
66(gdb) monitor reset init
67(gdb) load
68(gdb) break main
69(gdb) continue
70```
71
72### Flash via SWD
73
74```bash
75openocd -f interface/cmsis-dap.cfg -f target/rp2350.cfg \
76 -c "adapter speed 5000" \
77 -c "program my_app.elf verify reset exit"
78```
79
80Use the `.elf` file for SWD flashing, not `.uf2`.
81
82## Gotchas
83
84These are the most common mistakes and non-obvious behaviours. Pay close attention.
85
861. **SDK defaults to Pico 1.** You must explicitly pass `-DPICO_BOARD=pico2` to target RP2350. Forgetting this builds for RP2040 and the binary will not run on a Pico 2.
87
882. **Use the Raspberry Pi fork of OpenOCD.** Upstream OpenOCD (0.12.0) lacks full RP2350 support. Clone from `https://github.com/raspberrypi/openocd.git` branch `rpi-common`.
89
903. **Wrong target config = failed connection.** Using `rp2040.cfg` with a Pico 2 silently fails. Always match the target config to the chip.
91
924. **SWD uses .elf, BOOTSEL uses .uf2.** These are different formats for different flashing methods. Do not try to flash a .uf2 via OpenOCD/SWD.
93
945. **Debug builds required for meaningful debugging.** Always pass `-DCMAKE_BUILD_TYPE=Debug` to cmake. Release builds optimise away variable state and reorder code, making breakpoints unreliable.
95
966. **RISC-V mode has no FPU.** The hardware floating-point unit is only available on Cortex-M33. RISC-V mode uses software float, which is significantly slower for float-heavy code.
97
987. **RISC-V requires a clean build directory.** When switching between ARM and RISC-V, delete the build directory and re-run cmake. In-place switching does not work.
99
1008. **RISC-V debugging requires pre-selection.** The RP2350 boots into Cortex-M33 by default. To debug RISC-V: `picotool reboot -u -c riscv`, then use OpenOCD with `set USE_CORE { rv0 rv1 }`.
101
1029. **Debug Probe does not power the target.** The Pico 2 must be powered via its own USB or VSYS. The SWD connector carries no power.
103
10410. **LED pin differs on wireless models.** Non-wireless Pico 2 uses GP25 for the onboard LED. Pico 2 W uses WL_GPIO0 through the CYW43439 wireless chip. Code must be conditional.
105
10611. **Git submodules are required.** The pico-sdk needs `git submodule update --init` to pull tinyusb, cyw43-driver, lwip, btstack, and mbedtls. Missing submodules cause cryptic build failures.
107
10812. **OTP is irreversible.** Writing OTP bits is permanent. Misconfiguring secure boot (setting `SECURE_BOOT_ENABLE` without a boot key and with PICOBOOT disabled) permanently bricks the device.
109
11013. **Wireless SPI pin sharing.** On Pico 2 W, the VSYS ADC reading and CYW43439 IRQ checking are blocked during SPI transactions to the wireless chip.
111
11214. **Connect GND first.** When the Pico 2 is powered from a separate source, connect GND between the target and Debug Probe before any signal lines. Voltage differences can damage the probe.
113
11415. **macOS: OpenOCD needs hidapi and libusb.** Install via `brew install hidapi libusb`. If OpenOCD cannot find the probe, check no other process (VS Code, another OpenOCD instance) holds the USB device.
115
11616. **Multiple debug probes.** If multiple CMSIS-DAP devices are connected, specify the serial number: `adapter serial <serial_number>` in your OpenOCD config.