cancel
Showing results for 
Search instead for 
Did you mean: 

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

A..1
Associate II

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?

8 REPLIES 8
TDK
Guru

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
Associate II

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
Guru

What chip are you using?

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

STM32F407VE

TDK
Guru

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
Associate II

okay, thanks.

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

Uwe Bonnes
Principal III

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

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