Opens in a new tab

ST-LINK V2 Pinout (Clone)

The ST-LINK V2 in an aluminum case is a cheap clone of the STMicroelectronics programmer. It uploads to and debugs STM32 microcontrollers via SWD and STM8 via SWIM; it works with STM32CubeIDE, STM32CubeProgrammer, OpenOCD and Arduino.

However, the 2 × 5-pin connector comes in two wirings. What matters is what’s engraved on your case: the first line reads either “RST / SWDIO” (variant B) or “RST / SWCLK” (variant A).

Specifications

  • inside: STM32F103 (the oldest units F101) or a clone (CKS32, APM32, GD32)
  • SWD (STM32, and other Cortex-M via OpenOCD) and SWIM (STM8)
  • 2 × 5-pin connector with 2.54 mm pitch, cable with female Dupont connectors
  • 3.3 V (about 100 mA) and 5 V (from USB) outputs to power the target
  • USB-A, 3.3 V logic levels

For STM32, three wires are enough: SWDIO, SWCLK and GND (plus 3.3 V if the programmer powers the target board). For STM8, connect SWIM, RST and GND. You can identify the variant by the label on the case, or with a multimeter: ground is on pins 5 and 6 on variant A, and on pins 3 and 4 on variant B.

Pinout and pin table

Variant B – first line on the case “RST / SWDIO”. Hover over a pin in the diagram or a table row.

ST-LINK V2 (klon) – pinout, varianta B (RST / SWDIO)ST-LINK V2 (klon) – pinout, varianta B (RST / SWDIO)chiptron.eu · CC BY 4.0▲1 1 RST ← To the target's NRST – required for STM8, optional for STM32 3 GND 5 SWIM ↔ STM8 programming – to the SWIM pin (PD1 on STM8S) 7 3V3 ← 3.3 V output from the programmer, max. approx. 100 mA 9 5V ← 5 V z USB (za pojistkou) 2 SWDIO ↔ SWD data – to the target's SWDIO (PA13 on STM32) 4 GND 6 SWCLK → SWD clock – to the target's SWCLK (PA14 on STM32) 8 3V3 → 10 5V → Power Ground (GND) Control / reset
Download:PNGSVG
Pin table – ST-LINK V2 (klon)
PinNameDirectionNote
1RSToutputConnect to the target's NRST. Required for STM8 (SWIM), optional for STM32 ("connect under reset" mode). On some clones it does not activate in SWD mode – if connecting fails, hold the reset button on the target board.
2SWDIOinput/outputSWD data – to the target's SWDIO (PA13 on STM32)
3GND–
4GND–
5SWIMinput/outputSTM8 programming – to the SWIM pin (PD1 on STM8S)
6SWCLKoutputSWD clock – to the target's SWCLK (PA14 on STM32)
73V3outputOutput from the regulator in the programmer (no reverse-power protection); count on approx. 100 mA at most. Do not connect if the target has its own power supply. The voltage the programmer reports as "target voltage" is its own 3.3 V, not the target's voltage.
83V3outputOutput from the regulator in the programmer (no reverse-power protection); count on approx. 100 mA at most. Do not connect if the target has its own power supply. The voltage the programmer reports as "target voltage" is its own 3.3 V, not the target's voltage.
95Voutput5 V from USB after the fuse. Do not connect if the target has its own power supply.
105Voutput5 V from USB after the fuse. Do not connect if the target has its own power supply.

Variant A – “RST / SWCLK” on the case

The original clone and many others have SWCLK on pin 2, SWDIO on pin 4 and GND on pins 5 and 6.

ST-LINK V2 (klon) – pinout, varianta A (RST / SWCLK)ST-LINK V2 (klon) – pinout, varianta A (RST / SWCLK)chiptron.eu · CC BY 4.0▲1 1 RST ← To the target's NRST – required for STM8, optional for STM32 3 SWIM ↔ STM8 programming – to the SWIM pin (PD1 on STM8S) 5 GND 7 3V3 ← 3.3 V output from the programmer, max. approx. 100 mA 9 5V ← 5 V z USB (za pojistkou) 2 SWCLK → SWD clock – to the target's SWCLK (PA14 on STM32) 4 SWDIO ↔ SWD data – to the target's SWDIO (PA13 on STM32) 6 GND 8 3V3 → 10 5V → Power Ground (GND) Control / reset
Download:PNGSVG
Pin table – ST-LINK V2 (klon)
PinNameDirectionNote
1RSToutputConnect to the target's NRST. Required for STM8 (SWIM), optional for STM32 ("connect under reset" mode). On some clones it does not activate in SWD mode – if connecting fails, hold the reset button on the target board.
2SWCLKoutputSWD clock – to the target's SWCLK (PA14 on STM32)
3SWIMinput/outputSTM8 programming – to the SWIM pin (PD1 on STM8S)
4SWDIOinput/outputSWD data – to the target's SWDIO (PA13 on STM32)
5GND–
6GND–
73V3outputOutput from the regulator in the programmer (no reverse-power protection); count on approx. 100 mA at most. Do not connect if the target has its own power supply. The voltage the programmer reports as "target voltage" is its own 3.3 V, not the target's voltage.
83V3outputOutput from the regulator in the programmer (no reverse-power protection); count on approx. 100 mA at most. Do not connect if the target has its own power supply. The voltage the programmer reports as "target voltage" is its own 3.3 V, not the target's voltage.
95Voutput5 V from USB after the fuse. Do not connect if the target has its own power supply.
105Voutput5 V from USB after the fuse. Do not connect if the target has its own power supply.

What to watch out for

  • Go by the label on your own case – wiring according to someone else’s picture is the most common reason the programmer won’t connect.
  • Some units have SWDIO and SWCLK swapped relative to the label. If you can’t connect, try swapping them.
  • Don’t connect 3.3 V and 5 V if the target board has its own power supply.
  • The voltage the programmer reports as “target voltage” is its own 3.3 V, not the target’s voltage.
  • The signals are 3.3 V with no level shifter – use them with 5V targets (STM8 at 5 V) only with caution.

ST-LINK and STM32 on chiptron.eu/

Projects and guides on chiptron.eu/:

More pinouts

See all pinouts on the Pinouts page.

Related Articles