2022-08-26 05:05 PM
I see numerous examples of 4-wire SWD without a reset pin connection.
I come from the PIC world where there is always Data, Clock and Reset for a Pgm/Dbg interface.
I bought a Chinese STLink-V2 programmer/debugger and it has a reset pin as well as data, clock, GND and VSS.
Although, the Chinese STLink-V2 comes with a 4-conductor cable for attachment to my target.
Do I need to connect the Reset pin?
Also, anyone know of an Ap-Note that covers the electrical nature of the SWD interface.
Thank You
Solved! Go to Solution.
2022-08-28 04:53 PM
Take a note that a code line as simple as GPIOA->MODER=0; will reconfigure the PA13 and PA14 pins and make debugging impossible. If the code does it at the startup, then the debugger will not be able to connect anymore. The only solution left is to "connect under reset". To do it, something has to pull down NRST. That can be done by the debugger, reset button or a screwdriver, wire or something like that. Obviously the first option is the safest, easiest and most reliable one.
Take a look on the standard Cortex Debug connectors:
https://developer.arm.com/documentation/ka001776/latest
https://developer.arm.com/documentation/101453/0100/CoreSight-Technology/Connectors
And on ST's UM2448 Rev 7, section "8.1.2 STDC14 (STM32 JTAG/SWD and VCP)", which is compatible with 10-pin Cortex Debug.
And just in case... Read the AN4325.
2022-08-28 08:34 PM
I, too, bought a Chinese debugger. It could not be updated with newer drivers. I bought an STLink v2 for my boards, and since I had used the Chinese pinout as a standard for a 1:1 connection (10 pin to 10 pin), I had to design an adaptor for the standard 20 pin (now legacy) connector to the 10 pin I put on my boards. On the next revision, I went to a 7 pin connector, which had all the signals plus a jumpable VCC. I think that the STLinkV2 needed VCC to determine if the processor was there. Not a big deal to add it. If you go to 8 pins you could key the connector.
I next bought an STLink V3, which needed a base cover (see thingiverse) printed. Since it has the legacy connector, it worked perfectly with another adaptor (leave out the 10 pin, put in the 7). Your choice of connector, of course. I also put in 22 ohm damping resistors in the lines from the processor to the debug connector. Note that the STLINK V3 prefers 0.050 spacing pin connectors rather than 0.010 inch.
2022-08-29 01:36 AM
Little warning for you, cheap chinese dont implement too NRST for STM32.
RST on pinout is for STM8.
2022-08-29 02:30 PM
Thank You MM
I would have been tripped up by the reset thing.
From what I can determine from the data sheet and the posted info here, I should be able to program/debug my STM32F030C8 target with the Chinese debugger.
In my application PA13 and PA14 are dedicated to SWD only.
Also, the datasheet/ref-man for the STM32F030C8 makes no mention of Connect Under Reset being required, unlike the STM32L011D3 cited in the Kudelski article.
Many thanks to all for this invaluable enlightenment.
That's all for now.
2022-08-29 04:31 PM
> In my application PA13 and PA14 are dedicated to SWD only.
That is not enough. Under reset the PA13, PA14 pins are configured as SWD pins, but, when the CPU starts running your firmware, the your code can reconfigure those pins into a GPIO or some other configuration, disabling the SWD (and erase/program) capability. Read AN4325, section "4.3.2 SWD pin assignment". Keeping NRST low, stops the CPU from executing code and therefore from disabling the SWD. All STM32 MCUs can do this. The STM32L011D3 datasheet just notes that for a specific package under certain circumstances the "connect under reset" is absolutely necessary.
Add the NRST signal to connector even if your current debugger doesn't have that signal. You will thank me later, when you'll buy a decent debugger like a real ST-LINK or J-Link EDU Mini, both of which are pretty affordable. And, even if not, in those emergency situations at least you will have a pin, which could be easily connected to GND with a wire, button or screwdriver.
2022-08-29 06:05 PM
Thank You Piranha
I used MX to set PA13 and PA14 to SWD.
My code does not alter this situation.
PA13, PA14 and nRST are connected to the SWD header only.
No reset button. Power cycle only.
I always did plan to implement a 5-pin SWD connector on my target.
The F030 does not do SWO. I have no need for SWD pin six.
I started this thread because I was confused by so many google examples of SWD shown without nRST.
I just ordered a v3MINIE and an F072B-Discovery so I should be able to get something started.
They cost about the same as 5 of the Chinese debuggers.
So now I will have seven debuggers. I will have a number of targets communicating with each other so I will be using more than one debugger simultaneously.
I ordered the Chinese debuggers from Amazon because I simply could not determine what it was that I needed from the info available on the ST website. At that time I was totally confused.
3-pin, 4-pin, 5-pin, 6-pin, 10-pin, 14-pin, 20-pin, MINI, MINIE, MODS, SET, v2, v3 made my head hurt.
All I knew for sure is that the F030 was SWD not JTAG.
Now, a week later, I understand, thanks to all who have posted.
Thank You
2022-08-29 06:25 PM
> My code does not alter this situation.
The forum is full of posts where people do it accidentally... ;)
> They cost about the same as 5 of the Chinese debuggers.
But they are reliable, can update the debugger firmware and have NRST and SWO pins.
2022-08-29 06:34 PM
Harvey
The Amazon ad does say "Supporting for automatic firmware upgrades."
So I will have to see if I bought a boat anchor or not.
As for 22 ohm. I have implemented this programming interface in the PIC world for a couple of decades now. I've learned that the STM32 will not require the two 18K pull downs, their internal on the F030.
Makes the interface pretty much indestructible to human body model surge.
Thank You
2022-08-29 06:40 PM
Sorry Harvey
I dropped a .jpg of the interface discussed but obviously the machinery removed it.
I will try again here.
Although it appears to work, drag and drop does not work. One must use the image button.
Whooda thunkit.
That's all for now.
2022-08-29 06:48 PM
I found the update capability to be less than accurately described. I have a small doorstop suitable for a cat door.
The 22 ohm resistors are in series with the connection from the processor to a number of things:
1) the programming interface
2) the QSPI memory (AP6404L connected to the QSPI interface on an L5 processor. Not all processors support this)
3) the FMC interface to an S1D13517 (Epson) graphics controller chip.
4) a clock line or so (for the S1D13517).
Note that these are not pullups or pulldowns, but are included to damp reflections on the lines, and form a small low pass filter for possible ringing. If you check the designs on say, some of the disco boards, you will see that they do much the same thing. It may reduce the need to length match some of the data lines on the faster signals. It does work (didn't try without it) on the QSPI memory lines. The price of 22 or 33 ohm resistors (0402) is so small that a thousand of them is almost a throwaway.
The boards are 4 layer boards with a ground plane and 3 other planes (slightly complex board), and the signals seem reasonably well behaved.
You can argue whether or not the resistors are needed on the programming pins, but I rather suspect that they are needed on some of the other lines (such as FMC signals).