Expand description
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.
Structs§
- BitIter
- An iterator over a received bit stream.
- Capabilities
- A set of capabilities advertised by a probe.
- Error
- The error type used by this library.
- Hardware
Version - A hardware version returned by
JayLink::read_hardware_version
. - Interface
Iter - Iterator over supported
Interface
s. - Interfaces
- A set of supported target interfaces.
- JayLink
- A handle to a J-Link USB device.
- Speed
Config - Target communication speed setting.
- Speed
Info - J-Link communication speed info.
- SwoData
- SWO data that was read via
JayLink::swo_read
. - SwoSpeed
Info - Supported SWO capture speed info.
- SwoStream
- A SWO data stream that implements
std::io::Read
. - UsbDevice
Info - Generic info about a USB device.
Enums§
- Capability
- List of capabilities that may be advertised by a probe.
- Error
Kind - List of specific errors that may occur when using this library.
- Hardware
Type - The hardware/product type of the device.
- Interface
- List of target interfaces.
- SwoMode
- The supported SWO data encoding modes.
Functions§
- scan_
usb - Scans for J-Link USB devices.