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
- Raspberry Pi Pico series, 2 MiB of flash. This includes the Pico, Pico H, Pico W, and Pico WH. Note the Pico H and WH use a JST SH 3 pin connector, but that cable is provided with the debug probe. The only downsides to the Pico are the limited flash and size of the board, so this is a solid default (especially at $4 USD).
- Pimoroni Tiny 2040, 2 MiB (PIM593) or 8 MiB (PIM558) of flash. This is an awesome, awesome board that solves the downsides of the Raspberry Pi Pico (limited flash and size). Unfortunately, it’s a bit hard to get outside the UK.
- Pimoroni PGA2040, 8 MiB of flash. The order of the SWCLK/SWDIO and GND pins is not the same as the Pimoroni Tiny 2040 or Raspberry Pi Picos. But as the debug probe’s header cable supports this (the female connectors are separated), it’s fine.
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).
- Adafruit QT Py RP2040, 8 MiB of flash. I really wish this one had SWD pins.
- Adafruit KB2040, 8 MiB of flash.
- Adafruit RP2040 Prop-Maker Feather, 8 MiB of flash. The Adafruit Feather RP2040 does have accessible SWD pins (see below).
- Waveshare RP2040-Touch-LCD-1.28, 8 MiB of flash. Note that the Waveshare RP2040-LCD-1.28 does have accessible SWD pins, but only 2 MiB of flash (see below).
- Waveshare RP2040-Zero, 2 MiB of flash.
- WaveShare RP2040-Tiny, 2 MiB of flash. This one is especially heartbreaking as the FPC cable has at least 2 free pins that are simply tied to ground. This could’ve been an awesome board.
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.
- Adafruit Feather RP2040, 8 MiB of flash. Does have SWCLK/SWDIO pads on the bottom (and only one ground pin), and SWD via an optional, unpopulated 1.27mm SMT 10 pin header on the top. This looks hard to solder without surface-mount technology (SMT) gear. A hot-plate likely won’t work due to the proximity of other components.
- Adafruit ItsyBitsy RP2040, 8 MiB of flash. Has SWCLK/SWDIO through-holes on the edge opposite to the USB connector, but only one ground pin. It’s pretty easy to make a custom SWD cable for this if needed.
- Pimoroni Pico LiPo, 4 MiB (PIM578) or 16 MiB (PIM560) of flash. This chip is on this list as, while it does have a debug SWD JST SH 3 pin connector, the SWCLK/SWDIO pins are reversed to what the debug probe expects.
- SparkFun Pro Micro RP2040, 16 MiB of flash. Has SWCLK/SWDIO pads on the bottom, no ground pad.
- SparkFun Thing Plus RP2040, 16 MiB of flash. Has through-holes for a 1.27mm 10 pin debug header.
- SparkFun MicroMod RP2040, 16 MiB of flash. I’m not sure on this one, seems like SWCLK/SWDIO is broken out, but their carrier board uses through-holes for a 1.27mm 10 pin debug header.
- Seeed Studio XIAO RP2040, 2 MiB of flash. Has SWCLK/SWDIO, GND, and RESET pads on the bottom in 2.54mm spacing, so a jig with pogo pins can be used.
- Waveshare RP2040-LCD-1.28, 2 MiB of flash. Unlike the Waveshare RP2040-Touch-LCD-1.28 (with 8 MiB of flash), SWCLK/SWDIO and GND are broken out. However, the header is 2-row 1.27mm pitch. Most people won’t have this header, and it’s tricky to solder wires to such a narrow pitch. Also, break-out boards for 20 pin 1.27mm headers are rare to non-existant, although 10 pin DIP adapters are available.