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

#1571 in Embedded development

Download history 358/week @ 2024-08-05 409/week @ 2024-08-12 307/week @ 2024-08-19 337/week @ 2024-08-26 436/week @ 2024-09-02 357/week @ 2024-09-09 275/week @ 2024-09-16 408/week @ 2024-09-23 343/week @ 2024-09-30 271/week @ 2024-10-07 288/week @ 2024-10-14 290/week @ 2024-10-21 492/week @ 2024-10-28 319/week @ 2024-11-04 315/week @ 2024-11-11 327/week @ 2024-11-18

1,475 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