打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
STM32

    Serial Wire Debug(SWD) is a two pin alternative to JTAG and has about the same capabilities except Boundary Scan is not possible.

 

    ST-Link只支持SWD模式,而ST-Link/V2和Jlink同时支持SWD和JTAG模式.

 

参考STM32F100 reference manual第4版(以下简称RM)

 

RM第644页,关于芯片和SWD/JTAG的接口定义如下:

 

SWD模式下如果不接复位引脚,根据http://bbs.21ic.com/icview-127364-1-1.html,需要在MDK仿真器的设置里面不使用硬件复位,而是用system reset或者vect reset,其区别请参考http://www.keil.com/support/man/docs/ulink2/ulink2_ctx_debug.htm

 

SWD/JTAG在Jlink中的接口定义请参考http://www.segger.com/interface-description.html

 

使用SWD模式时,释放的管脚可以通过软件remap的方式成为GPIO使用

 

RM第645页提到:由于STM32的SWD/JTAG自带内部上拉/下拉,所以不需要再接外部电阻

     It is necessary to ensure that the JTAG input pins are not floating since they are directly 

connected to flip-flops to control the debug mode features.To avoid any uncontrolled IO levels, the device embeds internal pull-ups and pull-downs on the JTAG input pins.

但是RM第650页又提到

    For SWDIO bidirectional management, the line must be pulled-up on the board (100 KΩ

recommended by ARM).

    有点confuse,参考MCBSTM32E的原理图http://www.keil.com/mcbstm32exl/mcbstm32e-base-board-schematics.pdf,应该是只有SWDIO需要上拉。

      

      Serial Wire Viewer(SWV): A trace capability providing display of reads, writes, exceptions, PC Samples and printf

      Serial Wire Output(SWO): SWV frames usually come out this one pin output

      参考http://www.opelc.org/html/28/t-5628.html

      Instrumentation Trace Macrocell(ITM)和Serial Wire Output(SWO)可以用来共同构成一个Serial Wire Viewer(SWV)。SWV提供了一种低成本的从MCU获得信息的方法。这个功能目前只在Cortex-M3上测试通过。它这意味着更快的传输速度,并且不会中断程序的执行。

     

     SWD模式支持Trace功能,而JTAG模式不支持。根据RM第661页,Trace的异步模式只需要TRACESWO引脚的支持,而同步模式需要的引脚较多。The asynchronous mode requires 1 extra pin and is available on all packages. It is only available if using Serial Wire mode (not in JTAG mode).

    注1:在keil里需要勾选Enable trace和添加初始化文件才能使用Trace功能,初始化文件主要是配置Trace的使用模式(同步/异步),参考http://www.keil.com/support/man/docs/jlink/jlink_cortextrace.htm和针对STM32的http://www.keil.com/support/man/docs/jlink/jLink_STM32F10xxx_SWT.htm,ETM Trace需要在异步模式下才能Enable

    注2:ST-Link V2及以上的版本才支持SWV/Trace功能

    

   关于Keil MDK的工程配置,可参考位于\Keil\ARM\Boards目录下的官方例程。关于Keil Debug功能的使用,可参考http://www.keil.com/appnotes/files/apnt_230.pdf。根据AN230第10页,使用Logic analyzer功能时,貌似需要先配置SWV。使用逻辑分析仪可以观察的信号是有限制的http://www.keil.com/support/man/docs/uv4/uv4_db_dbg_logicanalyzer_restrictions.htm,选择范围外的信号会出现"unknown signal"的错误。

 

 参考http://www.embedinfo.com/wen-list.asp?id=377

 

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
STM32 在 KEIL 下使用 SWV 输出调试信息
高速USB 2.0的CMSIS-DAP调试器
STM32的JTAG接口硬件设计 – 瑞生网
ARM基础教程 | ARM Cortex-M的调试和跟踪技术
[话说嵌入式]不用串口我也能打日志之STM32 ITM
STM32板的晶振不起振,怎么办?
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服