ST-LINK

来自百问网嵌入式Linux wiki
Wiki讨论 | 贡献2020年11月2日 (一) 12:20的版本
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

This article describes the ST-LINK hardware probes.

Introduction

The ST-LINK[1] is an in-circuit debugger and programmer for the STM8 and STM32 microcontroller families.

ST-LINK is a USB device and has to be connected to a PC host. It can be either embedded on ST boards or provided as standalone dongle.

ST-LINK can support different debug protocols depending on ST-LINK hardware version and on its embedded firmware version:

  • SWIM: debug protocol for STM8 microcontrollers
  • SWD/JTAG: debug protocol for STM32 microcontrollers and microprocessors

and communication interfaces:

  • UART
  • I2C
  • SPI
  • CAN
  • GPIO

Hardware versions

Several versions of ST-LINK exist: ST-LINK/V1[1], ST-LINK/V2[2], ST-LINK/V2-A, ST-LINK/V2-B, ST-LINK/V2-1 and STLINK-V3SET[3].

For details about the different versions, please refer to technical note[4] of ST-LINK derivatives.

To find out the ST-LINK version that is embedded in your ST board, refer to the Category:STM32 MPU boards page, and then select your hardware board.

Getting started

Installing the USB driver

Two USB drivers are associated to ST-LINK, depending of ST-LINK version: one for the debugger itself, and one for the serial communication port from (ST-LINK/V2-1).
The serial communication port uses standard CDC ACM USB Class, which is usually present by default on all PC operating systems. The USB driver for the debugger can differ depending of the PC operating system:

  • MS Windows®

A driver must be installed before connecting ST-LINK to a Windows® 7, Windows® 7 8, or Windows® 10 PC via the USB.

The driver is automatically installed by the toolsets supporting ST-LINK. It is also available from www.st.com [5].

  • Linux®

Users must be granted with rights for accessing ST-Link USB devices. Rules must then be added into /etc/udev/rules.d.

All information and files for installing the udev rules are provided in the STSW-LINK007[6] package available from www.st.com (see stsw-link007\AllPlatforms\StlinkRulesFilesForLinux\Readme.txt file).

  • Mac OS®

No specific installation is required.

Connecting JTAG/SWD for debugging

  • Embedded ST-LINK

A JTAG/SWD link is available from the USB link provided by the ST-LINK. The USB device is mounted on the host PC and ready to be used.

  • Standalone ST-LINK

Pins are available on the ST-LINK to connect the JTAG/SWD signals. Refer to Hardware versions for connection details.

- JTAG: VCC, JTDI, JTMS, JCLK, JRCLK, JTDO, NRST and GDN signals must be connected to the JTAG/SWD connector.
- SWD: VCC, SWCLK, SWDIO, NRST, SWO and GND signals must be connected to the JTAG/SWD connector (on some ST-LINK hardware version, a dedicated SWD port can also be available).

Connecting UART port (from ST-LINK/V2-1)

  • Embedded ST-LINK

A UART serial port is available from the USB link provided by the ST-LINK. The USB device is mounted on the host PC and ready to be used.

  • Standalone ST-LINK

Pins are available on the ST-LINK to connect the Rx/Tx and GND signals. Refer to Hardware versions for connection details.

To go further

Updating the embedded firmware

All information are given in the STSW-LINK007[6] software package available from www.st.com.

Warning.png The firmware update application embeds the latest firmware version, so do not hesitate to get the latest version of the executable STSW-LINK007[6] software package

How to bypass the embedded ST-LINK

To use a newest version of ST-LINK standalone probe or another debug probe, ST-LINK can be bypassed for ST boards that already embed it.

  • Deactivating the embedded ST-LINK

Please refer to the board description and schematic for how to put the embedded ST-LINK in reset mode if available.

  • Bypassing the embedded ST-LINK signals and connecting an external hardware probe

Connect the relevant signals depending on the interface available on the new hardware probe. Please refer to Connecting JTAG/SWD for debug and Connecting UART port for standalone external ST-LINK.