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

#1563 in Embedded development

Download history 364/week @ 2024-07-21 426/week @ 2024-07-28 346/week @ 2024-08-04 425/week @ 2024-08-11 304/week @ 2024-08-18 319/week @ 2024-08-25 438/week @ 2024-09-01 370/week @ 2024-09-08 286/week @ 2024-09-15 401/week @ 2024-09-22 342/week @ 2024-09-29 278/week @ 2024-10-06 288/week @ 2024-10-13 288/week @ 2024-10-20 486/week @ 2024-10-27 309/week @ 2024-11-03

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