转载自:http://www.51hei.com/stm32/4148.html
For my breadboarded test rig, I used a four pin Harwin M20 connector. Even on a half size micromouse, this will not take up much room and I may use it as the only debug/programming connector.
The pins on the 20-pin standard JTAG connector to use are:
Pin 1 – VCC:
This is the traget board Vcc. It is used by the STLINK/V2
Pin 7 – TMS/SWDIO:
The SWD Data signal
Pin 8 – GND:
Be sure there is a common ground
Pin 9 – TCK/SWCLK
The SWD Clock Signal
Pin 15 – nSRST/RESET
System reset – probably optional(你可以不要这个复位pin,直接关电源再上电来复位)
ST-Link/V2
SWD不单单可以下载还可以单步调试,速度比JTAG快。有人问,那为什么要发明JTAG这个20pin的接口呢?因为JTAG标准制定不是为了下载程序调试程序用的 ,它用来做“边界扫描”用的,什么是边界扫描不知道的可以 搜搜一些,在国内谷歌需要翻墙软件才好用。百度搜索专业术语类不好用,最近我发现好多东西搜搜比百度好用不少。