8 releases

0.3.0 Feb 4, 2022
0.2.0 May 27, 2021
0.1.5 Aug 27, 2020
0.1.4 Jul 25, 2020
0.1.0 Dec 8, 2019

#291 in Debugging

Download history 1444/week @ 2023-11-27 1499/week @ 2023-12-04 1391/week @ 2023-12-11 1132/week @ 2023-12-18 810/week @ 2023-12-25 1341/week @ 2024-01-01 1071/week @ 2024-01-08 1138/week @ 2024-01-15 1194/week @ 2024-01-22 1220/week @ 2024-01-29 1121/week @ 2024-02-05 1176/week @ 2024-02-12 1131/week @ 2024-02-19 987/week @ 2024-02-26 978/week @ 2024-03-04 441/week @ 2024-03-11

3,632 downloads per month

0BSD license

82KB
1.5K SLoC

A crate for controlling J-Link debug probes

crates.io docs.rs CI

This crate allows talking to J-Link debug probes attached via USB. The probe's pins can be controlled and I/O operations using JTAG or SWD can be performed, enabling control of target MCUs.

Please refer to the changelog to see what changed in the last releases.

Usage

Add an entry to your Cargo.toml:

[dependencies]
jaylink = "0.3.0"

Check the API Documentation for how to use the crate's functionality.

Rust version support

This crate targets the latest stable Rust release.


lib.rs:

A crate for talking to J-Link debug probes connected via USB.

This crate allows access to the vendor-specific USB interface used to control JTAG / SWD operations and other functionality. It does not provide access to the virtual COM port functionality (which is a regular CDC device, so no special support is needed).

Inspired by libjaylink (though this library is not a port).

Pinout

J-Link uses a pinout based on the standard 20-pin ARM JTAG connector, extended for SWD compatibility and with pins for UART.

JTAG pinout:

           ┌───────────┐
    VTref  │ *  1  2 * │ NC
    nTRST  │ *  3  4 * │ GND
      TDI  │ *  5  6 * │ GND
      TMS  │ *  7  8 * │ GND
      TCK ┌┘ *  9 10 * │ GND
     RTCK └┐ * 11 12 * │ GND
      TDO  │ * 13 14 * │ GND
    RESET  │ * 15 16 * │ GND
    DBGRQ  │ * 17 18 * │ GND
5V-Supply  │ * 19 20 * │ GND
           └───────────┘

SWD (+ UART) pinout:

           ┌───────────┐
    VTref  │ *  1  2 * │ NC
        -  │ *  3  4 * │ GND
J-Link TX  │ *  5  6 * │ GND
    SWDIO  │ *  7  8 * │ GND
    SWCLK ┌┘ *  9 10 * │ GND
        - └┐ * 11 12 * │ GND
      SWO  │ * 13 14 * │ GND
    RESET  │ * 15 16 * │ GND
J-Link RX  │ * 17 18 * │ GND
5V-Supply  │ * 19 20 * │ GND
           └───────────┘

PIC32 ICSP pinout (untested):

           ┌───────────┐
    VTref  │ *  1  2 * │ NC
        -  │ *  3  4 * │ GND
        -  │ *  5  6 * │ GND
     PGED  │ *  7  8 * │ GND
     PGEC ┌┘ *  9 10 * │ GND
        - └┐ * 11 12 * │ GND
        -  │ * 13 14 * │ GND
    RESET  │ * 15 16 * │ GND
        -  │ * 17 18 * │ GND
5V-Supply  │ * 19 20 * │ GND
           └───────────┘

Reference

Segger has released a PDF documenting the USB protocol: "Reference manual for J-Link USB Protocol" (Document RM08001-R2).

The archive.org version is the most up-to-date one.

Dependencies

~2MB
~39K SLoC