cancel
Showing results for 
Search instead for 
Did you mean: 

debugging STM32 : need some newbie suggestions

infor
Associate III
Posted on May 28, 2015 at 10:37

In a few days I will start the first project with STM32 on a dedicated hardware.

I would like to ask some suggestions about debugging:

1) JTAG or SWD? So far I used JTAG on AVR core and it worked fine. I don't know SWD, are there any advantages?

2) Which debug tool? Having both SWD and JTAG would be better

3) How to connect the tool to the MCU? Again, with AVR I am used to bring the needed signals to a connector, attach the probe, and that's all. On the other hand, the ST Discovery boards seem to contain additional circuitry for the debug function, so I don't know how to proceed.
2 REPLIES 2
Hamid.Wasti
Associate II
Posted on May 28, 2015 at 12:17

1) SWD uses fewer pins. This means you require a smaller connector and fewer pins on your micro.  Sometime that little bit makes all the difference in the world. If you are using the port just to program and download/run on small micros, there are no functional differences between the two. If you want to do more or are dealing with bigger micros, there may be significant differences.

2) I have had great luck with Segger J-Link.  Even though Segger falls in my list of most unreasonable and customer unfriendly companies to deal with, the J-Link does what it promises to do and does it well. IAR's I-Jet has been anything but reliable. Using IAR's own EWARM software it would routinely hang. ST makes their own product called ST-Link which is SIGNIFICANTLY lower cost. There are several other similar products at various price points and with a variety of features.

3) The discovery boards have all the guts out of  a ST-Link on them. This means you can buy the discovery board and start using it without having to buy anything else. Many years ago ST used to ship you a standalone ''J-Link/Enterprise'' debugger with each demo board. Now that ST has their own debugger built into the board, they do not have to pay a 3rd party and can sell the discovery board at lower cost. Smart strategy!

For your own design you will need to select and buy a debugger.  J-Link works quite well, but I can not recommend it because I do not want it on my conscience that I condemned you to dealing with Segger.

You will have to put a connector on your board to connect to the debugger. There are a number of ''standard'' pin-outs using various size connectors. If you go with one of them, you can connect the debugger to it using the standard cable that comes with the debugger. But all the standard connectors are too big to be useable on a production board.  I personally like the Tag-Connect ''Plug Of Nails'' system. We did our own custom pin assignment for the TC-2050 (10 pin) and did our own interface board from the standard 20 pin 0.1'' pitch connector found on most programmers to the TC-2050's 10 pin IDC connector. We are most probably going to do something similar for the TC-2030 (6 pin) using just the SWD pins.

stm322399
Senior
Posted on May 28, 2015 at 14:26

Don't miss the most interresting thing with ST eval boards: The on-board SWD probe can also be used as a generic probe to any external device. On my STM32L discovery, I only removed two jumpers and used the provided header to wire to my own board. So you do not even need to buy another probe, this make STM32 programming very cheap.

On the software side, I use the excellent https://github.com/texane/stlink, that allows me to program and debug using a GNU/Linux host.

I let you STFW for W****** support, there should be plenty.