cancel
Showing results for 
Search instead for 
Did you mean: 

Which is Correct; 4-wire SWD without Reset OR 5-Wire SWD with Reset?

eewiz
Associate III

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

1 ACCEPTED SOLUTION

Accepted Solutions

Harvey

I just successfully upgraded my Chinese debugger.

Here's how I did it.

Plug in the debugger.

Start CubeIDE.

Go to the Debug View.

Select Run/Debug Configurations.

Double-Click STM32 C/C++ Application.

Select Debugger Tab.

Select AutoStart GDB Local Server.

Select Debug Probe = ST-LINK (ST-LINK GDB Server).

Select SWD.

Select ST-LINK S/N and click Scan button.

If what looks like hex serial number fails to populate the box then STOP, your debugger is kaput.

Mine populates with something like "121F14002E15374...."

Click the DEBUG button which leads the upgrade prompt.

Click to upgrade which starts the STLinkUpgrade dialog. Mine is v3.4.0.

Mine had some bogus ST-Link ID like "3030303030303030301".

If you click Refresh Device List, nothing happens.

If you click Open in Update Mode, you get a failure message something like "The Debugger is not in DFU Mode".

Simply unplug the debugger from it's USB port.

Take a deep breath and plug it back in to the same port.

Go back to STLinkUpgrade.

Click Refresh Device List.

It says that debugger "3030303030303030301" appears to be defective but I found debugger "121F14002E15374...." would you like to use it.

Say yes.

Click Open in Update Mode and the Upgrade button will light up.

Click the Upgrade button.

Here's the result:

0693W00000SuGClQAN.jpgYou may wish to resurrect your door stop and see if this works.

That's all for now

View solution in original post

24 REPLIES 24

>>Do I need to connect the Reset pin?

If you expect "Connect Under Reset" modes to work, yes.

If your device might go into standby or sleep modes, turning off the interfaces, yes.

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

Hello Tesla

I am used to being able to reset the target from the debugger.

Is this what "Connect Under Reset" mode means?

I don't understand how the SWD interface could ever work without a reset connection.

How does the debugger initiate downloading code to the target without being able to reset the target to get its attention?

Can the SWD interface reset the target without a reset pin connection?

Very confusing.

Thank you

Well it holds the device in reset whilst it attempts to connect. Bascially so code on the system doesn't interfere with the initial connection.

The debug accesses mostly memory and registers within the device, so it can basically execute NVIC_SystemReset() type call, or directly change the NVIC registers to cause that to reset the processor. It would also start the watchdog, and ignore it

I'm not sure why wiring up an extra pin is burdensome.

On most of the non CM0(+) parts there's a communication channel method using PB3 / TDO / SWO pin

https://www.silabs.com/documents/public/application-notes/an0062.pdf

https://developer.arm.com/documentation/ihi0031/a/The-Serial-Wire-Debug-Port--SW-DP-

https://research.kudelskisecurity.com/2019/05/16/swd-arms-alternative-to-jtag/

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

If the running user code doesn't have stop modes, 3 wire swd is only needed. Reset control otherwise, unless your user code has a sw delay at startup to ensure enough time for the opportunity to enter debug mode without reset.

SWD protocol is already a pin squeeze of jtag standard bus, and spec is in ARM cortex debug interface documents.

Vdd sometime is used by debug prove as target voltage monitoring, and/or signal level shifting like in STLinkV3minie.

RHarr.2
Associate II

Thank you Tesla.

I would have been quite frustrated trying to find that type of technical documentation on the ST Micro site.

This is the information I needed. I can now start a schematic.

I've been a PIC guy for 20 years but, now I'm moving to ST because I can't get PICs for a cost less than ridiculous.

Again, thank you.

RHarr.2
Associate II

Hello .

I see you mention a 3-wire SWD interface.

I assume you mean Ground, Data and Clock with pull ups on the target.

I've seen no examples that the leave out VCC yet.

In PIC world the debugger's transmitter requires VCC supplied from the target board.

You can't leave out the VCC connection.

I will look at the docs linked by tesla keeping a 3-wire interface in mind.

Thank You

Minimum SWD is 3wire as you write,

Optimal is 4 wire + RESET

This two need own power for MCU for debug or prog.

Next config i 5 wire + VCC , can be used to power MCU from debger.

Advanced is 6 wire +SWO ... thats all folks

Piranha
Chief II

GND, SWCLK, SWDIO - mandatory.

VDD - almost mandatory, because the debugger probes need it.

NRST - highly recommended. It is necessary for debugging stop/standby/shutdown modes and will allow erasing/flashing the MCU before running the code. If the code messes up the SWD pins or something else, which disables the debugging capability, pulling NRST low and doing "connect under reset" becomes a necessity.

SWO - optional. It provides an UART-like Tx channel, which can be useful for logging or other purposes.

RHarr.2
Associate II

Thank you MM and Piranha.

My cheap Chinese STLINKv2 does not implement the SWO function.

This does not hurt much since my target's STM32F030 also does not implement the SWO function.

I foresee this target having no stop/sleep modes but I will add a reset connection anyway.

I never did plan to leave out Reset and VCC but I saw so many examples without reset that I had to inquire.

That's all for now.

Thank You