2020-06-11

RISC-V. Part 4: JTAG Cabling

1 The SeeedStudio Connector

Compared to the development board, the standard 20-pin 0.1″ JTAG connector is huge. Therefore, SeeedStudio created another proprietary 0.1″ JTAG 10-pin connector. ☹!

The pin assignment is documented in the schematics and in pinout. The same pins are duplicated on the GPIO headers:

GPIO Header JTAG Header
SignalPortPIN SignalPIN
GND GND H2/41
GND GND H2/42
JTDI PA15H3/1 TDI 5
JTMS PA13H3/3 TMS 7
NJTRSTPB4 H3/5 TRST3
JTCK PA14H3/2 TCK 9
JTDO PB3 H3/4 TDO 6
NRST NRSTH3/6 NRST4
GND GND H3/34 GND 10
3V3 3V3 H2/{43…48}13V3 1…2
5V H3/{45…48}2

1 Continuity tested to AMS1117 voltage regulator (pin 2).

2 Continuity tested to AMS1117 voltage regulator (pin 3).

2 The J-Link Connector

J-Link / J-Trace use a popular connector. It is documented in J-Link / J-Trace User Guide, Software Version: 6.70, Date: May 7, 2020, section 18.1.1 Pinout for JTAG:

PINSIGNALTYPEDescription
1 VTref Input This is the target reference voltage. It is used to check if the target has power, to create the logic-level reference for the input comparators and to control the output logic levels to the target. It is normally fed from VDD of the target board and must not have a series resistor.
2 Not connected NC This pin is not connected in J-Link.
3 nTRST Output JTAG Reset. Output from J-Link to the Reset signal of the target JTAG port. Typically connected to nTRST of the target CPU. This pin is normally pulled HIGH on the target to avoid unintentional resets when there is no connection.
5 TDI Output JTAG data input of target CPU. It is recommended that this pin is pulled to a defined state on the target board. Typically connected to TDI of the target CPU.
7 TMS Output JTAG mode set input of target CPU. This pin should be pulled up on the target. Typically connected to TMS of the target CPU.
9 TCK Output JTAG clock signal to target CPU. It is recommended that this pin is pulled to a defined state of the target board. Typically connected to TCK of the target CPU.
11 RTCK Input Return test clock signal from the target. Some targets must synchronize the JTAG inputs to internal clocks. To assist in meeting this requirement, you can use a returned, and retimed, TCK to dynamically control the TCK rate. J-Link supports adaptive clocking, which waits for TCK changes to be echoed correctly before making further changes. Connect to RTCK if available, otherwise to GND.
13 TDO Input JTAG data output from target CPU. Typically connected to TDO of the target CPU.
15 nRESET I/O Target CPU reset signal. Typically connected to the RESET pin of the target CPU, which is typically called “nRST”, “nRESET” or “RESET”. This signal is an active low signal.
17 DBGRQ NC This pin is not connected in J-Link. It is reserved for compatibility with other equipment to be used as a debug request signal to the target system. Typically connected to DBGRQ if available, otherwise left open.
19 5V-Supply Output This pin can be used to supply power to the target hardware. Older J-Links may not be able to supply power on this pin. For more information about how to enable/disable the power supply, please refer to Target power supply.
4, 6, 8, 10, 12 GND GND pins connected to GND in J-Link. They should also be connected to GND in the target system.

3 Wiring

Waste of effort is always brought about by missing interfaces. Though having a box full of JTAG/SWD cables and adaptors with 0.05″/0.1″ spacing and 10/16/20/38 pins none of them fits. Later I found an adapter which can be googled by TQ2440 mini2440 (or “ULink2 JTAG ARM Adapter 20Pin 2+2.54 mm 14Pin 2.54mm 10P 2+2.54mm 6P + 10P XH2.54”). It almost does the job.

JLink ColorDev BoardAdapter
TQ2440
mini2440
JTAG
SignalPin SignalPin Pin Signal
GND 4 blue GND H2/4110 GND
GND 6 blue GND H2/4210 GND
5V19 red 5V H3/48
VTref 1 white 3V3 H2/471…2 3V3
nTRST 3 brown NJTRSTH3/5 3 TRST
TDI 5 yellow JTDI H3/1 5 TDI
TMS 7 orange JTMS H3/3 7 TMS
TCK 9 green JTCK H3/2 9 TCK
TDO 13 grey JTDO H3/4 6 TDO
nRESET 15 violet NRST H3/6 4 NRST

Until the adapter arrived I had to do it the hard way:

Debugging the SeeedStudio GD32 RISC-V Dev Board

4 Power-Up the Target

“Almost” (in the last section) means that the target is not powered by the adaptor. For that, the red 5V cable must still be plugged in and, as described in the next blog, the line must be enabled.

1 comment: