Segger J-Link Reference Manual
Hide thumbs Also See for J-Link:

Advertisement

J-Link
Reference manual for
J-Link USB Protocol
Document RM08001-R2
Date: June 30, 2008
A product of SEGGER Microcontroller GmbH & Co. KG
www.segger.com

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the J-Link and is the answer not in the manual?

Questions and answers

Summary of Contents for Segger J-Link

  • Page 1 J-Link Reference manual for J-Link USB Protocol Document RM08001-R2 Date: June 30, 2008 A product of SEGGER Microcontroller GmbH & Co. KG www.segger.com...
  • Page 2 Please make sure your manual is the latest edition. While the information herein is assumed to be accurate, SEGGER MICROCONTROLLER GmbH & Co. KG (the manufacturer) assumes no responsibility for any errors or omissions. The manufacturer makes and you receive no warranties or conditions, express, implied, statutory or in any communica- tion with you.
  • Page 3: About This Document

    Reference to chapters, sections, tables and figures or other docu- Reference ments. GUIElement Buttons, dialog boxes, menu names, menu commands. Emphasis Very important sections Table 1.1: Typographic conventions RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 4 RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 5: Table Of Contents

    Get system information functions............... 21 Get state information functions..............27 JTAG & Hardware functions ............... 31 Target functions ..................45 Configuration functions................54 5 Glossary.........................57 6 Literature and references....................61 RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 6 RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 7: Introduction

    Chapter 1 Introduction This chapter describes the purpose of this manual and the J-Link ARM emulator which uses the J-Link USB Protocol. RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 8: How To Use This Manual

    CHAPTER 1 Introduction How to use this manual This manual describes the J-Link USB Protocol used in J-Link products and how it is used. In the course of this document the J-Link ARM is refered to as emulator. Purpose of this document The purpose of this document is to allow developers of open source software such as OpenOCD to write software which uses J-Link as debug interface.
  • Page 9: Licensing

    Chapter 2 Licensing This chapter gives information about the licensing terms under which this document is published. RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 10: License Terms

    The information in this document may only be used when fully agreeing to the terms mentioned in this chapter. Please note that the SEGGER J-Link software is copyrighted and may be used with original SEGGER J-Links and legal OEM versions only. For details, please refer to the License terms in License.txt which comes with the J-Link software and documenta-...
  • Page 11: Background Information

    Chapter 1 Background information This chapter provides information required to understand parameters for certain USB commands when working with the J-Link emulator. RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 12: Jtag Scan Chain Values

    For systems with just a single device, DevicePos is 0. For an example using the DevicePos value please refer to the paragraph Scan chain example on page 13. RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 13 (IR len) (IRpre) ARM(4) Xilinx(8) ARM(4) Xilinx(8) ARM(4) Xilinx(8) Xilinx(8) ARM(4) Xilinx(8) ARM(4) ARM(4) ARM(4) Xilinx(8) ARM(4) Xilinx(8) Xilinx(8) ARM(4) Table 1.1: Example scan chain RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 14: Emulator Configuration

    Allows usage of more than one 0xFF : Default J-Link at the same time. 0x01 - 0x03 0xFF Reserved 0xFFFFFFFF : Default, on if J-Link KS 0x04 - 0x07 0x00000000 : Off Kickstart power on JTAG-pin 19. 0x00000001 : On 0x08 - 0x1F 0xFF Reserved IP-Address in hex format.
  • Page 15: Jtag Data Buffers

    The J-Link has three JTAG data buffers. Two of these are output buffers used for TMS and TDI, the third is an input buffer for TDO data. To work with the J-Link, an under- standing of the buffers and the way the data is stored in them is quite useful.
  • Page 16 CHAPTER 1 Background information RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 17: Usb Communication

    Chapter 2 USB communication This chapter explains the USB communication protocol used by the J-Link software to communicate between host and emulator and how to use it. RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 18: Communication Protocol Overview

    Depending on the operating system being used, there are different ways to com- muincate with J-Link via USB. One way (under a Windows operating system) is to use the J-Link USB driver. One other option is to use "USBLib", which is a freeware pack- age available under different operating systems.
  • Page 19: Protocol Commands

    Writes to target memory on ARM 7/9 EMU_CMD_WRITE_MEM_ARM79 0xF7 targets. Reads from target memory on ARM 7/9 EMU_CMD_READ_MEM_ARM79 0xF8 targets. Table 2.1: Protocol command overview RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 20 CHAPTER 2 USB communication Define Value Explanation Configuration functions EMU_CMD_READ_CONFIG 0xF2 Reads the emulator configuration. EMU_CMD_WRITE_CONFIG 0xF3 Writes the emulator configuration. Table 2.1: Protocol command overview RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 21: Get System Information Functions

    Returns the firmware string. H<-E: 4A 2D 4C 69 6E 6B 20 63 6F 6D 70 69 6C 65 64 20 J-Link compiled 44 65 63 20 30 33 20 32 30 30 37 20 31 37 3A 31 Dec 03 2007 17:1 35 3A 33 31 20 41 52 4D 20 52 65 76 2E 35 00 00 5:31 ARM Rev.5..
  • Page 22 Retrieve base freq. and min. divider of emulator CPU. H->E: C0 Returns 48MHz base freq. with min. divider of 4. H<-E: 00 6C DC 02 04 00 RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 23 1 * U8 Table 2.6: EMU_CMD_GET_MAX_MEM_BLOCK command overview Response Direction Data Name Explanation H<-E MaxSize Returned maximum block size. 1 * U32 Table 2.7: EMU_CMD_GET_MAX_MEM_BLOCK response overview RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 24 Supports commands EMU_CAP_MEASURE_RTCK_REACT "CMD_MEASURE_RTCK_REACT" Supports command "CMD_HW_SELECT_IF" EMU_CAP_SELECT_IF Supports command "CMD_WRITE_MEM_ARM79", EMU_CAP_RW_MEM_ARM79 "CMD_READ_MEM_ARM79" Supports command "CMD_GET_COUNTERS" EMU_CAP_GET_COUNTERS 20 - 31 Reserved Table 2.10: EMU_CMD_GET_CAPS flag overview RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 25 Sample communication Retrieve emulator capabilities. H->E: E8 Returns all capabilities except trace commands. H<-E: BF 7F FF 00 RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 26 The hardware version is returned in the following format. Mmmrr This stands for: Major version mm: Minor version Revision Example: The version 52000 stands for a J-Link Version 5.2 . If the capability EMU_CMD_GET_HW_VERSION is not enabled is always 0x00 . Version Sample communication Retrieve hardware version command.
  • Page 27: Get State Information Functions

    Retrieve state information command. H->E: 07 Returns 3.267V; TCK, TRES and TRST are high; TDI, TDO, TMS are low. H<-E: C3 0C 01 00 00 00 01 01 RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 28 H->E: C1 05 00 00 00 Returns KS power is on and the target consumes 12mA. H<-E: 01 00 00 00 0C 00 00 00 RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 29 Mask. Undefined flags return 0xFFFFFFFF. Sample communication Requesting value of the power change counter. H->E: C2 02 00 00 00 Returns 5 power changes. H<-E: 05 00 00 00 RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 30 Returns O.K., Min. 0ns, Max. 126ns and Average 25ns reaction time. H<-E: 00 00 00 00 00 00 00 00 7E 00 00 00 19 00 00 00 RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 31: Jtag & Hardware Functions

    1 * U8 Table 2.23: EMU_CMD_RESET_TRST command overview Response Additional information Activates TRST and releases it after 2ms. Sample communication Reset TRST command. H->E: 02 RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 32 0x001E for 30kHz. 0xFFFF for adaptive clocking Table 2.24: EMU_CMD_SET_SPEED command overview Response Sample communication Set speed to adaptive clocking command. H->E: 05 FF FF RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 33 JTAG pin 19 may provide 5V power to a target system. For details, please refer to J- Link User manual. Sample communication Set KS power to on command. H->E: 08 01 RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 34 Default value of clock ping (TCK) is high. So this function generates a low pulse, fol- lowed by a high pulse on TCK. Sample communication Generate one clock. H->E: C8 Returns TDI data. H<-E: 00 RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 35 Clears TMS signal. Command Direction Data Name Explanation H->E Command: 0xC9 1 * U8 Table 2.28: EMU_CMD_HW_TMS0 command overview Response Sample communication Clear TMS command. H->E: C9 RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 36 Sets TMS signal. Command Direction Data Name Explanation H->E Command: 0xCA 1 * U8 Table 2.29: EMU_CMD_HW_TMS1 command overview Response Sample communication Set TMS command. H->E: CA RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 37 Clears TDI signal. Command Direction Data Name Explanation H->E Command: 0xCB 1 * U8 Table 2.30: EMU_CMD_HW_DATA0 command overview Response Sample communication Clear TDI command. H->E: CB RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 38 Sets TDI signal. Command Direction Data Name Explanation H->E Command: 0xCC 1 * U8 Table 2.31: EMU_CMD_HW_DATA1 command overview Response Sample communication Set TDI command. H->E: CC RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 39 = (NumBits + 7) >> 3 * U8 NumBytes Table 2.33: EMU_CMD_HW_JTAG response overview Additional information This command is obsolete. Please use EMU_CMD_HW_JTAG3 on page 41. RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 40 = (NumBits + 7) >> 3 * U8 NumBytes Table 2.35: EMU_CMD_HW_JTAG2 response overview Additional information This command is obsolete. Please use EMU_CMD_HW_JTAG3 on page 41. RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 41 H->E: CF 00 48 00 86 E3 71 C0 01 00 00 00 0C 20 00 18 02 00 00 00 00 00 Returns TDO data. H<-E: 20 00 08 00 48 00 00 00 00 Returns O.K. H<-E: 00 RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 42 Activates TRST signal. Command Direction Data Name Explanation H->E Command: 0xDE 1 * U8 Table 2.38: EMU_CMD_HW_TRST0 command overview Response Sample communication Activate TRST command. H->E: DE RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 43 Deactivates TRST signal. Command Direction Data Name Explanation H->E Command: 0xDF 1 * U8 Table 2.39: EMU_CMD_HW_TRST1 command overview Response Sample communication Deactivate TRST command. H->E: DF RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 44 0x00: O.K. 1 * U8 0x01: Timeout Table 2.41: EMU_CMD_WRITE_DCC response overview Additional information Explanation of DCC data generation is beyond the scope of this document. RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 45: Target Functions

    Table 2.42: EMU_CMD_RESET_TARGET command overview Response Additional information Activates the target RESET line and releases it after 2ms. Sample communication Reset target command. H->E: 03 RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 46 ResetHigh(); do { i++; SendSequence(); } while(((Data & CriteriaMask) != CriteriaData) && (i <= NumReps)) This command is emplemented for ARM7 and ARM9 cores only. RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 47 For further information please refer to EMU_CMD_HW_RELEASE_RESET_STOP_EX on page 46. The only difference of this command is that the abort criteria is a timeout instead of a maximum repeat count. RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 48 Command Direction Data Name Explanation H->E Command: 0xDC 1 * U8 Table 2.47: EMU_CMD_HW_RESET0 command overview Response Sample communication Activate target reset command. H->E: DC RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 49 Command Direction Data Name Explanation H->E Command: 0xDD 1 * U8 Table 2.48: EMU_CMD_HW_RESET1 command overview Response Sample communication Deactivate target reset command. H->E: DD RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 50 Table 2.51: EMU_CMD_GET_CPU_CAPS flag overview Sample communication Requesting the CPU capabilities. H->E: E9 07 00 00 00 Returns no capabilites. H<-E: 01 00 00 00 RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 51 The list below gives an overview about the available CPU commands. Define Value Explanation CPU_CMD_WRITE_MEM Writes to target memory. CPU_CMD_READ_MEM Reads from target memory. Table 2.54: CPU command overview RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 52 Writing 0xAB to address 0x12345678. H->E: F7 04 01 00 00 00 00 00 00 01 78 56 34 12 01 00 00 00 AB Returns O.K. H<-E: 00 RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 53 H->E: F8 04 01 00 00 00 00 00 00 01 10 00 00 00 01 00 00 00 Returns O.K. H<-E: 00 Returns data read from address 0x10. H<-E: 18 RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 54: Configuration Functions

    CHAPTER 2 USB communication Configuration functions These commands are used to configure the emulator. 2.7.1 EMU_CMD_READ_CONFIG Description Reads the emulator configuration from the J-Link. Command Direction Data Name Explanation H->E Command: 0xF2 1 * U8 Table 2.59: EMU_CMD_READ_CONFIG command overview...
  • Page 55 2.7.2 EMU_CMD_WRITE_CONFIG Description Writes the emulator configuration to the J-Link. Command Direction Data Name Explanation H->E Command: 0xF3 1 * U8 Emulator H->E The new emulator configuration. 256 * U8 configuration Table 2.61: EMU_CMD_WRITE_CONFIG communication overview Response Sample communication Send emulator configuration command.
  • Page 56 CHAPTER 2 USB communication RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 57: Glossary

    Chapter 3 Glossary This chapter describes important terms used throughout this manual. RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 58 Glossary Adaptive clocking A technique in which a clock signal is sent out by J-Link / J-Trace. J-Link / J-Trace waits for the returned clock before generating the next clock pulse. The technique allows the J-Link / J-Trace interface unit to adapt to differing signal drive capabilities and differing cable lengths.
  • Page 59 TDO. The electronic signal input to a TAP controller from the data source (upstream). Usu- ally, this is seen connecting the J-Link / J-Trace Interface Unit to the first TAP control- ler. The electronic signal output from a TAP controller to the data sink (downstream).
  • Page 60 A location within the image that will be monitored and that will cause execution to stop when it changes. Word A 32-bit unit of information. Contents are taken as being an unsigned integer unless otherwise stated. RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 61: Literature And References

    Chapter 4 Literature and references This chapter lists documents, which we think may be useful to gain deeper under- standing of technical details. RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 62 CHAPTER 4 Literature and references Reference Title Comments This document gives information about using the SEGGER J-Link / J- SEGGER J-Link / J-Trace User's [UM08001] Trace ARM. Guide. It is publicly available from SEGGER (www.segger.com). This document contains some hard-...
  • Page 63 In-Circuit Emulator ......58 Instruction Register ......58 IR ............58 Watchpoint ......... 60 Word ..........60 Joint Test Action Group (JTAG) ....58 Little-endian ........59 Memory coherency .......59 nTRST ..........59 RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...
  • Page 64 Index RM08001 Reference manual for J-Link USB Protocol © 2008 SEGGER Microcontroller GmbH & Co. KG...

Table of Contents