1
votes

I have designed a circuit in which I am using STM32L452RETx micro-Controller on PCB. This is basically a current sensor. I am using JTAG-20 connector for debugging. I am using Atollic TrueStudio IDE.

The issue is when I debugg program in TrueStudio by selecting JTAG option in debug configuration then it gives error saying failed to initialize the ST-Link and target not found but when I Select SWD then there is no error and it programs successfully. where as in STM32CubeMx I have set debug to JTAG 5 pin configuration as i am using JTAG 20 in hardware. (serial peripheral-> Sys -> Debug-> Jtag 5 pin). program is debugging without errors but no output at the serial terminal. serial terminal gives no hand shake error.

Can anybody tell is this right way of debugging ( SWD in TrueStudion and JTAG in STM32CubeMx) or I am making a mistake.

Regards,

1

1 Answers

0
votes

The paradox is not as big as it seems: As you can verify in the Datasheet for STM32L452xx, DS11912 Rev.5, pages 74/75, the alternate functions of the GPIO used for JTAG and SWD are the same (always AF0, "SYS_AF"). Therefore, SWD connetion works after you configured your STM32CubeMX to JTAG (If you had configured your Cube project to SWD, JTAG wouldn't have worked because the JTDI pin (PA15) wouldn't have been connected to AF0.).

This solves the problem why SWD worked unexpectedly.


The problem why JTAG doesn't work remains.

You mentioned that you're using a JTAG-20 connector, but not which ST-Link version exactly you are using. If, for instance, you are using the ST-Link part that is embedded to a nucleo board (or discovery, or similar product of other vendors), the ST-Link pinout is limited to lines needed for SWD and SWO (together: SWV). This is not due to limitations of TrueStudio, which does support JTAG in principle, but because one of the 5 lines may be unconnected.

Please inspect which exact ST-Link version you are using (easiest thing to check is what the ST-Link Utility program tells you), re-check your schematics and wiring from the target µC to your debug adapter. If you don't find an obvious reason (and fix your problem this way), your problem may be an electronic one. Then it is off-topic here and (after narrowing it further) you should describe the remaining problem in Electrical Engineering Stack Exchange. If you have an oscilloscope, it may be worth to check the signals, especially on those pins that are only on JTAG but not SWD (JTDI, JTDO, NJTRST).