cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to perform JTAG programming and debugging in CubeIDE and STLink V2

Kasun.Nimantha
Associate

Hi all,

I'm using STLink V2 (Not STLink V2 ISOL) to program and debug a STM32F103C8 microcontroller(Development board is a low cost STM32 bluepill). Programming and debugging via SWD works like a charm, without any issue. But I was never able to get the JTAG working. I made all the pin connections according to page 12 of UM1075. The way I tried is given below.

  1. Connected all the relevant JTAG pins according to UM1075 documentation.
  2. Reserved all JTAG pins from CubeMX in Cube IDE
  3. Inside "stm32f1xx_hal_msp.c" file, it was checked and verified if "__HAL_AFIO_REMAP_SWJ_ENABLE()" line is there in HAL_MspInit() function.
  4. From Project > Debug configurations,
    1. Debug Probe - ST-LINK(ST-LINK GDB Server)
    2. Interface - JTAG
    3. Reset Behavior - Connect Under reset

And that's all.

When I try to debug I get the message "Failed to Start GDB server" along with

"Error in initializing ST-LINK device." and "Reason: No device found on target." messages on console. But when I select SWD as debug interface, it works fine.

Any thoughts about this? What am I missing?

1 ACCEPTED SOLUTION

Accepted Solutions

A real ST-LINK/V2 ?

Assuming as SWD works that VTarget is present.

Still sounds like a pin connectivity is, from pod, to IC pin. Check schematic. If wired correctly not reason I can see why it wouldn't work.

Enumerate exact what you've connected to what, not just refer to another document. List what you've done, and perhaps attach a clear/focused picture of the implementation.

All HAL related remaps, etc could be sidestepped if BOOT0 is pulled HIGH

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

2 REPLIES 2

A real ST-LINK/V2 ?

Assuming as SWD works that VTarget is present.

Still sounds like a pin connectivity is, from pod, to IC pin. Check schematic. If wired correctly not reason I can see why it wouldn't work.

Enumerate exact what you've connected to what, not just refer to another document. List what you've done, and perhaps attach a clear/focused picture of the implementation.

All HAL related remaps, etc could be sidestepped if BOOT0 is pulled HIGH

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Kasun.Nimantha
Associate

@Community member​ Thank you for your reply.

Since you mentioned about pin connectivity, I checked it.

Of course it was a lousy connection. I fixed it. Now JTAG works fine.

(Yes, My STLink/V2 is a real one. And BOOT0 is pulled low.)

Regards,

Kasun