Skip to main content
A..1
Associate II
Jul 8, 2021 1:36 AM UTC
Question

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

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.

8 replies

TDK
Jul 8, 2021 1:41 AM UTC

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
Jul 8, 2021 2:18 AM UTC

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
Jul 8, 2021 2:28 AM UTC

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
Jul 8, 2021 2:31 AM UTC

STM32F407VE

TDK
Jul 8, 2021 2:44 AM UTC

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
Jul 8, 2021 2:52 AM UTC

okay, thanks.

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

Uwe Bonnes
Chief
Jul 8, 2021 8:41 AM UTC

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

A..1
A..1Author
Associate II
Jul 9, 2021 2:40 AM UTC

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)>