Documentation

ST-LINK V2 Programmer/Debugger for STM8 & STM32 | ShillehTek Product Manual
Documentation / ST-LINK V2 Programmer/Debugger for STM8 & STM32 | ShillehTek Product Manual

ST-LINK V2 Programmer/Debugger for STM8 & STM32 | ShillehTek Product Manual

Overview

The ShillehTek ST-LINK V2 is a compact USB programmer and debugger for the entire STM32 and STM8 microcontroller families. Plug it into your PC's USB port, connect the four-wire SWD or SWIM header to your target board, and you can flash firmware, debug step-by-step, set breakpoints, and read RAM and registers in real time from STM32CubeIDE, Keil, IAR, PlatformIO, or the Arduino IDE.

Inside the aluminum case is an STM32F103-based ST-LINK V2 clone with ESD protection on every pin, a status LED that blinks during flash activity, and regulated 3.3V and 5V output rails to power small target boards directly from USB. It works with the STM32 Blue Pill (F103), Black Pill (F401/F411), Nucleo boards, Discovery boards, and any STM8S/STM8L chip — anywhere from the tiniest STM8S003 to the STM32H7 series.

At a Glance

Host Interface
USB 2.0 Type-A
Target Interface
SWD & SWIM
Supports
STM32 & STM8
Output Rails
3.3V & 5V
Header
2×5 (10-pin) 2.54mm
Pins
RST, SWCLK, SWIM, SWDIO, GND, 3.3V, 5V

Specifications

Parameter Value
Supported Target MCUs Full STM32 family (F0/F1/F3/F4/F7/G0/G4/H7/L0/L1/L4/L5) and all STM8S / STM8L / STM8AF
Target Programming Protocols SWD (Serial Wire Debug) for STM32, SWIM for STM8
Host Interface USB 2.0 Full Speed, Type-A
Onboard Controller STM32F103C8 with ST-LINK V2 firmware
Output Voltage Rails 3.3V and 5V (powered from USB)
Max Output Current ~200 mA on 5V rail, ~100 mA on 3.3V rail
Target VCC Range 1.65V - 5.5V (auto-sensed)
Max SWD/SWIM Clock 4 MHz (SWD), 8 MHz (SWIM)
Status LED Red during idle, green/blue blink during flash/debug
ESD Protection On all signal pins
Supported IDEs STM32CubeIDE, STM32CubeProgrammer, Keil MDK, IAR EWARM, PlatformIO, Arduino IDE, OpenOCD
Enclosure Anodized aluminum with removable USB/header caps
Dimensions 54 × 18 × 11 mm

Pinout Diagram

ShillehTek ST-LINK V2 programmer pinout showing RST, SWCLK, SWIM, SWDIO, GND, 3.3V, and 5.0V pins on the 2x5 header

The 10-pin 2.54mm header on the end of the ST-LINK V2 carries every signal you need to flash either an STM32 (over SWD) or an STM8 (over SWIM), plus regulated power rails to feed your target board. Pin labels are printed directly on the aluminum case, and pins are arranged as follows:

Pin Name Function
1 RST Target reset (NRST on STM32, NRST on STM8)
2 SWCLK SWD clock (STM32 only)
3 SWIM Single-wire programming (STM8 only)
4 SWDIO SWD data I/O (STM32 only)
5, 6 GND Ground (shared with target)
7, 8 3.3V 3.3V output (optional target power)
9, 10 5.0V 5V output (optional target power)

Wiring Guide

STM32 Wiring (SWD)

Every STM32 chip exposes the four SWD signals somewhere on its pin map. On dev boards you'll usually find them broken out on a labeled header (Nucleo boards use a CN4 SWD header, Discovery boards have a 4-pin SWD row). For bare chips, locate pins PA13 (SWDIO), PA14 (SWCLK), and NRST in the datasheet.

