Supercharging RP2040 development with the Raspberry Pi Debug Probe

RP2040 board vendors hate this one weird trick!

7 Aug '24

Edit: Given the recent announcement of the Raspberry Pi RP2350 and Raspberry Pi Pico 2, this post is surprisingly relevant!


I love the RP2040 microcontroller. Mainly for the simplicity it brings compared to e.g. STM32 microcontrollers. But I already digress.

Being an Arm chip, the RP2040 supports Serial Wire Debug (SWD) and CMSIS-DAP. This is a standard on Arm chips. The benefit of using SWD is twofold. First, programming becomes much, much easier. Instead of holding the “BOOTSEL” button while cycling the power, it’s possible to simply upload the code. Second, instead of having to debug code via serial/UART messages (which also uses more pins), Segger’s Real Time Transfer (RTT) can be used to send messages from the target to the host over the same three wires. (It’s also possible to inspect the CPU and memory using e.g. OpenOCD, but that’s more advanced.)

RTT is also well supported by Rust tooling, e.g. via defmt and probe-rs.

Raspberry Pi has even released the Raspberry Pi Debug Probe. It’s $12 USD, and comes in a lovely case. (I should mention it’s also possible to use another RP2040 board as a debug probe, but I’d recommend just buying the debug probe.) I highly, highly recommend just buying a debug probe and switching to SWD + RTT. However…

Many hobbyist RP2040 boards do not break out the SWD pins. This could be because of Arduino’s legacy (where uploading code via USB is standard), or because these boards are aimed at higher-level coding via CircuitPython or MicroPython.

So, here’s a list of boards based on SWD support. Choose wisely.

Boards with full SWD pins

Boards without SWD pins

To be clear, these boards can still be awesome and can be a good fit. However, I would avoid them during development, as the SWD pins aren’t broken out (as far as I can tell).

Boards with limited SWD pins

These boards do break out the SWD pins in various ways, but may be tricky to work with just using the debug probe.

Rust

Older