搜索
bottom↓
回复: 5

关于cortex-m3内核流明诺瑞系列芯片的JTAG防止失效 的个人理解,

[复制链接]

出0入0汤圆

发表于 2009-11-28 20:52:10 | 显示全部楼层 |阅读模式
如果在用户代码里面有使用到JTAG仿真器连接的那几个IO(比如将这些接口设置为输出),

则将代码烧入到flash后,上电运行,用户代码的初始化芯片,在连接JTAG仿真器

之前,占用JTAG仿真器连接所需的IO,

就可能导致JTAG仿真器无法和目标芯片建立JTAG连接,这也是最为常见

的JTAG链接失效的原因,

因为此时,JTAG链接失效,不能通过仿真器擦除flash上代码,同时,流明系列芯片不支持

ISP下载代码到芯片flash(特别是1000以下芯片),只能通过专用工具来擦

除flash。


基于此原因:有必要在主函数内初始化目标芯片之前添加防止JTAG失效的

一段代码:

添加代码功能为:复位后(主函数开始执行时)当检测到特定的key信号时,

芯片进入到一个一个无限循环,也就是什么事情都不做(用户代码关于芯片初始化

还未开始执行,此时,IO空闲),等待JTAG仿真器的链接,

无需JTAG连接时,正常复位,直接运行后面的程序。需要JTAG口连接时,按下key进入无

限循环等待JTAG仿真器的连接。

阿莫论坛20周年了!感谢大家的支持与爱护!!

一只鸟敢站在脆弱的枝条上歇脚,它依仗的不是枝条不会断,而是自己有翅膀,会飞。

出0入0汤圆

发表于 2009-11-29 22:21:17 | 显示全部楼层
too complicated.

just add a function during the mcu initialization that will reset the jtag function if a certain key is pushed, and then go into an infinite loop.

if you lock up your jtag, just hold that key while powering up the chip. and then power off.

出0入0汤圆

 楼主| 发表于 2009-12-2 20:21:11 | 显示全部楼层
你说的我不是很明白,添加这段代码的意思是,需要连接JTAG时让单片机上电后先不要初始化操作,以免和JTAG有关的引脚用作他用

出0入0汤圆

发表于 2009-12-4 23:31:38 | 显示全部楼层
the reason for the jtag bug is that if you set up the jtag pins for other uses (other than for jtag) before the communication is established between the jtag and the mcu, you will never be able to debug the chip.

so they are two fixes:

1) intentionally delay the  initialization so that you can establish the link between jtag and the mcu before those pins are used for non-jtag purposes. a long delay (>1s for example) will do that. But that is obviously not very efficient.

2) have your own initialization routine before main() or at begining of main() so that you can revert the jtag pins to their jtage functions. this does not have the boot-up delay of the 1st approach, but if you have accidentally set the jtag pins for other uses you can still restore them.

出0入0汤圆

 楼主| 发表于 2009-12-5 07:52:38 | 显示全部楼层
讲的很透彻,谢谢,

出0入4汤圆

发表于 2009-12-5 08:18:59 | 显示全部楼层
很有用
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-6-17 17:33

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表