Varieties of ST-Link programmers
To load firmware into STM32 microcontrollers ST-Link programmer is used, which can be connected to the programmable microcontroller via SWD interface. In addition, using the same ST-Link and SWD you can perform step-by-step debugging of the firmware from the development environment with support for breakpoints (breakpoints). The number of simultaneously installed breakpoints is limited to several pieces (I don't remember exactly how many, like 5 pieces), but it is more than enough for debugging the firmware.
In branded debugging boards from ST on board there is the target microcontroller itself, and ST-Link programmer, which is also made on the microcontroller STM32. By the way a very convenient solution. In addition, the programmer, which is built into the debug board, can be used to flash any external microcontroller STM32. For this purpose there is a special comb on the board and jumpers with which you can disconnect the SWD interface from the microcontroller soldered on the board. At my disposal I have a board stm32f4discovery, on which the microcontroller STM32F407VG is installed, and this board I just use as a programmer ST-Link:
Of course, you can purchase a separate ST-Link programmer. There are several options here. The first is a branded ST-Link, which comes with and without galvanic isolation. These programmers look like this:
Another option is a Chinese ST-Link in a flash drive form factor:
In principle, this option is not bad either, but you should keep in mind that inside it there are no protections for USB interface and target board, so in case of unaligned earths of the circuit and PC, short circuit in the debugging circuit, and so on, there is a big chance to burn the programmer together with USB port in the computer. So you should be extremely careful when working with this programmer!
Connecting ST-Link programmer to STM32 microcontroller
SWD interface, through which the programmer is connected to the microcontroller, has 2 lines:
- SWDIO
- SWCLK
- SWDIO - PA13
- SWCLK - PA14
That's all for now, thanks for listening!