1
\$\begingroup\$

This question already has an answer here:

My MCU is stm32L432kc. I've concluded that we need a minimum of 4 connections: SWCLK, SWIO, vcc and gnd. Can someone from here confirm that?

And another question is I'm confused how to connect the Vdda/Vref+ pin 5 and the NRST pin4. Do I have to connect them? I have the schematic of nucleo board for my MCU attached. Should I just connect them the same way?

enter image description here

\$\endgroup\$

marked as duplicate by Bence Kaulics, Elliot Alderson, Dwayne Reid, Edgar Brown, Warren Hill Jan 18 at 11:06

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • \$\begingroup\$ I have programmed many parts with just swdio and swclk no swo or other. you do need a common ground and a number of the programmers need a voltage for reference (to know to drive 3.3v or 1.8 or whatever into your chip). thats it gnd vcc swdio, swclk. Not just stm32s but other cortex-m based products from other vendors. \$\endgroup\$ – old_timer Jan 15 at 20:15
1
\$\begingroup\$

Minimum SWD connections:
- SWCLK
- SWIO
- GND

Optional:
- Vcc for non-3.3V targets.
- NRST if SWD pins are re-used.

Debug:
- SWO, provides CoreSight SWO debug output.

Of course, the minimum of your chip itself are:
- All Vdd pins, including Vdda, and Vbat if available.
- All Vss pins, including Vssa.
- BOOT0 pin to known state.
- RESET pin to high.

\$\endgroup\$
  • \$\begingroup\$ What about the SWO pin? I've just read it's used to access the printf function for debugging. On the nucleo board in the pic I attached (named MCO) it is there but the switch is open by default. I'm not sure what that mean.. \$\endgroup\$ – Maryam Magdy Jan 15 at 19:27
  • \$\begingroup\$ @quiet SWO is not required to program the chip. But I've added it for completion. \$\endgroup\$ – Jeroen3 Jan 15 at 19:33
  • 1
    \$\begingroup\$ While NRST is not strictly required, even if you don't intentionally disable the SWD pins it is possible for programming errors to do so, so it's a good idea to bring it to somewhere. Also if your design uses low power modes, depending on settings you may need to reset the processor to make SWD work. \$\endgroup\$ – Chris Stratton Jan 15 at 19:41
  • 1
    \$\begingroup\$ A real ST-Link/V2 dongle needs VCC from target to set the supply voltage. It does not work without supply from target. \$\endgroup\$ – Justme Jan 15 at 20:16
0
\$\begingroup\$

Yes those are the minimum connections.

Also all power and ground pins on the MCU must be connected.

Nrst is usually connected to a 100nF cap, and pushbutton for easy resetting.

\$\endgroup\$
  • \$\begingroup\$ What about the SWO pin? I've just read it's used to access the printf function for debugging. On the nucleo board in the pic I attached (named MCO) it is there but the switch is open by default. I'm not sure what that mean.. \$\endgroup\$ – Maryam Magdy Jan 15 at 19:27
  • \$\begingroup\$ SWO is on PB2, it is not clear if it is used.MCO is the output of Nucleo ST-Link MCU and it can be used by the target MCU if it has no other external clock like the X1 in your picture. \$\endgroup\$ – Justme Jan 15 at 20:14

Not the answer you're looking for? Browse other questions tagged or ask your own question.