# Rasberry Pi Debug Probe

- CMSIS-DAP
- UART (U) and I2C connector (D)
- Does not provide power, target board needs to be powered but mind it needs shared ground

## Pinout

<div class="dlist" id="bkmrk-orange---tx%2Fsc-%28outp">- **Orange** - `TX`/`SC` (Output from Probe)
- **Black** - `GND`
- **Yellow** - `RX`/`SD` (Input to Probe or I/O)

</div>## Pico connection

<div class="ulist" id="bkmrk-the-debug-probe-%22d%22-">- The Debug Probe "D" port to Pico H SWD JST-SH connector
- The Debug Probe "U" port, with the three-pin JST-SH connector to 0.1-inch header (male):
    
    <div class="ulist">
    - Debug Probe `RX` connected to Pico H `TX` pin
    - Debug Probe `TX` connected to Pico H `RX` pin
    - Debug Probe `GND` connected to Pico H `GND` pin
    
    </div>

</div>## Debugging

```
 openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000"
 # on another terminal
 telnet localhost 4444
 reg
```

## Flashing and debugging

### probe-rs

- [Project template for rp2040-hal](https://github.com/rp-rs/rp2040-project-template)

Using runner command: `sudo probe-rs run --chip RP2040 --protocol swd`

Cargo configuration:

<details id="bkmrk-.cargo%2Fconfig.toml-%5B"><summary>.cargo/config.toml</summary>

```
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
# Choose a default "cargo run" tool (see README for more info)
# - `probe-rs` provides flashing and defmt via a hardware debugger, and stack unwind on panic
# - elf2uf2-rs loads firmware over USB when the rp2040 is in boot mode
runner = "sudo probe-rs run --chip RP2040 --protocol swd"
# runner = "elf2uf2-rs -d"

rustflags = [
  "-C", "linker=flip-link",
  "-C", "link-arg=--nmagic",
  "-C", "link-arg=-Tlink.x",
  "-C", "link-arg=-Tdefmt.x",

  # Code-size optimizations.
  #   trap unreachable can save a lot of space, but requires nightly compiler.
  #   uncomment the next line if you wish to enable it
  # "-Z", "trap-unreachable=no",
  "-C", "no-vectorize-loops",
]

[build]
target = "thumbv6m-none-eabi"

[env]
DEFMT_LOG = "debug"
```

</details><div class="dlist" id="bkmrk--1"></div>