ST-LINK Pin STM32 Target Pin Notes
SWDIO (pin 4) PA13 / SWDIO Bidirectional data line
SWCLK (pin 2) PA14 / SWCLK Clock from programmer
GND (pin 5 or 6) GND Must share ground with target
3.3V (pin 7 or 8) 3.3V / VDD Only if the target is not already powered
RST (pin 1) NRST Optional, but helps with locked chips
Tip: You only need SWDIO, SWCLK, and GND for 99% of STM32 work. RST is only required when recovering a chip whose firmware disabled SWD, or when using "Connect Under Reset" mode in STM32CubeProgrammer.
Warning: Do not connect both the 3.3V and 5V rails at the same time, and do not feed the ST-LINK 3.3V output into a target that already has its own regulator powered on. Feeding voltage into a live regulator can damage the target board.

STM32 Blue Pill Wiring

The Blue Pill (STM32F103C8T6) has a dedicated 4-pin SWD header on the opposite end from the USB connector, clearly labeled 3V3, IO (SWDIO), CLK (SWCLK), and GND. This is the fastest way to flash firmware without any bootloader or USB-to-serial converter.

ST-LINK Pin Blue Pill Header Pin
3.3V (pin 7 or 8) 3V3
SWDIO (pin 4) IO
SWCLK (pin 2) CLK
GND (pin 5 or 6) GND
Tip: If you power the Blue Pill over USB at the same time, leave the ST-LINK 3.3V pin disconnected and only wire SWDIO, SWCLK, and GND. This avoids two sources fighting over the 3.3V rail.

STM32 Black Pill Wiring

The Black Pill (STM32F401 or F411) breaks out SWD on the four pins A13, A14, 3V3, and GND at the bottom of the board. The pins are spaced differently from the Blue Pill, so a 4-wire female-to-female jumper set is the easiest connection method.

ST-LINK Pin Black Pill Pin
3.3V (pin 7 or 8) 3V3
SWDIO (pin 4) A13
SWCLK (pin 2) A14
GND (pin 5 or 6) GND
Info: The Black Pill also has a USB-C port and supports DFU bootloader uploads, but SWD via ST-LINK is faster, supports interactive debugging, and doesn't require you to hold the BOOT0 button on every flash.

STM8 Wiring (SWIM)

STM8 uses a single-wire protocol called SWIM (Single-Wire Interface Module). The connection is only three signals — SWIM, RST, and GND — plus an optional power rail. STM8S Discovery, Nucleo-8 boards, and breakout modules like the STM8S103F3P6 usually expose these on a labeled 4-pin header.

ST-LINK Pin STM8 Target Pin Notes
SWIM (pin 3) SWIM / PD1 Single-wire data line
RST (pin 1) NRST Required for SWIM entry sequence
GND (pin 5 or 6) GND Must share ground
3.3V (pin 7 or 8) or 5.0V (pin 9 or 10) VDD Match the target's operating voltage
Warning: Unlike SWD, SWIM requires the RST line — the programmer pulses NRST to enter debug mode. If your SWIM flash keeps timing out, the RST wire is almost always the problem.

Code Examples

STM32CubeProgrammer (CLI Flash)

flash-stm32.sh
# Flash a .hex or .bin file to an STM32 using ST-LINK V2
# Install: https://www.st.com/en/development-tools/stm32cubeprog.html
# The CLI tool is called STM32_Programmer_CLI on Linux/macOS
# and STM32_Programmer_CLI.exe on Windows

# 1) Connect and read the chip ID (sanity check)
STM32_Programmer_CLI -c port=SWD freq=4000

# 2) Erase the entire flash
STM32_Programmer_CLI -c port=SWD -e all

# 3) Flash a hex file and verify, then reset and run
STM32_Programmer_CLI -c port=SWD \
  -w firmware.hex \
  -v \
  -rst

# 4) Read flash back to a file (for backup)
STM32_Programmer_CLI -c port=SWD \
  -r32 0x08000000 0x10000 backup.hex

PlatformIO (platformio.ini)

platformio.ini
; PlatformIO config for a Blue Pill flashed via ST-LINK V2
; Put this in your project root and run: pio run --target upload

[env:bluepill_f103c8]
platform = ststm32
board = bluepill_f103c8
framework = arduino

; Upload using the ST-LINK V2 (default is serial)
upload_protocol = stlink
debug_tool = stlink

; Optional: speed up the SWD clock
upload_flags = -c set CPUTAPID 0x1ba01477

[env:blackpill_f411ce]
platform = ststm32
board = blackpill_f411ce
framework = arduino
upload_protocol = stlink
debug_tool = stlink

