ST-Link Programmer

Table of Contents

STLINK-V3SET

We have introduced the hardware debugger tools / programmer before, now let us learn the ST-Link programmer together. In this article, you will learn about the different versions of ST-Link, their differences, and how to use them to program your chip.

ST-Link Version

Currently, there are three versions of ST-Link: ST-LINK/V1, ST-LINK/V2 and STLINK-V3. At the same time, the ST development board also comes with its own ST-Link tool, but its ST-Link version varies depending on the development board.

ST-LINK V1

ST-LINK V1 is the earliest version, and currently few people use it on the market.

ST-LINK V1
ST-LINK V1

ST-LINK V2

The ST-LINK V2 version can be divided into two: ST-LINK/V2 (standard version) and ST-LINK/V2-ISOL (isolated version). Among them, ISOL (Isolation) comes with 1000V isolation. This version is relatively expensive.

ST-LINK_V2
ST-LINK_V2
ST-LINK_V2-ISOL
ST-LINK_V2-ISOL

ST-LINK V3

STLINK-V3 also has multiple categories:

STLINK-V3SET

STLINK-V3SET is a set of fully functional download programming tools independent of the ST evaluation board, and is also a mainstream STLINK-V3 tool. It goes on sale for $35.

STLINK-V3SET
STLINK-V3SET

STLINK-3MINI

In 2019, ST launched the more compact and smaller STLINK-3MINI, measuring only 15 x 30mm, and its price when it went on sale was only $9.75.

STLINK-3MINI
STLINK-3MINI

STLINK-V3MODS

The functions of STLINK-V3MODS and STLINK-V3MINI are basically the same, but the application scenarios are different. You can compare it to the “stamp version” of STLINK-V3MINI.

STLINK-V3MODS
STLINK-V3MODS

B-STLINK-VOLT

The B-STLINK-VOLT board is an add-on module/adapter board for STLINK-V3SET. It is more suitable for low-voltage (such as 1.8V) STM32 systems.

B-STLINK-VOLT
B-STLINK-VOLT

B-STLINK-ISOL

B-STLINK-ISOL is similar to B-STLINK-VOLT and is also an “expansion board” for STLINK-V3SET. It provides galvanic isolation and voltage conversion functions and is used with microcontrollers below 3.3 V.

B-STLINK-ISOL
B-STLINK-ISOL

STLINK-V3PWR

STLINK-V3PWR, launched in March 2023, is an ST-Link hardware used to monitor and debug STM32 low-power current. The price at launch is $93.10.

STLINK V3PWR
STLINK-V3PWR

Different Interfaces of ST-LINK

SWIM Interface

The SWIM interface is used to debug and download STM8. It has only four wires and is defined as follows:

ST-LINK PortSTM8 Target BoardFunction
VDDMCU VCCConnects to STM8's power supply VCC
DATAMCU SWIM PINConnects to STM8's SWIM pin
GNDGNDConnects to STM8's GND
RESETMCU RESET PINConnects to STM8's reset pin

JTAG/SWD Interface

The ST-Link/V2 JTAG/SWD interface is defined as follows:

PinST-LINK PortTarget STM32 (JTAG)Target STM32 (SWD)
1TVCCMCU VDDMCU VDD
2TVCCMCU VDDMCU VDD
3TRSTJNTRSTGND
4GNDGNDGND
5TDIJTDIGND
6GNDGNDGND
7TMS_SWDIOJTMSSWDIO
8GNDGNDGND
9TCK_SWCLKJTCKSWCLK
10GNDGNDGND
11NCNCNC
12GNDGNDGND
13TDO_SWOJTDOTRACESWO (for SWV)
14GNDGNDGND
15NRSTNRSTNRST
16GNDGNDGND
17NCNCNC
18GNDGNDGND
19VDDNCNC
20GNDGNDGND

ST-LINK Programming Tool

One common feature of ST-LINK is that it is used for programming (downloading programs). Programming tools include: STVP, STM32 ST-LINK Utility, and STM32CubeProgrammer.

  • STVP: A tool that can be used for both STM8 and 32 programming.
  • ST-LINK Utility: A tool limited to STM32 programming.
  • STM32CubeProg: A tool that can be used for both STM8 and 32 programming.

An Example of ST-LINK Programming with Keil 5

Here we introduce how to use st-link v2 in Keil 5 to download and debug programs for the arm development board. Including the wiring method of stlink, the configuration of stlink in keil, debugging in keil, etc.

Keil 5 Configuration

Click the magic wand in the Keil toolbar to bring up the configuration dialog box as shown below:

Setting the ST-Link Debugger of Keil
Setting the ST-Link Debugger of Keil
ST-LINKV2 Debug Adapter_Cortex-M Target Driver Setup_Keil
ST-LINKV2 Debug Adapter_Cortex-M Target Driver Setup_Keil

Check “Reset and Run”, the program will automatically reset and run after downloading to the microcontroller.

Flash Download Function_Cortex-M Target Driver Setup_Keil
Flash Download Function_Cortex-M Target Driver Setup_Keil

Debugging

Enter Debugging State

Click the button to enter or exit debug mode:

Debug mode of Keil
Debug mode of Keil

Common Debugging Operations

Reset

Reset the program to its initial position.

Reset of Keil
Reset of Keil
Single-step Debugging

It means that each time the button is clicked, the program runs one step. When encountering a calling function, it will enter the called function. Click the icon button, or press the shortcut key F11.

Single-step Debug of Keil
Single-step Debug of Keil
Step-by-step Debugging

It means line-by-line debugging, that is, each time the button is clicked, the program runs one line. When a function is encountered, it will not enter the function. Click the icon button, or press the shortcut key F10.

Step-by-step Debug of Keil
Step-by-step Debug of Keil
Jump out of Debugging

means jumping out of function debugging, that is, every time the button is clicked, the program jumps out of a function until the outermost function (main function) is jumped out. Click the icon button, or press the shortcut key Ctrl + F11.

Jump Out Debug of Keil
Jump Out Debug of Keil
Run the Program to the Specific Position

If you click the button (or Ctrl + F11), the program will stop when it reaches the cursor position (provided that the program can be executed to the cursor position).

Runs the Keil's Program to the Specific Location
Runs the Keil's Program to the Specific Location
Jump to the Pause Position of Keil's Program

This function is effective when the program stops running and can help us find the pause location of the program.

Jump to the Pause Position of Keil's Program
Jump to the Pause Position of Keil's Program
Debug Window

The menu of the debugging window is only activated during the debugging process, and is different from the window in the normal editing state.

Debug Window of Keil
Debug Window of Keil
Memory or Variable Window

Select a variable, right-click the mouse and select “Add ‘Variable Name’ to…” to add it to the specified observation window.

Variable Debug of Keil
Variable Debug of Keil
System Peripherals Window

That is, the peripheral register value viewing window.

System peripherals of Keil
System peripherals of Keil

Subscribe

Join our subscribers list to get monthly blog updates, technology news, case studies. We will never send spam, and you can unsubscribe at any time.

About Author

Aidan Taylor
Aidan Taylor

I am Aidan Taylor and I have over 10 years of experience in the field of PCB Reverse Engineering, PCB design and IC Unlock.

Need Help?

Don't hesitate - Get in touch today to find out how we can help take your project to the next level.

Table of Contents

Scroll to Top
welldone pcb manufacturer

Start to Achieve Your PCB Project