Home

Reference manual for J-Link USB Protocol

image

Contents

1. Bit Define Explanation 0 EMU CAP EX RESERVED Always 1 Supports command 1 EMU_CAP_EX_GET_HW_VERSION EMU CMp GET HARDWARE VERSION E z E Supports command a EMU_CAP_EX_WRITE_DCC EMU_CMD_WRITE_DCC 3 Ste Ti AU Supports adaptive clocking 2 Supports command hi EMU_CAP_EX_READ_CONFIG EMU_CMD_READ_CONFIG Supports command 5 EMU CAP EX WRITE CONFIG EMU CMD WRITE CONFIG 6 EMU CAP EX TRACE Supports trace commands 7 EMU CAP EX WRITE MEM SO points ollie E ie EMU_CMD_WRITE_MEM 8 EMT CAD Er ETAD MON Supports command T t ii EMU CMD READ MEM EM Supports command 9 EMU CAP EX SPEED INFO EMU CMD GET SPEED 10 EMU CAP EX EXEC CODE Supports commands EMU CMD CODE 11 EMU CAP EX GET MAX BLOCK S Supports command IZE EMU CMD GET MAX BLOCK SIZE Supports commands 12 EMU CAP EX GET HW INFO EMU CMD GET HW INFO Supports commands 13 EMU CAP EX SET KS POWER EMU CMD SET KS POWER EMU CAP EX RESET STOP TIME Supports commands 14 a i EMU CMD HW RELEASE RESET STOP TI MED 15 Reserved 16 EMU_CAP_EX_MEASURE_RTCK_RE Supports commands ACT EMU_CMD_MEASURE_RTCK_REACT s j Supports command d EMU CAE EX SEUECL IT EMU_CMD_HW_SELECT_IF Supports command 18 EMU_CAP_EX_RW_MEM_ARM79 EMU_CMD_WRITE_M
2. The amount of U32 data returned by this command depends on how many flags you haved used in your Mask Undefined flags return OxFFFFFFFF Sample communication Retrieve hadrware information about KS power status and target consumption H E C1 05 00 00 00 Returns KS power is on and the target consumes 12mA H E 01 00 00 00 OC 00 00 00 RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 37 5 4 3 EMU CMD GET COUNTERS Description Retrieves counter values of how long a target is connected and how many times a target was connected disconnected Command Direction Data Name Explanation H gt E 1 U8 Cmd Command OxC2 HESSE E Mask Bitmask selecting the information that should be retrieved Table 5 21 EMU CMD GET COUNTERS command overview Response Direction Data Name Explanation H lt E c t Counters Returned counter values x means the amount of counter values defined by the Mask flags Table 5 22 EMU_CMD_GET_COUNTERS response overview Additional information The flags that can be used as Mask are described in the table below Bit Define Explanation Retrieves the counter describing how 0 CNT_INDEX_POWER_ON many ms a powered target is connected The counter is reset after 24h
3. Description Reads the emulator configuration from the J Link Command Direction Data Name Explanation H gt E 1 U8 Cmd Command OxF2 Table 5 71 EMU CMD READ CONFIG command overview Response Direction Data Name Explanation H E 256 U8 Pmi atar Returns the actual emulator configuration configuration Table 5 72 EMU CMD READ CONFIG response overview Sample communication Retrieve emulator configuration command H gt E F2 Returns emulator H E 00 02 FF FF 01 00 00 00 configuration FE FE EF FE FE FP FE FPE BR FE FE EE FE FE ER EB FE FE FE EF FEP FE EP FE FE FF FP FE FE FE FE FE FE EE FE FF FE FE EF FE FE FE FE FE EF FE EB EE FE FE FE EF EF ER FR FE FE FE EB FEE FE FE EF FF FF FE EF FF FE FE EF FE EF EF FP FE FE FE FE FE FE FP FE EF EE FE EP FE FE FF FPE FF EE FE EE FF FE FE FE FF EF EE EF FE FF FE FF FF FE FF FF FF FF FF FF FF FF FF FF FF FF FE FF FF FE FE FF FE FE FF FE FF FF FF FF FF FE EE FF FF FF FE FP FE FE FF FE FR FE FE FF FE FF FE FE FE FE FE FE FE FE FE ER FF FF FF FF FF FF FE FF FF FF FF FF FF FF FF FF FF FF FF FF FF
4. EMU CMD GET CPU CAPS OxE9 Retrieves capabilities of the CPU EMU CMD EXEC CPU CMD OxEA Executes a CPU command EMU CMD WRITE MEM OxF4 Writes to target memory EMU CMD READ MEM OxF5 Reads from target memory EMU CMD WRITE MEM ARM79 OxF7 Writes to target memory on ARM 7 9 targets EMU CMD READ MEM ARM79 OxF8 Reads from target memory on ARM 7 9 targets Configuration functions EMU CMD READ CONFIG OxF2 Reads the emulator configuration EMU CMD WRITE CONFIG OxF3 Writes the emulator configuration Table 5 1 Protocol command overview RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 27 5 3 Get system information functions These commands are used to retrieve information about the firmware used by the emulator 5 3 1 EMU CMD VERSION Description Retrieves the length and content of the firmware version string of the emulator Command Direction Data Name Explanation H gt E 1 u8 Cmd Command 0x01 Table 5 2 EMU CMD VERSION command overview Response Direction Data Name Explanation H lt E ik t NumBytes Length of the firmware string in bytes Typically 0x70 H E MN Version Firmware version string Table 5 3 EMU CMD VERSION response overview Additional information This is typically the first command sent Sample communication Retrieve firmware string com
5. Retrieves the counter describing how 1 CNT_INDEX_POWER_CHANGE many times a powered target was con nected or disconnected Table 5 23 EMU_CMD_GET_COUNTERS flag overview The amount of U32 data returned by this command depends on how many flags you have used in your Mask Undefined flags return OxFFFFFFFF Sample communication Requesting value of the power change counter H gt E C2 02 00 00 00 Returns 5 power changes H lt E 05 00 00 00 RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 38 CHAPTER 5 Emulator protocol 5 4 4 EMU CMD MEASURE RTCK REACT Description Measures the RTCK reaction time of the target device Command Direction Data Name Explanation H gt E 1 U8 Cmd Command OxF6 Table 5 24 EMU CMD MEASURE RTCK REACT command overview Response Direction Data Name Explanation i 0x00000000 O K Heg CTUM Result 0x00000001 RTCK did not react on time H E dL 5 92 Minimum Minimum RTCK reaction time in ns H E i U32 Maximum Maximum RTCK reaction time in ns H lt E 1 Usg Average Average RTCK reaction time in ns Table 5 25 EMU_CMD_MEASURE_RTCK_REACT response overview Sample communication Measure RTCK reaction time command H gt E F6 Returns O K Min Ons Max 126ns and Average 25ns reaction time H lt E 00 00 00 00 00 00 00 00 7E 00 00 00 19 00 00 00 RM08001 Re
6. 2009 SEGGER Microcontroller GmbH amp Co KG 35 5 4 Get state information functions These commands are used to retrieve information about the actual status of the emulator 5 4 1 EMU CMD GET STATE Description Retrieves the voltage of the target and the JTAG pin states for TCK TDI TDO TMS TRES and TRST Command Direction Data Name Explanation H gt E 1 ug Cmd Command 0x07 Table 5 16 EMU CMD GET STATE command overview Response Direction Data Name Explanation H E 1 U16 Voltage VCC stored in unit mV H E 1 U8 TCK JTAG pin TCK state H E 1 U8 TDI JTAG pin TDI state H E i ws TDO JTAG pin TDO state H E 1 U8 TMS JTAG pin TMS state H lt E 1 U8 TRES JTAG pin TRES state H lt E U8 TRST JTAG pin TRST state Table 5 17 EMU_CMD_GET_STATE response overview Sample communication Retrieve state information command H gt 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 2009 SEGGER Microcontroller GmbH amp Co KG 36 CHAPTER 5 Emulator protocol 5 4 2 EMU CMD GET HW INFO Description Retrieves information about the KS power of the emulator Command Direction Data Name Explanation H gt E 1 U8 Cmd Command OxC1 H gt E eas Mask ble ee eae the information that should Table 5 18 EMU_
7. FF FE FF FF FF FF FF FE FF FF EE FF FF FF FF FF ER FE EB FE FE EF EP FF FE PE FE FE EE EB EF EE FE FF FE FE FE FE FF FE FE FE FE EF FE FP FP FPE FE FF EB FE FE FF FE FF FF FP FE FF FPE FP FFE FE For further information please refer to Emulator configuration on page 16 RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 67 5 7 2 EMU CMD WRITE CONFIG Description Writes the emulator configuration to the J Link Command Direction Data Name Explanation H gt E 1 U8 Cmd Command OxF3 H gt E 256 U8 Eee i The new emulator configuration configuration Table 5 73 EMU CMD WRITE CONFIG communication overview Response Sample communication Send emulator configuration command H gt E F3 Send emulator configuration H gt E 00 02 FF FF 01 00 00 00 FE FE FE FF EF EF FP FE FF FP FE FE FE FE REB EE FE FE FE EF EF EE FE FE FE FF FE BE FE FE Fr FE FE FE FE FF EF OBERE FF EF FE FE FE FE FE FE Fr FE FE FE FE EB EF EF FE FE FE FF EF FPE FE FE EB FE FE EP FE FF FEF EP FE FF FE EF FE PE FE ER EE FE FE FE FE FF EF FP FE FF FF FE FF FF FF FF FF FF FE FF
8. FF FF FF FF FF FF FE FE FF FF FF FF FF FF FE FF FF FF FF FF FF FF FF FP FF FF FE FF FF FF FE FF FF FF FF FF FF FE FF FE FF FF FE FE FF FF FE FF FF FF FF FF FF FF FF FP FF FF FF FF FF FF EF FE FF FF FF FF FF FF FF FE FF FF FF FF FF FE FE FF FF FF FF FF FF FF FE EF FE PEP EF FF EE FE FF FE FE FEFE FF EF FE FE FE FE FE PE FE EF EE EF FE EE FE FE EF EE FF EF FE FE FE EE FE FE EB BER FP BE FE EB EF EF FE FE FE FF EF PE FE FE RB EF FE BB BR FF EF FP FE FE For further information please refer to Emulator configuration on page 16 RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 68 CHAPTER 5 Emulator protocol RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 69 Chapter 6 Glossary This chapter describes important terms used throughout this manual RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 70 CHAPTER 6 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
9. 5 EMU_CAP_WRITE_CONFIG 7 scu aes EMU CMD WRITE MEM Supports command 3 TERMES EMU CMD READ MEM 9 EMU CAP SPEED INFO Supports command EMU CMD GET SPEED 10 EMU CAP EXEC CODE Supports commands EMU CMD CODE X Supports command d EMU_CAP_GET_MAX_BLOCK_SIZE EM CMD GET MAX BLOCK SIZE gt gt Supports commands Es dtc ic EMU CMD GET HW INFO 2 Supports commands ie ee E EMU CMD SET KS POWER Supports commands 14 EMU CAP RESET STOP TIMED EMU CMD HW RELEASE RESET STOP TI MED 15 Reserved gt l Supports commands di EMU CAP MEASURE RTCK REACT EMU CMD MEASURE RTCK REACT 17 EMU CAP SELECT IF Supports command EMU CMD HW SELECT IF Table 5 10 EMU CMD GET CAPS flag overview RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 31 Bit Define Explanation Supports command 18 EMU CAP RW MEM ARM79 EMU CMD WRITE MEM ARM79 EMU CMD READ MEM ARM79 Supports command 19 EMU CAP GET COUNTERS EMU CMD GET COUNTERS 20 EMU CAP READ DCC Supports command EMU CMD READ DCC Supports command 21 EMU CAP GET CPU CAPS EMU CMD GET CPU CAPS Supports command 22 EMU CAP EXEC CPU CMD EMU CMD EXEC
10. 5V and LOW approaching OV Watchpoint 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 2009 SEGGER Microcontroller GmbH amp Co KG 73 Chapter 7 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 2009 SEGGER Microcontroller GmbH amp Co KG 74 CHAPTER 7 Literature and references Reference Title Comments This document gives information ps E 1 about using the SEGGER J Link J UM08001 sia Link J Trace User s Trace ARM It is publicly available from SEGGER www segger com This document contains some hard i ware specific informations which are UMO8004 SEG BER Te RELBSSIS thought of beeing helpful It is publicly available from SEGGER www segger com IEEE Standard Test Access This document contains the IEEE 1149 2000 JTAG standard IEEE Port and Boundary Scan Archi 1 is publicly available from IEEE tecture IEEE SS94949 p y www ieee org Table 7 1 Literature and Refernces RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 75 Index
11. U8 NumBytes NumBits 7 gt gt 3 H gt E lt NumBytes gt LD Data for TDI NumBytes calculates as follows U8 NumBytes NumBits 7 gt gt 3 Table 5 40 EMU CMD HW JTAG2 command overview Response Direction Data Name Explanation H lt E lt NumBytes gt TDO TDO data NumBytes calculates as follows U8 NumBytes NumBits 7 gt gt 3 Table 5 41 EMU_CMD_HW_JTAG2 response overview Additional information This command is obsolete for J Links with hardware version 5 and above Please use EMU_CMD_HW_JTAG3 on page 50 The hardware version can be retrieved using the command EMU CMD GET HW VERSION on page 34 RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 50 5 5 12 EMU CMD HW JTAG3 Description CHAPTER 5 Emulator protocol Handles the JTAG connection If used with JTAG interface it receives data for TDI and TMS and sends TDO data back If used with SWD interface it receives data for SWDIO in and DIR and sends SWDIO out data back Command JTAG interface Direction Data Name Explanation H gt E i ue Cmd Command OxCF H gt E ve DUMMY DAT data in order to word align data trans H gt E i yip NumBits Number of bits to transfer H gt E lt NumBytes gt TMS Data for TMS NumBytes calculates as follows U8 NumBytes NumBits 7 gt gt 3 H gt E lt NumBytes gt pI Data for TDI NumBytes c
12. 1 U8 IsARM9 0x01 ARM A 0x00 Little endian H gt E 1 U8 IsBigEndian 0x01 Big endian H gt E 1 UL Dummy Dummy field H gt E 1 U8 SubCmd Typically 0x01 H gt E iL 19g Addr Target address in memory H gt E 1 U32 NumBytes Number of bytes to read Table 5 69 EMU CMD READ MEM ARMZ79 command overview Response Direction Data Name Explanation 0x00 O K Fl 0x01 Adaptive clocking timeout ANA us ReturnStatus 0x02 Memory access timeout 0x03 Core error E RUE Data that is read from the memory H E 1 a bata This transaction only happens if Return Status 0x00 Or NumBytes lt 0x40 Address at which an error occured H lt E i 32 ErrorAddr This transaction only happens if Return Status 0x00 Or NumBytes gt 0x40 Information about which data width could H lt E ls Us2 FailAccessWidth not be accessed MEIO T This transaction only happens if Return Status 0x00 Or NumBytes gt 0x40 Table 5 70 EMU_CMD_READ_MEM_ARM79 response overview Sample communication Retrieve 1 byte from address Ox10 command H gt 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 2009 SEGGER Microcontroller GmbH amp Co KG 66 CHAPTER 5 Emulator protocol 5 7 Configuration functions These commands are used to configure the emulator 5 7 1 EMU CMD READ CONFIG
13. 15 RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 3 1 3 Scan chain example The following table shows a few sample configurations with 1 2 and 3 devices in dif ferent configurations The DUT is marked in blue Device 0 Device 1 Device 2 IR len IR len IR len IR len DevicePos Re ARM 4 7 0 0 ARM 4 Xilinx 8 0 0 Xilinx 8 ARM 4 1 8 Xilinx 8 Xilinx 8 ARM 4 2 16 ARM 4 Xilinx 8 ARM 4 0 0 ARM 4 Xilinx 8 ARM 4 2 12 Xilinx 8 ARM 4 Xilinx 8 1 8 Table 3 1 Example scan chain RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 16 3 2 CHAPTER 3 Emulator configuration Background information Emulator configuration is a 256 byte non volatile memory area which can be read and written via USB It holds the emulator configuration that was setup for your J Link The following table shows the current configuration offsets and their meanings Offset Values Explanation 2 USB Address of the emulator 0x00 ae B 9x03 a Oe Allows usage of more than one E J Link at the same time 0x01 0x03 OxFF Reserved OxFFFFFFFF Default on if J Link KS 0x04 0x07 0x00000000 Off Kickstart power on JTAG pin 19 0x00000001 On 0x08 Ox1F OxFF Reserved IP Address in hex format 0x20 0x23 OxFFFFFFFF if not configured IP A
14. 2 1 Timeout J Link uses a 5 second timeout for all USB operations This means that every command needs to be completed within 5 seconds If 5 sec onds is too short for example for a long JTAG sequence at a low speed the JTAG sequence needs to be split into 2 or more shorter sequences 4 2 2 USB latency The two most important limiting factors in communication between the host and the emulator are e USB Transmission speed e USB latency The transmission speed is fixed to 12MHz and allows transmission of up to app 1MByte sec This is sufficient for fast operation of the emulator The USB latency is more of a problem Since the host schedules USB transactions in frames of ims for full speed and 125us for high speed connections the average latency is 2ms for full speed and 250us for high speed connections This means that even a small transaction of 1byte typically takes 2ms on full speed connection and it also means that minimizing the number of transactions to the minimum required is desirable 4 2 3 OUT transaction downstream In an OUT transaction the host sends data to the emulator This is a pretty straightforward process if the host wants to send a number of bytes to the J Link it can simply start such a write transaction The maximum size of one transaction is OxFFFF bytes 4 2 4 IN transaction In an IN transaction the host requests data from the emulator This is a is a more tricky process The maximum size
15. CPU CMD 23 EMU CAP SWO Supports command EMU CMD SWO Supports command 24 EMU CAP WRITE DCC EX EMU CMD WRITE DCC EX 25 EMU CAP UPDATE FIRMWARE EX supports command nid ES EMU CMD UPDATE FIRMWARE EX 26 EMU CAP FILE IO Supports command EMU CMD FILE IO 27 EMU CAP REGISTER Supports command EMU CMD REGISTER Supports command 28 E A EMU_CMD_INDICATORS SETE E Supports command 23 ENU BEN EED EMU_CMD_TEST_NET_SPEED 30 EMU_CAP_RAWTRACE Supports command EMU_CMD_RAWTRACE 31 Reserved Table 5 10 EMU_CMD_GET_CAPS flag overview Sample communication Retrieve emulator capabilities H E E8 Returns all capabilities except trace commands H E BF 7F FF 3B 5 3 5 EMU CMD GET CAPS EX Description Retrieves extended capabilities of the emulator RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 32 CHAPTER 5 Emulator protocol Command Direction Data Name Explanation H gt E 1 U8 Cmd Command OxED Table 5 11 EMU CMD GET CAPS EX command overview Response Direction Data Name Explanation H E 32 U8 Caps Capabilities supported by the emulator Table 5 12 EMU CMD GET CAPS EX response overview Additional information The capability flags used are described in the table below
16. E RM08001 Refe BF 7F FF BB 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 rence manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 34 CHAPTER 5 Emulator protocol 5 3 6 EMU CMD GET HW VERSION Description Retrieves the product hardware version of the emulator Command Direction Data Name Explanation H gt E 1 U8 Cmd Command OxFO Table 5 14 EMU CMD GET HW VERSION command overview Response Direction Data Name Explanation H E dl d39 Version Hardware version of the emulator Table 5 15 EMU CMD GET HW VERSION response overview Additional information The product hardware version is returned in the following format TTMMmmrr This stands for TT Hardware type MM Major version mm Minor version rr Revision Example The version 0052000 stands for a J Link Version 5 2 If the capability EMU CMD GET HW VERSION is not enabled version is always 0x00 Sample communication Retrieve hardware version command H gt E FO Returns the hardware version 0060000 which equals a J Link V6 H lt E 60 EA 00 00 J Link hardware versions The following table gives an overview about what hardware versions can be retrieved using this command Hardware type Name 0 J Link 1 J Trace 2 Flasher 3 J Link Pro RM08001 Reference manual for J Link USB Protocol
17. H gt E 1 ug Cmd Command OxDF Table 5 51 EMU CMD HW TRST1 command overview Response Sample communication Deactivate TRST command H gt E DF RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 56 5 5 17 EMU CMD WRITE DCC CHAPTER 5 Emulator protocol Description Writes to the CPU through JTAG using DCC Command Direction Data Name Explanation H gt E 1 U8 Cmd Command OxF1 H gt E 1 UL6 NumBitsInit TBD H gt E 1 U16 NumBitsStat TBD H gt E i 9 ii NumBitsData TBD H gt E 1 i6 BitPosStat TBD H gt E i lg Timeout TBD H gt E 1 U16 NumItems TBD JTAG Data NumBytes calculates as follows ES NumBytes 2 H gt E Nau 3 JTAG Data NumBitsInit 7 gt gt 3 NumBitsStat 7 gt gt 3 NumBitsData 7 gt gt 3 H gt E fie cad Data Data content Table 5 52 EMU_CMD_WRITE_DCC command overview Response Direction Data Name Explanation Return value of the command H lt E 1 U8 Return 0x00 O K 0x01 Timeout Table 5 53 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 2009 SEGGER Microcontroller GmbH amp Co KG 57 5 6 Target functions These commands are used to act on a target hardware such
18. J Trace interface unit to adapt to differing signal drive capabilities and differing cable lengths Application Program Interface A specification of a set of procedures functions data structures and constants that are used to interface two or more software components together Big endian Memory organization where the least significant byte of a word is at a higher address than the most significant byte See Little endian Device Under Test The device in the scan chain debugged at the moment DUT See Device Under Test EmbeddedICE The additional hardware provided by debuggable ARM processors to aid debugging Halfword A 16 bit unit of information Contents are taken as being an unsigned integer unless otherwise stated Host A computer which provides data and other services to another computer Especially a computer providing debugging services to a target being debugged ICache Instruction cache ICE Extension Unit A hardware extension to the EmbeddedICE logic that provides more breakpoint units ID Identifier IEEE 1149 1 The IEEE Standard which defines TAP Commonly but incorrectly referred to as JTAG In Circuit Emulator ICE A device enabling access to and modification of the signals of a circuit while that cir cuit is operating Instruction Register When referring to a TAP controller a register that controls the operation of the TAP IR See Instruction Register Joint Test Action Group J
19. Link ARM eere rr e occ na c a E le oa GE OP E c C es 10 CASE ome TURON 11 2 1 License terms iaa eh e tram qe VE SR ETERNA 12 Background IN OMAN st eder tee oboe tede vu pd e i Hp oie tr ce 13 3 1 JTAG scan chain values a a cnn rr rr n 14 3 2 Emulator configuration erre eed reet o n arte pr eon C e art 16 3 3 JTAG data buffers iii rr 17 ok PTT is 19 4 1 USB communication OVErVieW occccccnccnnnncnnnnnnanann nana na a esas aka aaa ada 20 4 2 USB transactiofis ci ciae roter Rat er cedem eet deret uen Edere dio ER Ea 21 4 3 Uii 22 5 ziii E nude 23 5 1 Communication protocol overview ssssssseseeee nnm 24 5 2 Protocol CAMAS en rc x xem Or e RO eR E VR dent 25 5 3 Get system information functions nemen nnn nnn 27 5 4 Get state information functions He eene eene enn 35 5 5 JTAG amp Hardware functions oocccnccnccnnnnnnnanana n menses nn 39 5 6 Target FUNCION Susi eet e e een E it AXE E ERI EN Y 57 5 7 Configuration FUNCTIONS 3 ccce nes rn A eati c ee df 66 A i ettet patet ten oia cs oe NAN Le op En AN nc nn 69 E EME andTefereri6eS aee oA dece dug ede ads 73 RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG Chapter 1 Introduction This chapter describes the purpose of this manual and the J Link ARM emulator which uses the J Link USB Protoco
20. Name Explanation H gt E 1 U8 Cmd Command OxC9 Table 5 34 EMU CMD HW TMSO command overview Response Sample communication Clear TMS command H gt E C9 RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 45 5 5 7 EMU CMD HW TMS1 Description Sets TMS signal Command Direction Data Name Explanation H gt E 1 U8 Cmd Command OxCA Table 5 35 EMU CMD HW TMS1 command overview Response Sample communication Set TMS command H gt E CA RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 46 CHAPTER 5 Emulator protocol 5 5 8 EMU CMD HW DATAO Description Clears TDI signal Command Direction Data Name Explanation H gt E 1 UB Cmd Command OxCB Table 5 36 EMU CMD HW DATAO command overview Response Sample communication Clear TDI command H gt E CB RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 47 5 5 9 EMU CMD HW DATA1 Description Sets TDI signal Command Direction Data Name Explanation H gt E 1 U8 Cmd Command OxCC Table 5 37 EMU CMD HW DATA1 command overview Response Sample communication Set TDI command H gt E CC RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 48 5 5 10 E
21. U8 SubCmd OxFE to return previosly selected interface number 0 31 1 31 to select interface 0 31 Table 5 28 EMU CMD SELECT IF command overview Response Direction Data Name Explanation Response depends on SubCmd sent SubCmd OxFF 32bit mask of available interfaces H E i 032 Response SubCmd OxFE Previously selected inter face number 0 31 SubCmd 0 31 Previously selected inter face number 0 31 Table 5 29 EMU CMD SELECT IF response overview Additional information The interfaces that can be selected if available are described in the table below Interface Define 0 TIF JTAG 1 TIF SWD Table 5 30 EMU CMD SELECT IF interface overview Sample communication requesting available interfaces Output command to check for available interfaces H gt E C7 FF Returns available interfaces as 32bit mask in this case JTAG and SWD are available H E 03 00 00 00 Sample communication selecting SWD interface Output command to select SWD interface H E C7 02 Returns previously selected interface in this case previously selected interface was JTAG H E 01 00 00 00 RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 42 CHAPTER 5 Emulator protocol 5 5 4 EMU CMD SET KS POWER Description Sets KS power on JTAG pin 19 to on or off temporarily Command Dir
22. as resetting it 5 6 1 EMU CMD RESET TARGET Description Resets the target via hardware reset Communication Direction Data Name Explanation H gt E 1 U8 Cmd Command 0x03 Table 5 54 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 gt E 03 RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 58 CHAPTER 5 Emulator protocol 5 6 2 EMU CMD HW RELEASE RESET STOP EX Description Resets the CPU and halts as soon as possible Means as soon as a criteria is matched Command Direction Data Name Explanation H gt E 1 U8 Cmd Command OxDO H gt E i wile NumBytes Number of bytes to transfer H gt E 1 U16 NumReps Number of repeats trying to halt the CPU H CriteriaBy Offset address where to check for criteria E JL 9 Ye teOff match H gt E 1 gie SA Criteria mask Mask H gt E i wile CriteriaData Criteria to match H gt E co Pe TMS data H gt E P DI TDI data Table 5 55 EMU CMD HW RELEASE RESET STOP EX command overview Response Direction Data Name Explanation H E po TDO TDO return data Table 5 56 EMU_CMD_HW_RELEASE_RESET_STOP_EX response overview Additional information RM08001 Reference manual for J Link USB Protocol In order to halt a
23. of one transaction is 0x8000 bytes A transaction is followed by a 0 byte packet if the transaction size is a multiple of 64 bytes but not the maximum packet size RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 22 CHAPTER 4 USB 4 3 Using USBLib USBLib is freeware and can be used on most platforms Again downstream OUT transactions are unproblematic For upstream IN transactions transaction termination needs to be handled cor rectly One easy way of doing so is to not request multiples of 64 bytes So if 256 bytes need to be read from the J Link instead 255 bytes then 1 byte could be read RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 23 Chapter 5 Emulator protocol This chapter explains the communication protocol used by the J Link emulator to communicate with the host RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 24 CHAPTER 5 Emulator protocol 5 1 Communication protocol overview The J Link firmware uses several commands to communicate with the host software The communication is always initiated by the host The host sends an ug command to the emulator followed by parameters beeing known to be needed by this command The firmware retrieves the first byte from the buffer containing the command and executes the proper functions The parameters e
24. optional coprocessors caches and the memory management unit RTCK Returned TCK The signal which enables Adaptive Clocking Scan Chain A group of one or more registers from one or more TAP controllers connected between TDI and TDO through which test data is shifted TAP Controller Logic on a device which allows access to some or all of that device for test purposes The circuit functionality is defined in IEEE1149 1 Target The actual processor real silicon or simulated on which the application program is running TCK The electronic clock signal which times data on the TAP data lines TMS TDI and TDO TDI 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 TDO The electronic signal output from a TAP controller to the data sink downstream Usually this is seen connecting the last TAP controller to the J Link J Trace Inter face Unit RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 72 CHAPTER 6 Glossary Test Access Port TAP The port used to access a device s TAP Controller Comprises TCK TMS TDI TDO and nTRST optional Transistor transistor logic TTL A type of logic design in which two bipolar transistors drive the logic output to one or zero LSI and VLSI logic often used TTL with HIGH logic level approaching
25. 0 00 18 02 00 00 00 00 00 2009 SEGGER Microcontroller GmbH amp Co KG 53 5 5 14 EMU CMD HW JTAG GET RESULT Description Requests the sticky error bit from the emulator This bit is set if a EMU CMD HW JTAG WRITE command failed After the EMU CMD HW JTAG GET RESULT command has been performed the sticky error bit is cleared Command Direction Data Name Explanation H gt E 1 U8 Cmd Command OxD6 Table 5 48 EMU CMD HW JTAG GET RESULT command overview Response Direction Data Name Explanation sticky crror Return value E gt H 1 UB bit y 0 O K Everything else Error Table 5 49 EMU_CMD_HW_JTAG_GET_RESULT command overview Sample communication Output command to get the sticky error bit H gt E D6 Returns O K E gt H 00 RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 54 CHAPTER 5 Emulator protocol 5 5 15 EMU CMD HW TRSTO Description Activates TRST signal Command Direction Data Name Explanation H gt E 1 U8 Cmd Command OxDE Table 5 50 EMU CMD HW TRSTO command overview Response Sample communication Activate TRST command H gt E DE RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 55 5 5 16 EMU CMD HW TRST1 Description Deactivates TRST signal Command Direction Data Name Explanation
26. A Adaptive clocking 70 Application Program Interface 70 B Big e ndian cett Re EHE RE 70 D Device Under Test eese 70 pli 70 E EmbeddedICE US 70 EMU CMD HW JTAG GET RESULT 53 EMU CMD HW JTAG WRITE 52 H HalfWOrd er 70 nores ELE P ERES 70 I ICache ur eatin we alee ss 70 ICE Extension Unit eeeeesees 70 ID Lire R E a cae P RE a 70 IEEE LEA ls ses AM eese terere rr Rute 70 In Circuit Emulator eee 70 Instruction Register eee 70 IR Re Sita 70 J Joint Test Action Group JTAG 70 L Little endian au eire 71 M Memory coherency eeenn nn 71 RM08001 Reference manual for J Link USB Protocol N any 71 O Open collector enne 71 P Processor COE aci eee evened 71 R RESET 5 25 eene tia 71 RICK ia ps 71 S Scan Chait 52286 bi Res 71 Support ii prr RR RIT EXE 69 Syntax conventions used 5 T TAP Controller cccccceeeeeeeeeeseeeeeeeeeaees 71 A rer dens ivanti erre nei 71 ge CR TP AAT 71 TD ces tos se el hot wed doctores 71 gno ee Dale a Pe a 71 Test Access Port TAP ss 72 Transistor transistor logic TTL 72 W Watchpoiht dicor reete RR RE RI deere 72 Tor mt 72 2009 SEGGER Microcontroller GmbH amp Co KG 76 Index RM08001 Reference manual for J Link USB Pro
27. CK Description Retrieves the maximum memory blocksize Command Direction Data Name Explanation H gt E 1 U8 Cmd Command OxD4 Table 5 6 EMU CMD GET MAX MEM BLOCK command overview Response Direction Data Name Explanation H E 1 132 MaxSize Returned maximum block size Table 5 7 EMU_CMD_GET_MAX_MEM_BLOCK response overview RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 30 CHAPTER 5 Emulator protocol 5 3 4 EMU CMD GET CAPS Description Retrieves capabilities of the emulator Command Direction Data Name Explanation H gt E 1 U8 Cmd Command OxE8 Table 5 8 EMU CMD GET CAPS command overview Response Direction Data Name Explanation H E 1 032 Caps Capabilities supported by the emulator Table 5 9 EMU CMD GET CAPS response overview Additional information The capability flags used are described in the table below Bit Define Explanation 0 EMU CAP RESERVED Always 1 E Supports command Mc ACIE A EMU CMD GET HARDWARE VERSION 2 EMU CAP WRITE DCC Supports command EMU CMD WRITE DCC 3 EMU CAP ADAPTIVE CLOCKING Supports adaptive clocking IS Supports command ii a EMU_CMD_READ_CONFIG Supports command EMU_CMD_WRITE_CONFIG 6 EMU_CAP_ TRACE Supports trace commands Supports command
28. CMD_GET_HW_INFO command overview Response Direction Data Name Explanation Hardware information returned x means the H lt E x U32 HW Info amount of hardware information defined by the mask flags Table 5 19 EMU CMD GET HW INFO response overview Additional information The flags that can be used as Mask are described in the table below Bit Define Explanation Retrieves KS power status 0 HW INFO POWER ENABLED 0x00000000 Power is off 0x00000001 Power is on Retrieves information about why the tar get power was switched off 0x00000000 Everything is normal 1 HW INFO POWER OVERCURRENT 0x00000001 2ms 3000mA 0x00000002 10ms amp 1000mA 0x00000003 40ms 400mA 2 HW INFO ITARGET Consumption of the target in mA 3 HW INFO ITARGET PEAK Peak consumption of the target in mA Peak consumption of the target in mA 4 HW INFO ITARGET PEAK OPERATION While operating In most cases this is the same value as HW INFO ITARGET PEAK Max time in ms the consumption of the 10 Hw INFO ITARGET MAX TIMEO target exceeded HW INFO POWER OVERCURRENT type 0x01 Max time in ms the consumption of the 11 HW INFO ITARGET MAX TIME target exceeded HW INFO POWER OVERCURRENT type 0x02 Max time in ms the consumption of the 12 HW INFO ITARGET MAX TIME2 target exceeded HW INFO POWER OVERCURRENT type 0x03 Table 5 20 EMU CMD GET HW INFO flag overview
29. EM_ARM79 EMU CMD READ MEM ARM79 Supports command 19 EMU CAP EX GET COUNTERS EMU CMD GET COUNTERS 20 EMU CAP EX READ DCC Supports command EMU CMD READ DCC Table 5 13 EMU CMD GET CAPS EX flag overview RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 33 Bit Define Explanation Supports command 21 EMU CAP EX GET CPU CAPS EMU CMD GET CPU CAPS Supports command 22 EMU CAP EX EXEC CPU CMD EMU CMD EXEC CPU CMD 23 EMU CAP EX SWO Supports command EMU CMD SWO Supports command 24 EMU CAP EX WRITE DCC EX EMU CMD WRITE DCC EX 25 EMU CAP EX UPDATE FIRMWARE Supports command _EX EMU CMD UPDATE FIRMWARE EX 26 EMU CAP EX FILE IO Supports command EMU CMD FILE IO 27 EMU CAP EX REGISTER Supports command EMU CMD REGISTER Supports command 28 EMU CAP EX INDICATORS EMU CMD INDICATORS EE Supports command 22 EMU CAE EX CESI NEM SEEED NENU CMD TEST NET SPEED 30 EMU_CAP_EX_RAWTRACE Supports command EMU_CMD_RAWTRACE F Supports command 31 EMU CAP EX GET CAPS EX EMU CMD GET CAPS EX Supports command 32 EMU CAP EX HW JTAG WRITE EMU CMD HW JTAG WRITE Table 5 13 EMU CMD GET CAPS EX flag overview Samp le communication Retrieve emulator capabilities H gt E ED Returns all capabilities except trace commands H lt
30. J Link Heference manual for J Link USB Protocol Document RM08001 R7 Date October 8 2010 A SEGGER A product of SEGGER Microcontroller GmbH amp Co KG WWW Segger com 2 CHAPTER Disclaimer Specifications written in this document are believed to be accurate but are not guar anteed to be entirely free of error The information in this manual is subject to change for functional or performance improvements without notice Please make sure your manual is the latest edition While the information herein is assumed to be accurate SEGGER MICROCONTROLLER GmbH amp 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 The manufacturer specifically disclaims any implied warranty of mer chantability or fitness for a particular purpose Copyright notice You may not extract portions of this manual or modify the PDF file in any way without the prior written permission of the manufacturer The software described in this doc ument is furnished under a license and may only be used or copied in accordance with the terms of such a license 2010 SEGGER Microcontroller GmbH amp Co KG Hilden Germany Trademarks Names mentioned in this manual may be trademarks of their respective companies Brand and product names are trademarks or registered trademarks of their respec t
31. MU CMD HW JTAG RM08001 Reference manual for J Link USB Protocol CHAPTER 5 Emulator protocol Description Handles the JTAG connection It receives data for TDI and TMS and sends TDO data back Command Direction Data Name Explanation H gt E 1 U8 Cmd Command OxCD H gt E 1 U16 NumBits Number of bits to transfer H gt E lt NumBytes gt ms Data for TMS NumBytes calculates as follows U8 NumBytes NumBits 7 gt gt 3 H gt E lt NumBytes gt DI Data for TDI NumBytes calculates as follows U8 NumBytes NumBits 7 gt gt 3 Table 5 38 EMU_CMD_HW_JTAG command overview Response Direction Data Name Explanation H lt E lt NumBytes gt TDO TDO data NumBytes calculates as follows U8 NumBytes NumBits 7 gt gt 3 Table 5 39 EMU_CMD_HW_JTAG response overview Additional information This command is obsolete Please use EMU_CMD_HW_JTAG3 on page 50 2009 SEGGER Microcontroller GmbH amp Co KG 49 5 5 11 EMU CMD HW JTAG2 Description Handles the JTAG connection It receives data for TDI and TMS and sends TDO data back Command Direction Data Name Explanation H gt E 1 U8 Cmd Command OxCE H gt E ae DUMMY aes data in order to word align data trans H gt E 1 U16 NumBits Number of bits to transfer H gt E lt NumBytes gt TMS Data for TMS NumBytes calculates as follows
32. SEGGER Microcontroller GmbH amp Co KG About this document Assumptions This document assumes that you already have a solid knowledge of the following e The software tools used for building your application assembler linker C com piler e The target processor How to use this manual This manual explains all the functions and macros that the product offers It assumes you have a working knowledge of the C language Knowledge of assembly program ming is not required Typographic conventions for syntax This manual uses the following typographic conventions Style Used for Body Body text Text that you enter at the command prompt or that appears on the Keyword display that is system functions file or pathnames Parameter Parameters in API functions Sample Sample code in program examples Referenc Reference to chapters sections tables and figures or other docu 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 2009 SEGGER Microcontroller GmbH amp Co KG RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG Table of Contents T oo s Init ied e el eins PAR AS ata den LT eT dfe etn EL 9 1 1 How to use this mana cei eR e ias 10 1 2 Purpose of this document iii td la 10 1 3 Features Of J
33. TAG The name of the standards group which created the IEEE 1149 1 specification RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 71 Little endian Memory organization where the least significant byte of a word is at a lower address than the most significant byte See also Big endian Memory coherency A memory is coherent if the value read by a data read or instruction fetch is the value that was most recently written to that location Obtaining memory coherency is difficult when there are multiple possible physical locations that are involved such as a system that has main memory a write buffer and a cache RESET Abbreviation of System Reset The electronic signal which causes the target system other than the TAP controller to be reset This signal is also known as nSRST nSYSRST nRST or NRESET in some other manuals See also nTRST nTRST Abbreviation of TAP Reset The electronic signal that causes the target system TAP controller to be reset This signal is known as nICERST in some other manuals See also nSRST Open collector A signal that may be actively driven LOW by one or more drivers and is otherwise passively pulled HIGH Also known as a wired AND signal Processor Core The part of a microprocessor that reads instructions from memory and executes them including the instruction fetch unit arithmetic and logic unit and the register bank It excludes
34. U CMD HW RELEASE RESET STOP TIMED response overview Additional information For further information please refer to EMU CMD HW RELEASE RESET STOP EX on page 58 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 2009 SEGGER Microcontroller GmbH amp Co KG 60 CHAPTER 5 Emulator protocol 5 6 4 EMU CMD HW RESETO Description Activates target reset Command Direction Data Name Explanation H gt E 1 UB Cmd Command OxDC Table 5 59 EMU CMD HW RESETO command overview Response Sample communication Activate target reset command H gt E DC RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 61 5 6 5 EMU CMD HW RESET1 Description Deactivates target reset Command Direction Data Name Explanation H gt E 1 U8 Cmd Command OxDD Table 5 60 EMU CMD HW RESET1 command overview Response Sample communication Deactivate target reset command H gt E DD RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 62 CHAPTER 5 Emulator protocol 5 6 6 EMU CMD GET CPU CAPS Description Retrieves the capabilities of the target CPU Command Direction Data Name Explanation H gt E 1 U8 Cmd Command OxE9 3 Device H gt E 1
35. U8 Family Device family of the target CPU Target interface used to connect the emulator H gt E 1 U8 Interface to the target CPU H gt E SS Reserved Dummy H gt E 1 U8 Reserved Dummy Table 5 61 EMU CMD GET CPU CAPS command overview Response Direction Data Name Explanation H E 1 U32 Capabilities Functionality supported by the target CPU Table 5 62 EMU CMD GET CPU CAPS response overview Additional information The capability flags used are described in the table below Bit Define Explanation 0 CPU CAP RESERVED Always 1 1 CPU CAP WRITE MEM SL aeree Come E dr CPU CMD WRITE MEM 2 eo eee NERS wee Supports command m B CPU CMD READ MEM Table 5 63 EMU CMD GET CPU CAPS flag overview Sample communication Requesting the CPU capabilities H gt E E9 07 00 00 00 Returns no capabilites H E 01 00 00 00 RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 63 5 6 7 EMU CMD EXEC CPU CMD Description Executes functions supported by the CPU Command Direction Data Name Explanation H gt E 1 U8 Cmd Command OxEA H gt E 1 U8 CPUCmd CPU command to be executed H gt E 1 U8 SubCmd Sub command for the CPU command if any H gt E 1 U8 Device Device family of the target CPU Family Target interface used to connect the emulator b
36. alculates as follows wa NumBytes NumBits 7 gt gt 3 Table 5 42 EMU_CMD_HW_JTAG JTAG interface command overview Command SWD interface Direction Data Name Explanation H gt E 1 U8 Cmd Command OxCF HSE 159878 DUMMY UR data in order to word align data trans H gt E 1 U16 NumBits Number of bits to transfer Direction of data to transmit ro NumBytes calculates as follows NumBytes H gt E wu DIR NumBits 7 gt gt 3 2008 0 In 1 Out lt NumBytes gt SWDIO input data NumBytes calculates as fol dus U8 eer On lows NumBytes NumBits 7 gt gt 3 Table 5 43 EMU_CMD_HW_JTAG SWD interface command overview Response JTAG interface Direction Data Name Explanation H lt E lt NumBytes gt TDO TDO data NumBytes calculates as follows U8 NumBytes NumBits 7 gt gt 3 Return value H lt E Le Ug Return 0 O K Everything else Error occured Table 5 44 EMU_CMD_HW_JTAG JTAG interface response overview Response SWD interface Direction Data Name Explanation H lt E lt NumBytes gt SWDIO SWDIO output data NumBytes calculates as U8 out follows NumBytes NumBits 7 gt gt 3 Return value H E i UE Return 0 O K Everything else Error occured Table 5 45 EMU CMD HW JTAG SWD interface response overview Additional information How the JTAG SWD sequence is generat
37. ddress only for J Link Pro Subnet mask in hex format Subnetmask only for J Link NE Ld OxFFFFFFFF if not configured Pro 0x28 Ox2F OxFF Reserved E MAC Address MAC Address only for J Link 0x30 0X35 oXFFFFFFFFFFFF if not configured Pro 0x36 OxFF OxFF Reserved Table 3 2 Emulator configuration overview RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 3 3 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 3 3 1 Explanation of terms In this document input and output buffers are seen from host perspective Input buffer The input buffer stores the incoming TDO signals from the device Output buffer Output buffers stores TMS and TDI signals which are transferred to the device 3 3 2 Organization of buffers Model of JTAG Buffer All three JTAG data buffers are organized the same way Bit n of the bit stream is stored in byte n 8 bit n 8 This means the first byte is sent first least significant bit 1sb first The same thing is true for data received The first bit received is the 1sb of byte O Size of buffers All buffers are big enough to hold 2 KByte of data RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microco
38. ection Data Name Explanation H gt E 1 U8 Cmd Command 0x08 3 Set KS power on 0x01 Mine P go Omon Set KS power off 0x00 Table 5 31 EMU_CMD_SET_KS_POWER command overview Response Additional information 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 RM08001 Reference manual for J Link USB Protocol 08 01 2009 SEGGER Microcontroller GmbH amp Co KG 43 5 5 5 EMU CMD HW CLOCK Description Generates one clock and retrieves data from TDI Command Direction Data Name Explanation H gt E 1 Ua Cmd Command 0xC8 Table 5 32 EMU CMD HW CLOCK command overview Response Direction Data Name Explanation H E 1 U8 TDI Data from TDI Table 5 33 EMU CMD HW CLOCK response overview Additional information This command generates one clock and returns the value of TDI on falling edge of clock 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 gt E C8 Returns TDI data H E 00 RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 44 CHAPTER 5 Emulator protocol 5 5 6 EMU CMD HW TMSO Description Clears TMS signal Command Direction Data
39. ed is beyond the scope of this manual RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 51 This command is available for J Links with hardware version 5 and above only SWD support is available for J Links with hardware version 6 and above only The hardware version can be retrieved using the command EMU CMD GET HW VERSION on page 34 Sample communication Output command and JTAG TDI TMS data to halt ARM7 CPU H gt E CF 00 48 00 86 E3 71 CO O1 00 00 00 OC 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 2009 SEGGER Microcontroller GmbH amp Co KG 52 CHAPTER 5 Emulator protocol 5 5 13 EMU CMD HW JTAG WRITE Description Handles the JTAG connection If used with JTAG interface it receives data for TDI and TMS No TDO data is sent back If used with SWD interface it receives data for SWDIO in and DIR No SWDIO out data is sent back The status of the transmis sion is saved in a stick error flag This flag can be requested via the EMU CMD HW JTAG GET RESULT command For more information about the EMU CMD HW JTAG GET RESULT command please refer to EMU CMD HW JTAG GET RESULT on page 53 Command JTAG interface Direction Data Name Explanation H gt E 1 U8 Cmd Command OxCF H g
40. ee um Dutortace to the target CPU H gt E UN NumBytes ud of bytes to transmit for the configura H gt E m Config Configuration data H gt E L 9 weg Addr Memory location to write to read from NumBytes Number of bytes to write read to from given H gt E 132 WriteRead address Data to be written to the given memory lt NumBytes H gt E WriteRead Data CCE Only used with command CPU CMD WRITE MEM Table 5 64 EMU CMD EXEC CPU CMD command overview Response Direction Data Name Explanation Result of the write read command 0 Everything O K PR S 4 Be Result gt 0 Number of bytes that could not be read written Table 5 65 EMU CMD EXEC CPU CMD response overview Additional information The list below gives an overview about the available CPU commands Define Value Explanation CPU CMD WRITE MEM 100 Writes to target memory CPU CMD READ MEM 101 Reads from target memory Table 5 66 CPU command overview RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 64 CHAPTER 5 Emulator protocol 5 6 8 EMU CMD WRITE MEM ARM79 Description Writes to target memory on ARM 7 9 targets Command Direction Data Name Explanation H gt E 1 U8 Cmd Command OxF7 H gt E UE TotalIRLen Total scanchain length H gt E 1 U8 NumDevices Number of d
41. evices on scanchain H gt E 1 U8 DevicePos Devices before target device H gt E 1 U8 IRPre IR bits before target device 0x00 ARMZ H gt E il U8 ISARM9 0x01 ARM9 0x00 Little endian H gt E 1 18 IsBigEndian 0x01 Big endian H gt E 1 UT6 Dummy Dummy field H gt E 1 U8 SubCmd Typically 0x01 H gt E 1 U32 Addr Target address in memory H gt E 1 U32 NumBytes Number of bytes to write H gt E on Data Data that should be written to memory Table 5 67 EMU_CMD_WRITE_MEM_ARM79 command overview Response Direction Data Name Explanation 0x00 O K 0x01 Adaptive clocking timeout ee ys BERI SEREUS 0x02 Memory access timeout 0x03 Core error Table 5 68 EMU CMD WRITE MEM ARMZ79 response overview Sample communication Writing OxAB to address 0x12345678 H gt E Returns O K H lt E 00 RM08001 Reference manual for J Link USB Protocol F7 04 01 00 00 00 00 00 00 01 78 56 34 12 01 00 00 00 AB 2009 SEGGER Microcontroller GmbH amp Co KG 65 5 6 9 EMU CMD READ MEM ARM79 Description Reads from target memory on ARM 7 9 targets Command Direction Data Name Explanation H gt E 1 U8 Cmd Command OxF8 H gt E 1 ues TotalIRLen Total scanchain length H gt E 1 U8 NumDevices Number of devices on scanchain H gt E 1 U8 DevicePos Devices before target device H gt E 1 U8 IRPre IR bits before target device 0x00 ARM7 H gt E
42. ference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 39 5 5 JTAG Hardware functions These commands are used to read write and handle JTAG data and to set hardware states 5 5 1 EMU CMD RESET TRST Description Resets TRST Command Direction Data Name Explanation H gt E 1 u Cmd Command 0x02 Table 5 26 EMU CMD RESET TRST command overview Response Additional information Activates TRST and releases it after 2ms Sample communication Reset TRST command H gt E 02 RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 40 CHAPTER 5 Emulator protocol 5 5 2 EMU CMD SET SPEED Description Sets the JTAG speed Command Direction Data Name Explanation H gt E 1 U8 Cmd Command 0x05 JTAG speed in kHz Example i M e Miu or Ox001E for 30kHz OxFFFF for adaptive clocking Table 5 27 EMU CMD SET SPEED command overview Response Sample communication Set speed to adaptive clocking command H gt E 05 FF FF RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 41 5 5 3 EMU CMD SELECT IF Description Select a target interface or retrieves the previously selected interface Command Direction Data Name Explanation H gt E i Ug Cmd Command OxC7 OxFF to return 32bit mask of available inter faces H gt E 1
43. ive holders Contact address SEGGER Microcontroller GmbH amp Co KG In den Weiden 11 D 40721 Hilden Germany Tel 49 2103 2878 0 Fax 49 2103 2878 28 Email support segger com Internet http www segger com Document revisions For further information on topics or routines not yet specified please contact us Revision Date By Explanation 0 080523 OO Initial version Chapter Background information Added JTAG 1 080526 OO buffer description Some minor changes 2 080527 OO Some minor changes Split chapter USB communication into chapter 3 090520 OO USB and chapter Emulator protocol Some minor changes Chapter Emulator protocol Section Protocol commands updated 4 VAUS IAS Section Get system noraa ien functions updated RM08001 Reference manual for J Link USB Protocol 2010 SEGGER Microcontroller GmbH amp Co KG Revision Date By Explanation 5 090527 AG Chapter Emulator protocol Section Protocol commands updated 090616 AG Chapter Emulator protocol Section Protocol commands updated corrected 101008 OO Chapter Emulator protocol Added EMU CMD SELECT IF Updated EMU CMD HW JTAG3 for SWD usage RM08001 Reference manual for J Link USB Protocol 2010 SEGGER Microcontroller GmbH amp Co KG 4 CHAPTER RM08001 Reference manual for J Link USB Protocol 2010
44. l RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 10 CHAPTER 1 Introduction 1 1 Howto 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 1 2 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 This document gives an overview about the J Link USB communication and how it can be used in your application Sample communications to almost each command description should give you an idea of the data transferred via USB between J Link and host 1 3 Features of J Link ARM J Link provides a feature rich list of functions to simplify the debugging process All important functions which are used by the SEGGER software are useable via the USB protocol J Link ARM has many features eUSB 2 0 interface eAny ARM7 ARM9 core supported including thumb mode eAutomatic core recognition eMaximum JTAG speed 12 MHz eDownload speed up to 720 Kbytes second eDCC speed up to 800 Kbytes second eNo power supply required powered through USB eAuto speed recognition eSupport for adaptive clocking eAll JTAG signals can be monitored target voltage can be mea sured eSupport for multiple devices eFully plug and play compatible eA Standard 20
45. mand H gt E 01 Returns the firmware string length H E 70 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 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 eee 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 28 CHAPTER 5 Emulator protocol 5 3 2 EMU CMD GET SPEEDS Description Retrieves the base freq and the min divider of the emulator CPU Command Direction Data Name Explanation H gt E 1 U8 Cmd Command OxCO Table 5 4 EMU CMD GET SPEEDS command overview Response Direction Data Name Explanation H E 1 U32 BaseFreq Retrieves the base frequency of emulator CPU H E EUG MinDiv Retrieves the min divider of emulator CPU Table 5 5 EMU CMD GET SPEEDS response overview Sample communication Retrieve base freq and min divider of emulator CPU H gt E CO 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 2009 SEGGER Microcontroller GmbH amp Co KG 29 5 3 3 EMU CMD GET MAX MEM BLO
46. n ARM7 or ARMO9 CPU as soon as possible the emulator can decide if the CPU is halted by checking for a criteria This eliminates the USB latency a deci sion by the host PC would cause What happens is that RESET is pulled high and the emulator tries to halt the CPU with a halting sequence as soon as possible for Num Reps tries To check if halting the CPU was successful the emulator checks for a crite ria A pseudo code could look like the following code U16 i 0 ResetHigh do itt SendSequence while Data amp CriteriaMask amp amp l CriteriaData i lt NumReps This command is emplemented for ARM7 and ARMO cores only 2009 SEGGER Microcontroller GmbH amp Co KG 59 5 6 3 EMU CMD HW RELEASE RESET STOP TIMED Description Resets the CPU and halts as soon as its possible or the timeout expires Command Direction Data Name Explanation H gt E 1 U8 Cmd Command OxD1 H gt E 1 U16 NumBytes Number of bytes to transfer H gt E U16 TimeOut Timeout in ms H CryteriaBy Offset address where to check for criteria gt E L iH teOff match H gt E U16 INTE Criteria mask Mask H gt E UT6 CriteriaData Criteria to match H gt E SP C UMS TMS data H gt E D roi TDI data Table 5 57 EMU_CMD_HW_RELEASE_RESET_STOP_TIMED command overview Response Direction Data Name Explanation H lt E Fi ded TDO TDO return data Table 5 58 EM
47. ntroller GmbH amp Co KG 18 CHAPTER 3 Background information RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG Chapter 4 USB This chapter explains the USB communication and specifics which have to be taken care of when using USB communication under Windows and other operating systems RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 20 CHAPTER 4 USB 4 1 USB communication overview J Link uses USB bulk communication to transfer data between host and J Link Various specifics which are mandatory are explained in this section 4 1 1 USB endpoints Newer J Links use 2 bulk endpoints one for IN EP1 and one for OUT EP2 com munication whereas old J Links V3 V4 only use one endpoint EP1 for IN and OUT communication Data direction is seen from host side so IN means from the J Link to the host The following table gives a quick overview which hardware version uses what USB endpoints Hardware Version Endpointused Endpointused for IN for OUT J Link V3 J Link V4 1 1 J Link V5 and versions above 1 J Link compatible hardware 1 2 Flasher ARM J Trace Table 4 1 USB endpoint overview 4 1 2 Using different operating systems Depending on the operating system being used there are different ways to commu nicate with the J Link via USB It is possible to use J Link under almo
48. pin JTAG connector eOptional 14 pin JTAG adapter available eWide target voltage range 1 2V 3 3V eOptional adapter for 5V targets available Measured with J Link Rev 5 ARM7 50 MHz 12MHz JTAG speed RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 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 2009 SEGGER Microcontroller GmbH amp Co KG 12 CHAPTER 2 Licensing 2 1 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 tion pack In case of doubt please contact us info segger com 2 1 1 What you may do You may use the information contained in this document to add support for the wide spread SEGGER J Link ARM emulator and OEM versions in open source software 2 1 2 What you are not allowed to do You are not allowed to use the information in this document to e build J Link clones e build J Link compatible emulators RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG Chap
49. power to on or off EMU_CMD_HW_CLOCK OxC8 Generates one clock and retrieves TDI EMU_CMD_HW_TMSO OxC9 Clears TMS EMU_CMD_HW_TMS1 OxCA Sets TMS EMU_CMD_HW_DATAO OxCB Clears TDI EMU CMD HW DATA1 OxCC Sets TDI EMU CMD HW JTAG OxCD Handles JTAG connection EMU CMD HW JTAG2 OxCE Handles JTAG connection with word aligned data transfers Handles JTAG connection with word EMU CMD HW JTAG3 OxCF aligned data transfers and return value EMU CMD HW JTAG WRITE OxD5 Same as EMU CMD HW JTAG3 but with out response data on TDO Receive status of sticky error bit which EMU CMD HW JTAG GET RESULT 0xD6 is handled by EMU CMD HW JTAG WRITE EMU CMD HW TRSTO OxDE Activates TRST EMU CMD HW TRST1 OxDF Deactivates TRST EMU CMD WRITE DCC OxF1 Writes to JTAG using DCC Target functions EMU_CMD_RESET_TARGET 0x03 Resets the target EMU_CMD_HW_RELEASE_RESET_ST Resets the CPU and halts as soon as its OP_EX OxDU possible or the timeout expires EMU CMD HW RELEASE RESET ST 0XD1 Resets the CPU and halts as soon as its OP TIMED possible or the timeout expires EMU CMD HW RESETO OxDC Activates target reset Table 5 1 Protocol command overview RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 26 CHAPTER 5 Emulator protocol Define Value Explanation EMU CMD HW RESET1 OxDD Deactivates target reset
50. st every operating system as long as there is a USB bulk driver which allows communication with the J Link Using a Windows operating system Using Windows for communication with the J Link you will need to have a USB bulk kernel mode driver as Windows does not come with such a feature aboard This driver named the J Link USB driver is shipped together with the Windows version of the J Link software package Using a non Windows operating system Using an operating system other than Windows you will have to find an other way to operate the J Link via USB Under different operating systems there is a freeware package called USBLib available which allows you to communicate with the J Link 4 1 3 Endianess All data units larger than a single byte are transferred little endian meaning least significant bytes are transferred first U16 Example U16 data to send OxCDEF Data sent via USB EF CD U32 Example U32 data to send 0x12345678 Data sent via USB 78 56 34 12 RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 21 4 2 USB transactions If multiple bytes are send to the emulator or send by the emulator there is a choice The information can be send in a single transaction or in multiple transactions So both sides are free to send data in one or more transactions However due to the long USB latencies it is recommended to use as few transactions as possible 4
51. t E a eae DUMMY Py data in order to word align data trans H gt E 1 016 NumBits Number of bits to transfer ese lt NumBytes gt TMS Data for TMS NumBytes calculates as follows U8 NumBytes NumBits 7 gt gt 3 H gt E lt NumBytes gt pI Data for TDI NumBytes calculates as follows U8 NumBytes NumBits 7 gt gt 3 Table 5 46 EMU_CMD_HW_JTAG_WRITE JTAG interface command overview Command SWD interface Direction Data Name Explanation H gt E 1 U8 Cmd Command OxCF Tee X908 DUMMY ro data in order to word align data trans H gt E 1 U16 NumBits Number of bits to transfer Direction of data to transmit E E NumBytes calculates as follows NumBytes H gt E DIR NumBits 7 gt gt 3 TS 0 In 1 Out lt NumBytes gt SWDIO input data NumBytes calculates as fol ads U8 SIBI UN lows NumBytes NumBits 7 gt gt 3 Table 5 47 EMU CMD HW JTAG WRITE SWD interface command overview Additional information How the JTAG SWD sequence is generated is beyond the scope of this manual This command is available for J Links with hardware version 6 and above only The hardware version can be retrieved using the command EMU CMD GET HW VERSION on page 34 Sample communication Output command and JTAG TDI TMS data to halt ARM7 CPU H gt E CF 00 48 00 86 RM08001 Reference manual for J Link USB Protocol E3 71 CO 01 00 00 00 0C 2
52. ter 3 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 2009 SEGGER Microcontroller GmbH amp Co KG 14 3 1 3 1 CHAPTER 3 Background information JTAG scan chain values Some JTAG related commands need an IRpre and DevicePos parameter These values describe the position of a device in the scan chain and the shift count to reach that device The diagram below shows a scan chain configuration sample with 2 devices con nected to the JTAG port to Device1 too to Device O Trpo 1 IRPre The IRPre value is the total number of bits in the instruction registers of the devices before the DUT counted from nearest device to TDO The position can usually be seen in the schematic the IR len can be found in the manual supplied by the manufactur ers of the other devices ARM7 and ARM9 have an IR len of four For systems with just a single device IRPre is O For an example using the IRpre value please refer to the paragraph Scan chain exam ple on page 15 3 1 2 DevicePos The DevicePos value of the DUT is the amount of devices in the scan chain before the DUT counted from nearest device to TDO For systems with just a single device DevicePos is O For an example using the DevicePos value please refer to the paragraph Scan chain example on page
53. tocol 2009 SEGGER Microcontroller GmbH amp Co KG
54. xpected are read from the communi cation buffer by the subroutines that are called through the command Return values are sent back via USB RM08001 Reference manual for J Link USB Protocol 2009 SEGGER Microcontroller GmbH amp Co KG 25 5 2 Protocol commands The list below gives an overview about the usable commands Define Value Explanation Get system information functions EMU CMD VERSION OxO1 Retrieves the firmware version Retrieves the base freq and the min PMU EMD GET SPREDS PRU divider of the emulator CPU EMU CMD GET MAX MEM BLOCK OxD4 ao the maximum memory block EMU_CMD_GET_CAPS OxE8 Retrieves capabilities of the emulator Retrieves capabilities including EMU_CMD_GET_CAPS_EX 9xED extended ones of the emulator EMU CMD GET HW VERSION OxFO Retrieves the hardware version of the emulator Get state information functions EMU CMD GET STATE 0x07 Retrieves voltage and JTAG pin states EMU CMD GET HW INFO OxC1 Retrieves hardware information EMU_CMD_GET_COUNTERS OxC2 Retrieves target connection counters EMU CMD MEASURE RTCK REACT OxF6 Measures RTCK reaction time JTAG amp Hardware functions EMU CMD RESET TRST 0x02 Resets TRST EMU_CMD_SET_SPEED 0x05 Sets the JTAG speed Selects the target interface or retrieves EMU_CMD_SELECT_IF Rd current laure target interface EMU_CMD_SET_KS_POWER 0x08 Sets KS

Download Pdf Manuals

image

Related Search

Related Contents

Benutzerhandbuch  Triana User Guide  Sunbeam SCH160 User's Manual  Manual A2K2 - Seguridad Total  Accesso alla telecamera  ASM7 active studio monitor user manual      Instructions d`installation  SEVÜS ERMENÛNVELË.E MÜËEËÎÂGNŸ SÎË FËtl l`lÎE i\/iAlRlE DE  

Copyright © All rights reserved.
Failed to retrieve file