Introduction
The ST-LINK/V2 is an in-circuit debugger/programmer for the STM8 and STM32 microcontrollers. The single wire interface module (SWIM) and the JTAG/serial wire debugging (SWD) interfaces facilitate the communication with any STM8 or STM32 microcontroller operating on an application board.
硬件
JTAG接口针脚布局
我们关注的是STM32,JTAG接口针脚布局见下图,注意缺口位置:
各针脚的名称及功能
Table 4 summarizes the signals names, functions, and target connection signals of the standard 20-pin JTAG flat ribbon.
ST-LINK/V2 status LED 灯光状态信号
The LED labeled ‘COM’ on top of the ST-LINK/V2 shows the ST-LINK/V2 status (whatever the connection type). In detail:
- LED is blinking RED: the first USB enumeration with the PC is taking place
- LED is RED: communication between the PC and ST-LINK/V2 is established (end of enumeration)
- LED is blinking GREEN / RED: data being exchanged between the target and the PC
- LED is GREEN: the last communication has been successful
- LED is ORANGE: ST-LINK/V2 communication with the target has failed.
几个重要针脚 1、7、9、20
当板子上没有JTAG接口时,我们可以使用SWD接线方式,以前使用盗版的ST-link时,只需要四根线(SWIO,SWCLK,3V3,GND)就可以轻松实现目标板连接,简单小巧,可谓是嵌入式攻城狮的最爱! 如果板子有独立供电3V3可以不接,这时只需接三根线就能搞定。
但是换成正版的ST-link/V2,还是四线(SWIO,SWCLK,3V3,GND)连接的话,就会出现No target connected的问题。
TVCC Target borad VCC,也就是目标板的VCC。用来监测目标板的信号电平,是5V还是3.3V,从而输出相应的调试电平。
所以我们需要连五根线(SWIO,SWCLK,3V3,GND,TVCC),但有的情况下芯片只有四根引脚,只能使用四根线的话,那么可以将3V3和TVCC连接到一起使用,现在可以尽情的使用速度快、性能稳定的正版下载器了!
13针脚 SWO
见注释 “Optional: for Serial Wire Viewer (SWV) trace.” 这是一个调试相关的针脚。
The ITM interface (short for Instrumentation Trace Macrocell) allows the Tracealyzer recorder library to transmit software-generated trace data via the debug probe, either using the SWO pin (Serial Wire Output) which is supported by the regular I-Jet model, or over the ETM trace port if you have an IAR I-Jet Trace. However, SWO on a regular I-Jet gives more than sufficient speed.
注意 ST-Link目前不支持Tracealyzer的流模式。
接了SWO也没用... ST-LINK的话,暂时只能用快照模式。
ref 《在KEIL中使用ST-Link和Tracealyzer的技巧分享!》 2022-03-22
软件 STM32 ST-LINK Utility
ST 官方出品,童叟无欺。
当出现"找不到 Target"、"Target Fail"或"flash锁住"等等这类问题的时候,可以试着使用此软件进行诊断,可能会收到意想不到的效果。
Reference
- UM1075 ST-LINK/V2 in-circuit debugger/programmer for STM8 and STM32
- PA023-Streaming over Arm ITM (IAR)
- 在KEIL中使用ST-Link和Tracealyzer的技巧分享!
- STM32 ST-LINK Utility
--