Skip to main content
A..1
Associate II
July 8, 2021
Question

What Debug mode to use ? JTAG 4 Pins or 5 Pins ?

  • July 8, 2021
  • 5 replies
  • 14277 views

I'm learning arm, I have a custom board with a STM32F4 MCU and a debug probe with JTAG 20 pins.

In CubeMX System Core> SYS> Debug I have this option:

- Serial Wire

- JTAG (4 Pins)

- JTAG (5 Pins)

- Trace Asynchronous Sw

- JTAG with Trace with Synchro (1 bit)

- JTAG with Trace with Synchro (2 bit)

- JTAG with Trace with Synchro (4 bit)

So my big question is which mode should I use JTAG (4 Pins) or JTAG (5 Pins). I don't understand the difference. My board has this label:

SWD> 3V3, DIO, CLK, GND

JTAG> 3V3, TDI, TMS, TCK, TDO, GND

Also please someone briefly explain to me what the other modes are used for?

This topic has been closed for replies.

5 replies

TDK
Super User
July 8, 2021

Serial Wire (SWD) seems to be the most used and has the least problems. That's what I use. The "Trace Asynchronous Sw" adds the SWO pin which can be helpful.

JTAG and SWD use some of the same pins, you can use one or the other. They serve the same purpose but are different at the signal level.

"If you feel a post has answered your question, please click ""Accept as Solution""."
A..1
A..1Author
Associate II
July 8, 2021

I understand, but according to my specs, which JTAG connection should I use, 4 or 5 pins.

It should be 4 pins, right? because my board/MCU only supports TDI, TMS, TCK, TDO?

TDK
Super User
July 8, 2021

What chip are you using?

"If you feel a post has answered your question, please click ""Accept as Solution""."
A..1
A..1Author
Associate II
July 8, 2021

STM32F407VE

TDK
Super User
July 8, 2021

This suggests even if you use 4 wire mode, the 5th pin is not usable.

https://community.st.com/s/question/0D50X00009XkZm4SAF/stm32f2-jtag-without-njtrst-unusable

The 5th pin is certainly present on your chip.

SWD uses less pins and is more widely supported, but JTAG can certainly work.

"If you feel a post has answered your question, please click ""Accept as Solution""."
A..1
A..1Author
Associate II
July 8, 2021

okay, thanks.

I set Debug mode Serial Wire and then in Debug configurations I set Segger-JLink interface SWD

Uwe Bonnes
Chief
July 8, 2021

SWD also allows SWO, that is of help when debugging.

A..1
A..1Author
Associate II
July 9, 2021

yes thanks I read what you commented here STM32 microcontroller debug toolbox

<It is anyway recommended to explicitly activate the SWD pins by selecting “Serial Wire�? or “Trace Asynchronous SW�? (together with SWO)>