📄 jtag口及其对flash的在线编程.htm
字号:
href="http://www.lunwenwang.com/Freepaper/Technicalpaper/Index.html">理工论文</A> >> <A
class=LinkPath
href="http://www.lunwenwang.com/Freepaper/Technicalpaper/communications/Index.html">电子通信网络论文</A> >> 论文正文</DIV>
<DIV id=ArticleTitle>
<H1>JTAG口及其对Flash的在线编程</H1></DIV>
<DIV class=info>更新时间 2006-8-23 19:46:10 <A
title=收藏的网页将被永久地保存到新浪ViVi收藏夹http://vivi.sina.com.cn
href="javascript:d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(vivi=window.open('http://vivi.sina.com.cn/collect/icollect.php?pid=2008&title='+escape(d.title)+'&url='+escape(d.location.href)+'&desc='+escape(t),'vivi','scrollbars=no,width=480,height=480,left=75,top=20,status=no,resizable=yes'));vivi.focus();"><IMG
src="JTAG口及其对Flash的在线编程.files/vivi_coop1.gif" align=absMiddle border=0></A> <A
href="http://www.lunwenwang.com/Article/Print.asp?ArticleID=4474"
target=_blank>打印此文</A> 点击数
<SCRIPT language=javascript src="JTAG口及其对Flash的在线编程.files/GetHits.htm"></SCRIPT>
</DIV>
<DIV class=content>
<DIV class=ggad>
<SCRIPT language=javascript src=""></SCRIPT>
</DIV>摘要:通过JTAG实现对Flash在线编程。首先,介绍JTAG的定义、结构及引脚的定义,并阐述JTAG状态机的工作原理。然后,介绍JTAG口的边界扫描寄存器,给出实现JTAG在线写Flash的电路,和如何通过JTAG实现Flash的编程及程序流程图。
<P <B>关键词:</B>JTAG Flash 在线编程</P>
<P>随着嵌入式技术的发展,在一些高端的掌上设备中,都使用了Flash芯片,如Compaq的iPAQ、联想的天祺系列等产品。但对于研发人员来说,在开发阶段需要大量的程序调试,就意味着要对Flash进行擦除和改写的工作,因此,如何对Flash进行在线编程是问题的关键所在。本文介绍一种通过JTAG对Flash进行的在线编程方法。</P>
<P><B>1 JTAG简介</B></P>
<P>JTAG(Joint Test Action
Group)是1985年制定的检测PCB和IC芯片的一个标准,1990年被修改后成为IEEE的一个标准,即IEEE1149.1-1990。通过这个标准,可对具有JTAG口芯片的硬件电路进行边界扫描和故障检测。<BR><BR><B><FONT
color=#0000ff>图1 TAP控制器的状态机框图</FONT></B><BR><BR>具有JTAG口的芯片都有如下JTAG引脚定义:</P>
<P>TCK——测试时钟输入;</P>
<P>TDI——测试数据输入,数据通过TDI输入JTAG口;</P>
<P>TDO——测试数据输出,数据通过TDO从JTAG口输出;</P>
<P>TMS——测试模式选择,TMS用来设置JTAG口处于某种特定的测试模式。</P>
<P>可选引脚TRST——测试复位,输入引脚,低电平有效。</P>
<P>含有JTAG口的芯片种类较多,如CPU、DSP、CPLD等。</P>
<P>JTAG内部有一个状态机,称为TAP控制器。TAP控制器的状态机通过TCK和TMS进行状态的改变,实现数据和指令的输入。图1为TAP控制器的状态机框图。<BR><IMG
onmousewheel="return bbimg(this)" onclick=ImgClick(this) height=466 hspace=45
src="" width=462 vspace=10 border=0 resized="0"><BR><B>2 JTAG芯片的边界扫描寄存器</B></P>
<P>JTAG标准定义了一个串行的移位寄存器。寄存器的每一个单元分配给IC芯片的相应引脚,每一个独立的单元称为BSC(Boundary-Scan
Cell)边界扫描单元。这个串联的BSC在IC内部构成JTAG回路,所有的BSR(Boundary-Scan
Register)边界扫描寄存器通过JTAG测试激活,平时这些引脚保持正常的IC功能。图2为具有JTAG口的IC内部BSR单元与引脚的关系。</P>
<P><B>3 JTAG在线写Flash的硬件电路设计和与PC的连接方式</B></P>
<P>以含JTAG接口的StrongARM SA1110为例,Flash为Intel 28F128J32
16MB容量。SA1110的JTAG的TCK、TDI、TMS、TDO分别接PC并口的2、3、4、11线上,通过程序将对JTAG口的控制指令和目标代码从PC的并口写入JTAG的BSR中。在设计PCB时,必须将SA1110的数据线和地址线及控制线与Flash的地线线、数据线和控制线相连。因SA1110的数据线、地址线及控制线的引脚上都有其相应BSC,只要用JTAG指令将数据、地址及控制信号送到其BSC中,就可通过BSC对应的引脚将信号送给Flash,实现对Flash的操作。JTAG的系统板设计和连线关系如图3所示。</P>
<P><B>4 通过使用TAP状态机的指令实行对Flash的操作</B></P>
<P>通过TCK、TMS的设置,可将JTAG设置为接收指令或数据状态。JTAG常用指令如下:</P>
<P>SAMPLE/PRELOAD——用此指令采样BSC内容或将数据写入BSC单元;</P>
<P>EXTEST——当执行此指令时,BSC的内容通过引脚送到其连接的相应芯片的引脚,我们就是通过这种指令实现在线写Flash的;</P>
<P>BYPASS——此指令将一个一位寄存器轩于BSC的移位回路中,即仅有一个一位寄存器处于TDI和TDO之间。</P>
<P>在PCB电路设计好后,即可用程序先将对JTAG的控制指令,通过TDI送入JTAG控制器的指令寄存器中。再通过TDI将要写Flash的地址、数据及控制线信号入BSR中,并将数据锁存到BSC中,用EXTEST指令通过BSC将写入Flash。<BR><IMG
onmousewheel="return bbimg(this)" onclick=ImgClick(this) height=249 hspace=10
src="" width=549 vspace=10 border=0 resized="0"><BR><B>5 软件编程</B></P>
<P>在线写Flash的程序用Turbo
C编写。程序使用PC的并行口,将程序通过含有JTAG的芯片写入Flash芯片。程序先对PC的并口初始化,对JTAG口复位和测试,并读Flash,判断是否加锁。如加锁,必须先解锁,方可进行操作。写Flash之前,必须对其先擦除。将JTAG芯片设置在EXTEST模式,通过PC的并口,将目标文件通过JTAG写入Flash,并在烧写完成后进行校验。程序主流程如图4所示。</P>
<P>通过JTAG的读芯片ID子程序如下:</P>
<P>void id_command(void){</P>
<P>putp(1,0,IP); //Run-Test/Idle;使JTAG复位</P>
<P>putp(1,0,IP); //Run-Test/Idle</P>
<P>putp(1,0,IP); //Run-Test/Idle</P>
<P>putp(1,0,IP); //Run-Test/Idle</P>
<P>putp(1,1,IP);</P>
<P>putp(1,1,IP); //选择指令寄存器</P>
<P>putp(1,0,IP); //捕获指令寄存器</P>
<P>putp(1,0,IP); /移位指令寄存器</P>
<P>putp(0,0,IP); //SA1110JTAG口指令长度5位,IDCODE为01100</P>
<P>putp(1,0,IP);</P>
<P>putp(1,0,IP);</P>
<P>pu</P>
<P align=center><B><FONT color=red>[1]</FONT> <A
href="http://www.lunwenwang.com/Freepaper/Technicalpaper/communications/200608/Freepaper_4474_2.html">[2]</A> <A
href="http://www.lunwenwang.com/Freepaper/Technicalpaper/communications/200608/Freepaper_4474_2.html">下一页</A>
</B></P></DIV></DIV>
<DIV id=mcright>
<DIV class=adr300x300>
<SCRIPT language=javascript src=""></SCRIPT>
</DIV>
<DIV id=se2>
<DIV id=secon>
<FORM name=search action=/search.asp target=_blank><INPUT type=hidden
value=Title name=Field> <INPUT size=14 name=Keyword> <INPUT class=seinput type=submit value=" 搜 索 "> <INPUT type=radio CHECKED
name=stype>论文 <INPUT type=radio name=stype>期刊<BR>
<DIV class=sehot><B>热门搜索</B></DIV>
<DIV class=sehotr2><A
href="http://www.baidu.com/s?wd=%C2%DB%CE%C4&cl=3&bar=&tn=lunwenwang"
target=_blank>论文</A> <A
href="http://www.baidu.com/s?wd=%C2%DB%CE%C4%CD%F8&lm=0&si=&rn=10&tn=lunwenwang&ie=gb2312&ct=0&cl=3&f=1&rsp=0"
target=_blank>论文网</A> <A
href="http://www.baidu.com/s?wd=%C2%DB%CE%C4%CD%F8%D4%DA%CF%DF&cl=3&bar=&tn=lunwenwang"
target=_blank>论文网在线</A> <A
href="http://www.baidu.com/s?tn=lunwenwang&ie=gb2312&bs=%C2%DB%CE%C4%CD%F8%D4%DA%CF%DF&sr=&z=&cl=3&f=8&wd=%D6%B0%B3%C6%C2%DB%CE%C4&ct=0"
target=_blank>职称论文</A> </DIV></FORM></DIV></DIV>
<DIV class=adr300x120>
<SCRIPT language=javascript src=""></SCRIPT>
</DIV>
<DIV class="title titlet">最新文章</DIV>
<DIV class=con> <A class="" title=我国手机报纸发展现状及前景分析
href="http://www.lunwenwang.com/Freepaper/Technicalpaper/communications/200609/Freepaper_30231.html"
target=_blank>我国手机报纸发展现状及前景分析</A><BR> <A class="" title=确保信号完整性的电路板设计准则
href="http://www.lunwenwang.com/Freepaper/Technicalpaper/communications/200608/Freepaper_6308.html"
target=_blank>确保信号完整性的电路板设计准则</A><BR> <A class="" title=PCB设计中的注意事项
href="http://www.lunwenwang.com/Freepaper/Technicalpaper/communications/200608/Freepaper_6307.html"
target=_blank>PCB设计中的注意事项</A><BR> <A class="" title=Protel软件在高频电路布线中的技巧
href="http://www.lunwenwang.com/Freepaper/Technicalpaper/communications/200608/Freepaper_6306.html"
target=_blank>Protel软件在高频电路布线中的技巧</A><BR> <A class=""
title=基于FPGA的四阶IIR数字滤波器
href="http://www.lunwenwang.com/Freepaper/Technicalpaper/communications/200608/Freepaper_6305.html"
target=_blank>基于FPGA的四阶IIR数字滤波器</A><BR> <A class="" title=智能延迟触发产生器的设计
href="http://www.lunwenwang.com/Freepaper/Technicalpaper/communications/200608/Freepaper_6304.html"
target=_blank>智能延迟触发产生器的设计</A><BR> <A class=""
title=基于数字移相的高精度脉宽测量系统及其FPGA实现
href="http://www.lunwenwang.com/Freepaper/Technicalpaper/communications/200608/Freepaper_6303.html"
target=_blank>基于数字移相的高精度脉宽测量系统及其FPGA实现</A><BR> <A class=""
title=数值计算中Bcd码校验电路的分析与设计
href="http://www.lunwenwang.com/Freepaper/Technicalpaper/communications/200608/Freepaper_6302.html"
target=_blank>数值计算中Bcd码校验电路的分析与设计</A><BR> <A class="" title=智能全数字锁相环的设计
href="http://www.lunwenwang.com/Freepaper/Technicalpaper/communications/200608/Freepaper_6301.html"
target=_blank>智能全数字锁相环的设计</A><BR> <A class="" title=基于CPLD/FPGA的出租车计费器
href="http://www.lunwenwang.com/Freepaper/Technicalpaper/communications/200608/Freepaper_6300.html"
target=_blank>基于CPLD/FPGA的出租车计费器</A><BR></DIV>
<DIV class="title titlet">热门文章</DIV>
<DIV class=con> <A class="" title=我国手机报纸发展现状及前景分析
href="http://www.lunwenwang.com/Freepaper/Technicalpaper/communications/200609/Freepaper_30231.html"
target=_blank>我国手机报纸发展现状及前景分析</A><BR> <A class="" title=确保信号完整性的电路板设计准则
href="http://www.lunwenwang.com/Freepaper/Technicalpaper/communications/200608/Freepaper_6308.html"
target=_blank>确保信号完整性的电路板设计准则</A><BR> <A class="" title=PCB设计中的注意事项
href="http://www.lunwenwang.com/Freepaper/Technicalpaper/communications/200608/Freepaper_6307.html"
target=_blank>PCB设计中的注意事项</A><BR> <A class="" title=Protel软件在高频电路布线中的技巧
href="http://www.lunwenwang.com/Freepaper/Technicalpaper/communications/200608/Freepaper_6306.html"
target=_blank>Protel软件在高频电路布线中的技巧</A><BR> <A class=""
title=基于FPGA的四阶IIR数字滤波器
href="http://www.lunwenwang.com/Freepaper/Technicalpaper/communications/200608/Freepaper_6305.html"
target=_blank>基于FPGA的四阶IIR数字滤波器</A><BR> <A class="" title=智能延迟触发产生器的设计
href="http://www.lunwenwang.com/Freepaper/Technicalpaper/communications/200608/Freepaper_6304.html"
target=_blank>智能延迟触发产生器的设计</A><BR> <A class=""
title=基于数字移相的高精度脉宽测量系统及其FPGA实现
href="http://www.lunwenwang.com/Freepaper/Technicalpaper/communications/200608/Freepaper_6303.html"
target=_blank>基于数字移相的高精度脉宽测量系统及其FPGA实现</A><BR> <A class=""
title=数值计算中Bcd码校验电路的分析与设计
href="http://www.lunwenwang.com/Freepaper/Technicalpaper/communications/200608/Freepaper_6302.html"
target=_blank>数值计算中Bcd码校验电路的分析与设计</A><BR> <A class="" title=智能全数字锁相环的设计
href="http://www.lunwenwang.com/Freepaper/Technicalpaper/communications/200608/Freepaper_6301.html"
target=_blank>智能全数字锁相环的设计</A><BR> <A class="" title=基于CPLD/FPGA的出租车计费器
href="http://www.lunwenwang.com/Freepaper/Technicalpaper/communications/200608/Freepaper_6300.html"
target=_blank>基于CPLD/FPGA的出租车计费器</A><BR></DIV>
<DIV class="title titlet">相关文章</DIV>
<DIV class=con><A class=LinkArticleCorrelative
title="文章标题:FTA:我国参与区域经济合作的新途径 作 者:佚名 更新时间:2006-8-23 17:21:27"
href="http://www.lunwenwang.com/Freepaper/Economicalpaper/internationaltrade/200608/Freepaper_2191.html"
target=_blank>FTA:我国参与区域经济合作的新途径</A><BR><A class=LinkArticleCorrelative
title="文章标题:ObjectARX环境下的结构建模系统的开发 作 者:佚名 更新时间:2006-8-23 19:02:30"
href="http://www.lunwenwang.com/Freepaper/Technicalpaper/information/200608/Freepaper_2902.html"
target=_blank>ObjectARX环境下的结构建模系统的开发</A><BR><A class=LinkArticleCorrelative
title="文章标题:betacam-sx与视频广播的数字化进程 作 者:佚名 更新时间:2006-8-23 19:05:52"
href="http://www.lunwenwang.com/Freepaper/Technicalpaper/information/200608/Freepaper_2984.html"
target=_blank>betacam-sx与视频广播的数字化进程</A><BR><A class=LinkArticleCorrelative
title="文章标题:Magic DaVE 4A 数字特技切换台的功能及一些实用技巧 作 者:佚名 更新时间:2006-8-23 19:06:02"
href="http://www.lunwenwang.com/Freepaper/Technicalpaper/information/200608/Freepaper_2985.html"
target=_blank>Magic DaVE 4A 数字特技切换台的功能及一些实用技</A><BR><A
class=LinkArticleCorrelative
title="文章标题:Magic DaVE 4A 数字特技切换台的功能及一些实用技巧1999 作 者:佚名 更新时间:2006-8-23 19:06:07"
href="http://www.lunwenwang.com/Freepaper/Technicalpaper/information/200608/Freepaper_2986.html"
target=_blank>Magic DaVE 4A 数字特技切换台的功能及一些实用技</A><BR><A
class=LinkArticleCorrelative
title="文章标题:Oracle Portal及其门户网站开发概述 作 者:佚名 更新时间:2006-8-23 19:28:21"
href="http://www.lunwenwang.com/Freepaper/Technicalpaper/information/200608/Freepaper_3440.html"
target=_blank>Oracle Portal及其门户网站开发概述</A><BR><A
class=LinkArticleCorrelative
title="文章标题:超级推播技术与TargetLink软件包
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -