Skip to main content
Nsg1987
Associate III
June 26, 2024
Solved

JTAG connections for STM32G474 controller

  • June 26, 2024
  • 6 replies
  • 8777 views

Hello,

I am connecting STM32V2 debugger at following pins. 

Nsg1987_0-1719397754368.png

 

This supports SWD. I want to use JTAG pins and want to use STM32V2 debugger as a JTAG connection for debugging purpose.

 

can you support me how to connect or which pins to be used and what is the procedure to change from SWD to JTAG mode?

 

Regards,

Nikhil 

 

Best answer by AScha.3

>SWD connection works fine but we have observation that when MCU is in debugging mode and MCU is generating PWM pulses for power circuit, the moment power circuit starts to draw the power, MCU comes out of the debugging and we are not able to watch the various parameters in watch window. Hence, we would like to go with JTAG and want to debug the code during power circuit in operation.

So forget your "jtag will solve my problems idea" - connecting with jtag will show same behaviour.

Best solution: dont debug, while power circuits running. (Or : only possible solution, depends on the "power" of your system there. )

I work on inverters with 1...120 kW output - and believe me, nothing will work reliable with some low level cable connected to debug - even on (potential free)  Laptop, when inverter starting.

Maybe with Laptop (running on battery supply) + isolated debug adapter ...it might work. 

This you could try... ST-LINK/V2-ISOL , to have swd debug connection on running power unit.

Usually i debug on a simulator and on big inverter only by serial "debug" printf (not sensible to every small spike).

+

btw

My impression : st-link V3 more sensitive to small EMI/spikes on ground than V2 .

6 replies

Andrew Neil
Super User
June 26, 2024

@Nsg1987 wrote:

want to use STM32V2 debugger


Do you mean ST-Link V2 ?

https://www.st.com/en/development-tools/st-link-v2.html

Note that this does support SWD.

 


@Nsg1987 wrote:

can you support me how to connect or which pins to be used


That will all be in the Datasheet; see also the Reference Manual - both available on the 'Documentation' tab of the Product Page:

https://www.st.com/en/microcontrollers-microprocessors/stm32g474ve.html#documentation

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Nsg1987
Nsg1987Author
Associate III
July 2, 2024

I used the pins for JTAG as below. 

Nsg1987_0-1719898297576.png

But i am getting below error .

Nsg1987_1-1719898336534.png

Can you let me know how to solve the error and connect the JTAG?

 

Regards,

Nikhil 

 

Andrew Neil
Super User
July 2, 2024

@Nsg1987 wrote:

I used the pins for JTAG as below. 


That's just the complete pinout list for the ST-Link - so doesn't really tell us anything.

Show your schematic with how you connect the ST-Link to the chip.

Can you connect over SWD ?

Why is it that you require JTAG rather than SWD?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Nsg1987
Nsg1987Author
Associate III
July 3, 2024

 

Hello @Andrew Neil 

Below is the connection diagram between ST-LinkV2 and MCU.

Nsg1987_0-1719980147615.png

SWD connection works fine but we have observation that when MCU is in debugging mode and MCU is generating PWM pulses for power circuit, the moment power circuit starts to draw the power, MCU comes out of the debugging and we are not able to watch the various parameters in watch window. Hence, we would like to go with JTAG and want to debug the code during power circuit in operation.

 

Thanks,

Nikhil 

 

Andrew Neil
Super User
July 3, 2024

Looks right - apart from the switch:

AndrewNeil_1-1719997970237.png

Are you sure you have the correct pin numbers for the MCU?

 


@Nsg1987 wrote:

SWD connection works fine but we have observation that when MCU is in debugging mode and MCU is generating PWM pulses for power circuit, the moment power circuit starts to draw the power, MCU comes out of the debugging and we are not able to watch the various parameters in watch window. Hence, we would like to go with JTAG


What makes you think that JTAG won't suffer the same effect?

Sounds like you have an underlying EMC issue which needs addressing ...

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Tesla DeLorean
Guru
July 3, 2024

Or there's some conflicting pin usage?

Also watch out for low power modes or brown out. Perhaps get visibility of the NRST line on a scope?

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Nsg1987
Nsg1987Author
Associate III
July 5, 2024

Hello @Andrew Neil & @Tesla DeLorean 

In order to avoid conflict of pins, we tried to use JTAG connector of B-G474 evaluation board. The CN1 connector of B-G474 board is connected to JTAG connector of ST-Link V3 debugger. 

Nsg1987_0-1720151800627.png

 

we took care of shorting SB28 solder bridge and to remove R89 to use CN1 as a JTAG of B-G474 board.

Nsg1987_1-1720152009466.png

ST-Link V3 JTAG

To our surprise, we are still getting above error.

Here we made sure that the JTAG pins of B-G474 is not conflicting with any other.

 

Regards,

Nikhil 

 

 

Andrew Neil
Super User
July 15, 2024

Again, you're only showing one end of the connection - both ends need to be correct for the connection to work!

Are you sure you're using the correct cable?

You still haven't said why you want JTAG when SWD works fine?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Nsg1987
Nsg1987Author
Associate III
July 15, 2024

Is there any other way to do so.

 

regards,

Nikhil

Nsg1987
Nsg1987Author
Associate III
July 15, 2024

Right now we are using SWD only. but it is observed that the MCU comes out of the debugging mode once the system starts to draw the power. Hence we want to try the same scenario with JTAG connections.