OpenOCD (Command Line)

flash-openocd.sh
# Flash firmware with OpenOCD + ST-LINK V2
# Install: sudo apt install openocd  (Debian/Ubuntu)
#          brew install open-ocd     (macOS)

# Blue Pill (STM32F1x)
openocd -f interface/stlink.cfg -f target/stm32f1x.cfg \
  -c "program firmware.hex verify reset exit"

# Black Pill (STM32F4x)
openocd -f interface/stlink.cfg -f target/stm32f4x.cfg \
  -c "program firmware.hex verify reset exit"

# Interactive debug session (connect GDB on port 3333)
openocd -f interface/stlink.cfg -f target/stm32f1x.cfg

# In another terminal:
arm-none-eabi-gdb firmware.elf
(gdb) target remote localhost:3333
(gdb) monitor reset halt
(gdb) load
(gdb) continue

STM8 (stm8flash)

flash-stm8.sh
# Flash an STM8 chip over SWIM using stm8flash + ST-LINK V2
# Install from source: https://github.com/vdudouyt/stm8flash

# Read chip info (use your actual part number)
stm8flash -c stlinkv2 -p stm8s103f3 -s opt -r options.bin

# Unlock the chip if it's in read-out protection
stm8flash -c stlinkv2 -p stm8s103f3 -s opt -w default_opt.bin

# Flash the main application to flash memory
stm8flash -c stlinkv2 -p stm8s103f3 -s flash -w firmware.ihx

# Common -p values: stm8s103f3, stm8s003f3, stm8s105k4,
# stm8l151f3, stm8af5288, stm8l051f3

Frequently Asked Questions

Does this work with the genuine ST tools, or only clone software?
It works with the official ST toolchain — STM32CubeIDE, STM32CubeProgrammer, ST-LINK Utility, STVP, and STVD all recognize the programmer as an "ST-LINK V2" and flash chips normally. On first plug-in, STM32CubeProgrammer may prompt to update the firmware; accept it so the latest protocol features work.
My computer doesn't see the ST-LINK when I plug it in. What now?
On Windows, install the ST-LINK USB driver (bundled with STM32CubeIDE or downloadable separately from st.com) — without it, Windows shows an unknown device. On Linux, you may need a udev rule so non-root users can access the USB device; OpenOCD ships one in /usr/share/openocd/contrib/60-openocd.rules. On macOS, no driver install is needed.
Can I use this to power my target board from USB?
Yes — the 3.3V and 5V pins on the header are regulated outputs driven from the USB 5V rail. They are fine for powering a single Blue Pill, Black Pill, STM8 breakout, or small module (up to roughly 100 mA on 3.3V and 200 mA on 5V). For larger targets, use a separate power supply and only share GND with the ST-LINK.
My Blue Pill is locked and STM32CubeProgrammer says "No STM32 target found". How do I recover it?
In STM32CubeProgrammer, set the connection mode to Connect Under Reset and wire the RST pin from the ST-LINK to NRST on the Blue Pill. Press Connect, then do a full chip erase. This works when user firmware has disabled SWD or put the chip into standby before your debugger could attach.
Do I need all four wires to flash an STM32?
For a typical program-and-run workflow you only need SWDIO, SWCLK, and GND — plus 3.3V if the target isn't already powered. RST is only required for Connect Under Reset and for some STM8 SWIM operations. The pin is there so you have it when you need it.
Can I debug, or is this flash-only?
Full debug is supported: breakpoints, single-step, live variable inspection, and memory watch windows all work in STM32CubeIDE, Keil, IAR, and VSCode + Cortex-Debug. The clone firmware implements the same SWD/JTAG transport as the original ST-LINK V2, so any debugger that speaks to a real ST-LINK V2 will speak to this one.
What's the difference between SWD and SWIM?
SWD (Serial Wire Debug) is the two-wire protocol used on STM32 and every other ARM Cortex-M chip — it needs SWDIO and SWCLK. SWIM (Single-Wire Interface Module) is ST's older single-wire protocol used only on STM8 — it needs just the SWIM line plus NRST. This programmer does both, so one tool covers both chip families.

Related Tutorials