This project is completely designed using Lichuang EDA. If you like this project, please give it a like in the comment area. Thank you for your support!
Everyone is welcome to collect this project.
- ST-Link/V2: Supports STM32 and STM8 debugging, without virtual serial port. Most of them are sold on TB. Currently, there are several versions of ST-Link on hand. This version will be used for burning later.
- ST-LinkV2-1: supports STM32 debugging, with virtual serial port and virtual USB disk download. This is the version of ST-Link currently loaded on ST’s official Nucleo series evaluation boards.
What this project produces is ST-Link V2-1, which is used for STM32 program downloading, simulation debugging and serial port functions.

The schematic diagram of this project refers to the ST-link V2-1 design on the Pandora development board of Punctual Atom, as shown below. The first time I came into contact with ST-link V2.1 was on this Pandora development board.
Precautions:
The USB_ST_LINK on the Pandora development board can be transferred directly. The USB-Type-A is used in this design.
For POWER on the Pandora development board, you only need to take one LDO and move it over.
STlink v2.1 on the Pandora development board, this part can also be moved over and replace STM32F103C8T6 with STM32F103CBT6
A schematic diagram of ST's official ST-Link V2.1 is uploaded in the attachment.
In ST's official ST-Link V2.1 drawing, there is an indicator light named COM. This is a red and green LED indicator light, which is the LED shown in the picture below .
The translation is as follows:
Since ST-LINK/V2, all ST-LINK boards have an LED labeled "COM" (on the housing or PCB).
Regardless of the connection type, this LED shows the ST-LINK status:
- LED flashing red: First USB enumeration with PC in progress.
- LED red: Communication between PC and ST-LINK is established (end of enumeration).
- LED flashes green and red alternately: data is being exchanged between target and PC.
- LED is green: the last communication was successful.
- LED is orange: ST-LINK communication with target failed
The ST-LINK V2-1 integrated in the Pandora development board referenced by this project uses a red LED to replace the red and green COM indicator light. Therefore, this project also follows this design, and the COM indicator light is replaced by a red LED. .
1. The D- and D+ data lines of the USB part must use differential routing .
2. The crystal oscillator circuit part must be placed close to the MCU.
Since the official source code of ST-Link has not been disclosed, and the ST-Link firmware ( read protection ) has not been directly provided, there are currently (July 2020) multiple versions of firmware circulating on the Internet.
Version 1: STLink V2.J16.S4 version firmware: Standard V2 version, supports SWD and SWIM interfaces, this version of firmware is. Attachment uploaded.
Version 2: STLink V2.J28.M18 version firmware: used for ST-LINK/V2-1, ST-LINK/V2-A, ST-LINK/V2-B boards (with STM32 debugging interface, large-capacity storage interface, virtual COM port) version. Attachment uploaded.
To make ST-Link V2-1 in this project, you must use version V2.J28.M18 as the burned firmware version .
You can use these two tools to burn firmware for the first time
STM32CubeProg: STM32CubeProgrammer software for all STM32 download address
The main function of STM32CubeProg is programming (download), and supports Windows, Linux, and macOS operating systems.
At the same time, you need to install the JRE environment to use it, download address .

The function of STM32 ST-LINK Utility is slightly simpler than STM32CubeProg, and its main function is also programming (download).
This article uses the STM32CubeProg programming tool to burn firmware .
You also need a burning tool to burn the firmware. I only have the following ST-Link v2 here.
There are three methods for firmware update
- Download the official firmware upgrade app
STSW-LINK007 : Firmware upgrade for ST-LINK, ST-LINK/V2, ST-LINK/V2-1 and STLINK‑V3 boards
The latest firmware version number as of July 2020
- Use the upgrade tool provided by STM32CubeProg or STM32 ST-LINK utility to upgrade
STM32CubeProg V2.4.0 built-in firmware version
- Use the built-in upgrade tool of Keil MDK-ARM to upgrade. When the ST-link version is lower than the built-in version of MDK, you will be prompted to upgrade.
The built-in firmware upgrade version of Keil MDK-ARM v5.31 is the same as the built-in firmware upgrade version of STM32CubeProg V2.4.0, both are V2.J35.M26
This article uses the STM32CubeProg V2.4.0 built-in upgrade tool to update the firmware.
hint
See the attached video for the firmware burning and update process.
Display the above information and confirm that the firmware is OK
- Test the burning function, use Keil-MDK, download the program successfully, indicating that the burning function is normal
- Test the Debug function and use Keil-MDK for debugging. If it can be debugged, it means that the Debug function is normal.
- To test the U disk drag and burn function, you need to generate a bin file ( bin file generation method ), drag the bin file to the U disk simulated by ST-link, and successfully burn it, indicating that the virtual U disk function is normal.
- Test the serial port transceiver function: Use Dupont cable to connect the TX and RX of ST-LINK V2-1, open the serial port assistant, send data, and the receiving area receives the same data, indicating that the serial port transceiver is normal
- The ST-LINK firmware upgrade tool does not know which version it starts from, and does not support cross-version firmware updates.
- The recent versions of ST-LINK firmware have added read protection, and the SWD port is locked, so the firmware cannot be read or written through the SWD port.
- If you want to change to firmware such as DAP-LINK, you cannot burn the firmware through the SWD port, but you can erase the STM32 firmware information through ISP, and then you can use the SWD port to read and write normally.
Warm reminder: If you have any questions, you can leave a message directly in the comment area. After seeing the message, we will reply in time.
Friends who like it, please give it a like above the comment area, thank you!
The content of this video is about firmware burning and updating.