Segger J-Link: JTAG Usage

From Embedded Lab Vienna for IoT & Security
Jump to navigation Jump to search

Summary

This documentation describes the steps necessary to use the Segger J-Link V8 to connect to a device using JTAG. In this example, a BeagleBoard® https://www.beagleboard.org/boards/beagleboard is used.

Requirements

  • Target JTAG Device (e.g. BeagleBoard®)
  • Compatible cable to connect the target's JTAG pins to the J-Link
    • J-Link uses a standard 20-Pin connector compatible to ARM's Multi-ICE.
  • Software: J-Link Software and Documentation pack https://www.segger.com/downloads/jlink/

Description

Step 1 - Connect J-Link to PC

Connect the Segger J-Link to the PC using the included cable and start the J-Link Commander. Upon successful detection of the J-Link, a message like the following is shown:

SEGGER J-Link Commander V7.86f (Compiled Mar 29 2023 16:41:57)
DLL version V7.86f, compiled Mar 29 2023 16:39:17

Connecting to J-Link via USB...O.K.
Firmware: J-Link ARM V8 compiled Nov 28 2014 13:44:46
Hardware version: V8.00
J-Link uptime (since boot): N/A (Not supported by this model)
S/N: 788529685
License(s): RDI,FlashDL,FlashBP,JFlash,GDB
VTref=3.313V


Type "connect" to establish a target connection, '?' for help
J-Link>

Step 2 - Connect J-Link to target device

Connect the J-Link to the target device's JTAG pins using an appropriate cable.

In this example, such a cable to connect to the BeagleBoard was not available. Therefore, the pins have been connected manually in the following way:

BeagleBoard J-Link
1 - TMS 7 - TMS
2 - nTRST 3 - nTRST
3 - TDI 5 - TDI
4 - GND 4 - GND
5 - VIO 1 - VTref
7 - TDO 13 - TDO
9 - RTCK 11 - RTCK
11 - TCK 9 - TCK

The other pins were not connected.

See https://beagleboard.org/static/BBSRM_latest.pdf (Page 112) for more information about the BeagleBoard's JTAG connector.

Information about the J-Link's pins can be found here: https://www.segger.com/products/debug-probes/j-link/technology/interface-description

Step 3 - Connect using J-Link Commander

J-Link supports many different devices/CPUs already. The BeagleBoard however requires a custom configuration script which can be found here: https://github.com/nullsub/sidplayer/blob/master/jlinkserver/Samples/JLink/Scripts/ScriptBeagleBoard_OMAP3530.JLinkScript

This script requires a little modification before it can be used. Some variables are declared as type __int64. This type was only available up to version 6.16 of the J-Link Software. For the usage in newer version it can be replaced with U32. Although the name __int64 might suggest that it stores 64-bit values, according to https://forum.segger.com/index.php/Thread/4189-SOLVED-JLinkScript-and-int64/?postID=15018#post15018 it was internally handled as 32-bit, so these changes should have no effect on the script.

The modified script has to be saved in the installation directory as Default.JLinkScript.

Power the target device and connect the J-Link to the PC (if not already connected) and start the J-Link Commander. An output similar to the one shown in Step 1 should be shown again. Type connect and then specify the target device / core. For the BeagleBoard type CORTEX-A8. For the other settings keep the default values. After connecting it is possible to run commands like halt to halt the cpu, go to resume, etc. A list of commands can be found by typing ?.

Used Hardware

References