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.
| Pin | Name | Direction | Note |
|---|---|---|---|
| 1 | RST | output | Connect 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. |
| 2 | SWDIO | input/output | SWD data – to the target's SWDIO (PA13 on STM32) |
| 3 | GND | – | |
| 4 | GND | – | |
| 5 | SWIM | input/output | STM8 programming – to the SWIM pin (PD1 on STM8S) |
| 6 | SWCLK | output | SWD clock – to the target's SWCLK (PA14 on STM32) |
| 7 | 3V3 | output | Output 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. |
| 8 | 3V3 | output | Output 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. |
| 9 | 5V | output | 5 V from USB after the fuse. Do not connect if the target has its own power supply. |
| 10 | 5V | output | 5 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.
| Pin | Name | Direction | Note |
|---|---|---|---|
| 1 | RST | output | Connect 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. |
| 2 | SWCLK | output | SWD clock – to the target's SWCLK (PA14 on STM32) |
| 3 | SWIM | input/output | STM8 programming – to the SWIM pin (PD1 on STM8S) |
| 4 | SWDIO | input/output | SWD data – to the target's SWDIO (PA13 on STM32) |
| 5 | GND | – | |
| 6 | GND | – | |
| 7 | 3V3 | output | Output 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. |
| 8 | 3V3 | output | Output 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. |
| 9 | 5V | output | 5 V from USB after the fuse. Do not connect if the target has its own power supply. |
| 10 | 5V | output | 5 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/:
- STM32CubeProgrammer – uploading firmware to STM32 via SWD, JTAG and UART
- Adapter for STM32 programmers – one connector for the original ST-LINK, the Chinese V2 and J-Link
More pinouts
See all pinouts on the Pinouts page.