Skip to main content
ABoya.14
Associate III
January 10, 2019
Question

Which pins are needed to program a mcu via swd

  • January 10, 2019
  • 3 replies
  • 14762 views

hello everyone !

i'm using a nucleo board (NUCLEO-F401RE) to program a MCU STM32F301 placed on newly fabricated pcb; the mcu has never been programmed.

i have disconnected the jumpers to use the CN4 connector. 

i have just connected the SWCLK (clock signal) and the SWDIO (data I/O) and i get an error message (Device not found)

i would like to know if i have to connect the NRST (Resest) pin also or maybe the GND and The VCC.

ps:most of the documents i found on swd were talking about only two pins to be connected: clock and data

thank you all

This topic has been closed for replies.

3 replies

Uwe Bonnes
Chief
January 10, 2019

Well, not connecting ground is never a good idea. Whether VCC is needed depends on the debugger. If the debugger senses Target voltage, you need to connect VCC too. Reset is needed if you traget remaps SWD pins or does sleep deep for longer times.

ABoya.14
ABoya.14Author
Associate III
January 10, 2019

thank you for answer.

the thing is the board has its own voltage of 3 volts. should i use the voltage supply of the board or i have to use the vcc of the USB connector (which is 5 volts while the maximum voltage that the mcu can support is 3.6 V)

thank you.

Uwe Bonnes
Chief
January 10, 2019

Don't apply USB voltage without double thinking!

The STLINK from a nucleo board has it's own debugger IO supply at 3.3 Volt. So only connect ground and the swd pins. However the target needs to run with 3.3V so voltage levels at the SWD pins match. Perhaps you get connection to a target at 2.5 Volt, but not reliable.

ABoya.14
ABoya.14Author
Associate III
January 10, 2019

i think the problem stems from voltage level. since as you're saying the nucleo board has its pins at 3v3 while the voltage supply on board is about 3 V even lightly less than 3 v.

thank you for your help

S.Ma
Principal
January 10, 2019

If you want to flash an STM32 with SWD on a custom designed board you will need:

SWDIO, SWDCLK, GND and the STM32 power supply line connected to STLink.

The supply line is used as input voltage monitoring for the STLink. If it is missing, the debugger will think the STM32 is OFF. This voltage monitoring also tell the STLink if the STM32 is 1.8V, 2.5V, 3.3V etc.... to avoid all the level shifting enjoyable pain.

ABoya.14
ABoya.14Author
Associate III
January 14, 2019

thank you so much for your answer.