How to debug a Raspberry Pi Pico with an Arduino project and GDB?

× Not what you are looking for? Did you want USB/WiFi debug, trace and performance monitoring instead?

The Raspberry Pi Pico Board can now be debugged using an External Hardware debugger, directly in Visual Studio, with vMicro!

You can also create your own Debug Probe from another Raspberry Pi Pico board, as shown on this page.

External Debug Interface: SWD

 

Note IconPlatform Installation for Arduino IDE and Visual Micro:

This is available from vMicro versions 2021.0606.6 onwards, in conjunction with the "Arduino Mbed OS RP2040 Boards" platform (search for "RP2040" in vMicro Explorer > Board Manager).

GitHub: https://github.com/arduino/ArduinoCore-mbed

This is available from vMicro versions 2022.0429.04 onwards, in conjunction with the "Raspberry Pi Pico/RP2040" platform (available here).

JSON URL: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json

GitHub: https://github.com/earlephilhower/arduino-pico

Learn how to install board packages in Visual Micro click here.

To see a list of all debuggers currently supported within vMicro please click here.

 

External Debugger Connections

To connect your SWD debugger to the Raspberry Pi Pico board you will need to connect the below pins:

Raspberry Pi Pico SWD Connections on Standard JTAG Connector

 

FT2232 Mini Module Connected to Raspberry Pi Pico

  Wiring Diagram

ESPPROG Connected to Raspberry Pi Pico

  Wiring Diagram
FT2232 Mini Module Connected to Raspberry Pi Pico Raspberry Pi Pico to ESP32PROG Wiring              

F2232H Dual Connected to Raspberry Pi Pico

  Wiring Diagram

Olimex ARM USB Tiny/H Connected to Raspberry Pi Pico

  Wiring Diagram
F2232H Dual to Raspberry Pi Pico Wiring               Raspberry Pi Pico Dual to Olimex ARM USB Tiny/H Wiring              

PicoProbe Connected to Raspberry Pi Pico

  Wiring Diagram     Wiring Diagram + Serial
PicoProbe to Raspberry Pi Pico Wiring              
NOTE: Pinouts for connections differ between boards - See Images & Links

 

Then you will also need to connect your Debugger to the PC on one USB port, and the Raspberry Pi Pico on another USB Port

 

Software Setup

Ensure you have Visual Studio and the vMicro Extension Installed

Open your Sketch and select the Debug > Hardware, and the relevant Debugger you have available

Visual Studio Toolbar Selections for Raspberyy Pi Pico

You may need to install an additional USB Driver on Interface 0 of your debugger (Interface 2 for PicoProbe) to allow it to function with this software - check in the debugger list here

Remember - If you have installed a new driver, you may have to do it again if you connect the debugger to a different USB port next time.....

 

Start Debugger

  1. Ensure you have the Debug Configuration selected from the Configuration Manager Window
  2. If you know where you want the first breakpoint in your code, add it now
  3. To start the debugging process, you can either:
    • "Debug > Attach to Process" button if your code has already been uploaded to the Raspberry Pi Pico board
    • "Debug > Start Debugging" if your code has not been uploaded

Note IconNote:

When using the PicoProbe, you will need to disconnect the debugger, and reset the PiPico target whilst holding the boot button to perform uploads.

Then Debug > Attach to Process can be used once the PicoProbe is reconnected to your machine.

Raspberyy Pi Pico Debugging in vMicro and Visual Studio

Congratulations - you should have the debugger running, and further windows can be opened from the "Debug > Windows" menu once you have started debugging

 

There is also a video guide on this below: