August 11, 2022

Raspberry Pi Pico - the Pico Probe

The story is that you can take your $4 Pico, install the PicoProbe firmware on it, and have a SWD debug "gateway" in combination with a USB to serial dongle.

I am doing the following on my Fedora Linux system (Fedora 38)

Install the Pico SDK

First you will need the Pico SDK:
git clone https://github.com/raspberrypi/pico-sdk.git
cd pico-sdk
git submodule update --init
Submodule 'lib/btstack' (https://github.com/bluekitchen/btstack.git) registered for path 'lib/btstack'
Submodule 'lib/cyw43-driver' (https://github.com/georgerobotics/cyw43-driver.git) registered for path 'lib/cyw43-driver'
Submodule 'lib/lwip' (https://github.com/lwip-tcpip/lwip.git) registered for path 'lib/lwip'
Submodule 'lib/mbedtls' (https://github.com/Mbed-TLS/mbedtls.git) registered for path 'lib/mbedtls'
Submodule 'tinyusb' (https://github.com/hathach/tinyusb.git) registered for path 'lib/tinyusb'
Cloning into '/u1/Projects/rp2040/pico-sdk/lib/btstack'...
Cloning into '/u1/Projects/rp2040/pico-sdk/lib/cyw43-driver'...
Cloning into '/u1/Projects/rp2040/pico-sdk/lib/lwip'...
Cloning into '/u1/Projects/rp2040/pico-sdk/lib/mbedtls'...
Cloning into '/u1/Projects/rp2040/pico-sdk/lib/tinyusb'...
The "submodule update" thing was new to me. It pulls in some dependencies (so it seems) which include support for the TinyUSB submodule (if not the module itself). If you don't do this, you get warned by the Pico Probe build that it will not include USB support (which would make it pretty much useless, eh?).

Build the firmware

Now for the pico probe itself:
git clone https://github.com/raspberrypi/picoprobe.git
cd picoprobe
git submodule update --init
(This gets CMSIS_5 and freertos)

export PICO_SDK_PATH=/u1/Projects/rp2040/pico-sdk
mkdir build
cd build
cmake ..
make
If you don't define the PICO_SDK_PATH you get a warning:
      SDK location was not specified.
      Please set PICO_SDK_PATH or set
      PICO_SDK_FETCH_FROM_GIT to on to fetch from git.
If you have not done the submodule update thing in the SDK you will get a warning:
      TinyUSB submodule has not been initialized;
      USB support will be unavailable
      hint: try 'git submodule update --init' from your SDK directory
      (/u1/Projects/rp2040/pico-sdk).
Once make finishes, you will see a bunch of lame warnings from FreeRTOS then:
    [100%] Linking CXX executable picoprobe.elf
    [100%] Built target picoprobe
    [tom@trona build]$ ls -l *.uf2
    -rw-r--r-- 1 tom tom 83456 Aug 11 11:48 picoprobe.uf2

Install it on a Pico and try it out

I plug in a brand new Pico and do this:
mount | grep RPI
/dev/sdd1 on /run/media/tom/RPI-RP2 type vfat
cp picoprobe.uf2 /run/media/tom/RPI-RP2
After this, the LED on the board comes on and I see these messages in my system log:
Aug 11 12:29:04 trona kernel: usb 1-1: new full-speed USB device number 4 using xhci_hcd
Aug 11 12:29:04 trona kernel: usb 1-1: New USB device found, idVendor=2e8a, idProduct=000c, bcdDevice= 1.01
Aug 11 12:29:04 trona kernel: usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Aug 11 12:29:04 trona kernel: usb 1-1: Product: Picoprobe (CMSIS-DAP)
Aug 11 12:29:04 trona kernel: usb 1-1: Manufacturer: Raspberry Pi
Aug 11 12:29:04 trona kernel: usb 1-1: SerialNumber: E6616407E36C3227
Aug 11 12:29:04 trona kernel: cdc_acm 1-1:1.1: ttyACM0: USB ACM device
This looks promising. It presents iself as a USB to serial device.

Will it work with openocd also? This is a topic for another page.
(It does)

Connections

See appendix A of the getting started document.
You need to make 5 connections:
Probe Pico GND to Target Pico GND (perhaps pin 38?)
Probe Pico GP2 to Target Pico SWclk
Probe Pico GP3 to Target Pico SWdio
Probe Pico GP4 (Tx) to Target Pico Uart0 Rx (perhaps pin 22, GP17)
Probe Pico GP5 (Rx) to Target Pico Uart0 Tx (perhaps pin 21, GP16)
Also, you can power the target Pico from the Probe Pico by connecting Vsys together.
Probe Pico Vsys to Target Pico Vsys (pin 39)


Have any comments? Questions? Drop me a line!

Tom's electronics pages / [email protected]