profile picture

Compiling picoprobe

March 17, 2024 - programming raspberry pico

Made myself picoprobe. Official debug probe for pico costs 12€, pico board costs 4€, so it is cheaper and more fun to make. Wiring provided in Appendix A in "Getting started with Raspberry Pi Pico", all you need is to solder seven wires to pico and crimp some connectors on the other end of them. And then you need to build and flash picoprobe, which is where I ran into a problem. The guide says you need to clone https://github.com/raspberrypi/picoprobe.git, make build directory and run cmake .. and make in it, and that should produce picoprobe.uf2. The things have changed though and when I followed the instructions it built debugprobe.uf2 instead, which I successfully flashed onto pico. The serial port worked and I could see what the pico under debug was outputting to it, but any attempts to flash anything to pico using openocd were ending with:

Info : Using CMSIS-DAPv2 interface with VID:PID=0x2e8a:0x000c, serial=E660D4A0A71B7F29
Info : CMSIS-DAP: SWD  Supported
Info : CMSIS-DAP: FW Version = 2.0.0
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 0 SWDIO/TMS = 0 TDI = 0 TDO = 0 nTRST = 0 nRESET = 0
Info : CMSIS-DAP: Interface ready
Info : clock speed 5000 kHz
Info : DAP init failed
in procedure 'program'
** OpenOCD init failed **
shutdown command invoked

I searched the internet, apparently other people also had similar issues, but most suggested solution was to check wiring, make sure that the connection is as short as possible, or reduce the clock speed. Nothing has worked for me and I was about to connect the thing to the scope and see what it produced on outputs, but then decided to check README and quickly found the solution:

If you want to create the version that runs on the Pico, then you need to invoke cmake in the sequence above with the DEBUG_ON_PICO=ON option: cmake -DDEBUG_ON_PICO=ON ..

Indeed, rebuilding with DEBUG_ON_PICO=ON produced debugprobe_on_pico.uf2 which worked like a charm.