我正在研究 XUPV5-LX110T,我正在尝试通过 JTAG 读取状态寄存器。我得到的数据不正确,但我不明白为什么。我似乎得到了全零。
我怀疑它与 JTAG 链的顺序有关,但我不确定我应该如何调整我发送的命令的顺序。
我知道 TMS 坑会改变链上所有设备的状态,但是当它是链上的最后一个设备时,如何将数据转移到 FPGA?
我实际上在同一台设备上工作过。如果我是正确的,当您查看 iMPACT 中的 JTAG 链时,您应该看到 5 个设备:两个 PROM、一个 SystemAce 和一个 CPLD,然后是 Virtex 5 作为链上的最后一项。像这样:
PROM -> PROM -> SysAce -> CPLD -> Virtex5
为了成功读取状态寄存器,您需要了解 TAP 控制器的工作原理:
(来源:fpga4fun.com)
就像你说的,TMS 信号连接到 JTAG 链上的所有设备。也就是说,如果您处于 Test-Logic-Reset 状态并发送 0 1 1 0 0,那么所有设备现在都将处于 Shift-DR 状态。
接下来,您将想知道 JTAG 链上器件的所有指令寄存器的大小。在这种情况下,两个 PROM 的 IR 大小为 16 位。SysAce 和 CPLD 的 IR 大小为 8 位。您想知道这些大小,以便知道要向下传输多少数据。Virtex 5 的 IR 大小为 10 位。
使用 JTAG 的最后一个技巧是注意在发送命令时,它们在 TDI LSB-first 上传输。但是,将数据移入 DR 是 MSB 优先的。确保在Virtex 5 配置指南中检查哪种方式是哪种方式
有了这些信息,您可以像下面的伪代码一样读取状态寄存器:
unsigned int read_status_register {
reset JTAG to Test-Logic-Reset by sending five 1s on TMS
go into Shift-IR state
// The order of this depends on your JTAG chain
Send CONFIG_IN on TDI (these 10 bits will eventuall get pushed to the Virtex 5's IR)
Send eight 1's to put the CPLD in BYPASS
Send eight 1's to put the SysAce in BYPASS
Send sixteen 1s to put the next PROM in bypass
Send fifteen 1s to put the last PROM in bypass
// As described in the configuration guide
Send the last 1 on TDI while transitioning from Shift-IR to the Exit state
Transition back to Test-Logic-Reset
Transition to Shift-DR
Shift in the command sequence (sync word, noop, read_status, noop, noop)
Shift in 3 bits to push the command sequence past the other devices on the chain
Shift in 1 more bit while transitioning to exit
Transition to Shift-IR
Shift in CONFIG_OUT
Shift in 1's to put all devices in BYPASS like we did above
Transition to Shift-DR
Shift out 32-bits and save the data coming from TDO
// Note that we can stop here because the FPGA is the last device
// on the chain. Otherwise, you may need to shift in a couple of bits
// to push the data past other devices on the chain
}
如您所见,基本上都是关于进行正确的状态转换,并知道发送内容的顺序。祝你好运!