Raspberry Pi Debug Probe

From Waveshare Wiki
Jump to: navigation, search
Raspberry Pi Debug Probe
Raspberry Pi Debug Probe01.jpg

UART, SWD, Micro USB
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

Overview

Introduction

Raspberry Pi Debug Probe is an official USB hardware debugger designed for Pico, an all-in-one design, with the features of solderless and plug-and-play, and can be connected to the debug interface of the target board via SWD interface.

Features

  • RP2040 microcontroller chip designed by Raspberry Pi in the United Kingdom.
  • Onboard Micro-USB port for connecting to PC or other boards.
  • Onboard 3PIN SWD interface for connecting to the target board.
  • Onboard 3PIN USB to UART bridge.
  • Standard CMSIS-DAP interface, compatible with most ARM-based microcontrollers.
  • Works with OpenOCD and other tools supporting CMSIS-DAP.
  • Follows the Raspberry Pi 3PIN Debug Connector Specification.
  • Comes with a high-quality transparent plastic case and connection cables.
  • Open-source programs, are more convenient to upgrade the firmware.

Onboard Resource

Raspberry Pi Debug Probe.jpg

Dimensions

Raspberry Pi Debug Probe02.jpg

User Guide

Install OpenOCD

Linux (and Raspberry Pi)

Download the Dependency Library

sudo apt install automake autoconf build-essential texinfo libtool libftdi-dev libusb-1.0-0-dev

Get and Compile

git clone https://github.com/raspberrypi/openocd.git --branch rp2040 --depth=1 --no-single-branch
cd openocd
./bootstrap
./configure
make -j4
sudo make install

Windows

1. As OpenOCD self-compilation is complicated in the windows environment, it is recommended to use the already compiled version.
2. Unzip and store in a relatively short directory, e.g. directly in the C drive.

Add Environment Variables

1. Click the menu, and search "environment variables".

Raspberry Pi Debug Probe05.jpg

2. Click "Edit the system environment variables":

Raspberry Pi Debug Probe06.jpg

3. Double-click the "Path" variable, and then enter the edit interface.

Raspberry Pi Debug Probe07.jpg

4. Add a new path.

Raspberry Pi Debug Probe08.jpg

  • Create a new variable address.
  • Enter the OpenOCD storage address.
  • Click OK to save.
5. Click "OK" and save the change.

Raspberry Pi Debug Probe09.jpg

6. Reboot the computer.

Install GDB

Linux (and Raspberry Pi)

1. Install gdb-multiarch.
sudo apt install gdb-multiarch

Windows

1. If you have installed the related pico-sdk environment, you can skip this step as the GDB is included in Arm GNU Toolchain.
2. If you have not installed the related pico-sdk environment, it is recommended to install it with the official pico demo.

Program the Demo with Raspberry Pi Debug Probe

  • With Pico Debug Probe, you can load the binaries via the SWD port and OpenOCD.
  • You do not need to unplug and hold the BOOTSEL button every time you push a new binary to Pico.
1. Take RP2040 usage as an example, the commands for programming the demo:
sudo openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000" -c "p​​rogram {your elf file name}.elf verify reset exit"
2. If there is a blink.elf file in your current file folder.
sudo openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000" -c "p​​rogram blink.elf verify reset exit"

Debug the Demo with Raspberry Pi Debug Probe

Open OpenOCD Server

  • You can let openocd be used in server mode and connect to GDB, thus providing you with breakpoints and "correct" debugging.
1. Here is also an example of debugging the rp2040 by entering the following command:
sudo openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000"
  • Take using PowerShell in windows as an example:

Raspberry Pi Debug Probe010.jpg

2. *If you start listening on the local 3333 port at this point, the OpenOCD server has been successfully turned on.

Use GDB Command Line

  • This demo is set up based on pico-sdk, and pico-example was compiled.
1. Open PowerShell and enter the corresponding "build" file folder, take the blink demo as an example.

Raspberry Pi Debug Probe011.jpg

2. Open GBD and enter the following commands:
  • If it is windows, you can input the following commands:
arm-none-eabi-gdb blink.elf
  • If it is Linux, you can input the following commands:
gdb blink.elf

Raspberry Pi Debug Probe012.jpg

3. Input the following commands in order:
target remote localhost:3333
load
monitor reset init
continue

Raspberry Pi Debug Probe013.jpg

  • You can see Pico executes blink, and LED blinks.

Use VSCode to Debug (Advanced)

  • Please make sure that the #Open OpenOCD Server and the #Use GDB Command Line are running properly.
  • Please make sure the Pico compilation environment is set up normally.
  • Please make sure your VSCode can install the following plug-in.
1. Cortex-Debug ()
2. Cmake-tools
3. C/C++

1. First, open the OpenOCD server:
Raspberry Pi Debug Probe010.jpg
2. Use VSC to open the pico-example file folder and open the blink demo.
3. Use F1 to input the following commands:

open 'launch.json'

4. Put the following content in after opening. Raspberry Pi Debug Probe014.jpg

  • If it is Windows, please input:
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Pico Debug",
            "type":"cortex-debug",
            "cwd": "${workspaceRoot}",
            "executable": "${command:cmake.launchTargetPath}",
            "request": "launch",
            "servertype": "external",
            // This may need to be arm-none-eabi-gdb depending on your system
            "gdbPath" : "gdb",
            // Connect to an already running OpenOCD instance
            "gdbTarget": "localhost:3333",
            "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd",
            "runToMain": true,
            // Work around for stopping at main on restart
            "postRestartCommands": [
                "break main",
                "continue"
            ]
        }
    ]
}
  • If it is a Linux system, please input:
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Pico Debug",
            "type":"cortex-debug",
            "cwd": "${workspaceRoot}",
            "executable": "${command:cmake.launchTargetPath}",
            "request": "launch",
            "servertype": "external",
            // This may need to be arm-none-eabi-gdb depending on your system
            "gdbPath" : "arm-none-eabi-gdb",
            // Connect to an already running OpenOCD instance
            "gdbTarget": "localhost:3333",
            "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd",
            "runToMain": true,
            // Work around for stopping at main on restart
            "postRestartCommands": [
                "break main",
                "continue"
            ]
        }
    ]
}
  • The difference between them is the gdb calls are different.

5. Enter the run and debug interface shortcut key Ctrl + Shift + D.
Raspberry Pico Debug Probe07.jpg

  • ①Select Pico Debug as the debugger.
  • ②Select CMake as the debug mode.
  • ③Start to debug the key, the shortcut key F5.
  • ④Choose the debug object as blink.

6. Click debug key to enter the debug mode, the shortcut key is F5.
Raspberry Pi Debug probe90.jpg
7. The Debug Tools show:
Raspberry Pi Debug Probe91.jpg

  • ①Restart the device.
  • ②Continue to run the demo.
  • ③Execute.
  • ④Enter the function to run.
  • ⑤Jumping out of function runs.
  • ⑥Stop debugging.

8. Continue to run the demo, press F5 and you can see Pico runs the blink demo.

Resource

Firmware

Datasheet

Software

OpenOCD

Pico-SDK Package (Windows)

Support



Technical Support

If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 AM GMT+8 (Monday to Friday)