Understanding The Ways to Debug Your Raspberry Pi Pico Development Board
If you want to debug any microcontroller, it can be tricky at times. But with the newly launched Raspberry Pi Pico, we have several options to debug the board. It is now possible to use one Raspberry Pi Pico to debug another Raspberry Pi Pico using the ‘Picoprobe’ application or the traditional way of using SWD protocol.
It is always difficult to figure out what is not working. However, Pico comes with three pins for debugging using the Serial Wire Debug (SWD) protocol. To debug a binary program, you need to build a debug version of the binary and get some additional tools.
The above reference image shows the wiring of Raspberry Pi 4 with Pico board. Connect the SWD port directly to the Raspberry Pi to maintain the signal strength. For more information on this method, refer to “Chapter 5” of the “Getting Started with Raspberry Pi Pico” guide.
What makes Pico debugging different is the additional approach of using one RPi Pico to debug another. Even if you use platforms like Windows, Mac, and Linux, you can still use the ‘Picoprobe’ application. This application allows a Raspberry Pi Pico to act as a USB to SWD and UART converter.
“This interface allows you to add up to four breakpoints and two watchpoints. This gives you more control over how your program runs as you develop software.”
If you plan to try the new approach, the UF2 binary file of ‘Picoprobe’ is available to download on the getting started page. To interface both the Raspberry Pi Pico, use the following reference image. Connect the VSYS pin of both the Raspberry Pi Picos to power them.
If you are using the Windows platform, note that you need to install the ‘Picoprobe’ driver for which details are provided in the “Getting Started with Raspberry Pi Pico” guide. This $4 board has provided everything you can ever expect from a microcontroller with PIOs and support for powerful addons.
Note: All the images are taken from the official Raspberry Pi guide.
Join 97,426 other subscribers
Another method is to use pico-debug: https://github.com/majbthrd/pico-debug
This doesn’t require wiring up the SWD pins, nor does it require two RP2040. It uses the existing USB connector already on the Raspberry Pi Pico to debug code running on the Pico.