完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
首先,我是一个很长时间的微控制器人,从来没有想过我会得到与hdl一样多的东西。
我的帽子是关于Xilinx和工具的。 但我还在学习很多东西。 我现在只用简单的SPI就遇到了问题。 在下面的代码中,当我强制从计算机程序写入时,我可以看到DataToWrite的值在我的逻辑分析器上没有变化。 大多数时候输出是正确的。 但偶尔我会在SPIData流中看到一个应该是'1'的位而不是零。 行为仿真按预期工作,速度很慢(12 MHz SPI时钟) 有一些线索我不明白,但也许其他人有 1)我在使用ISE 11.1时发现了这个问题。 使用它时,写入FFFF会显示一些低位,意外地忽略零。 它们在时间上正确对齐。 只是我期待在那里看到'1'并且看到零。 3)今晚我转到11.4(希望可能解决问题)后,点击为零的位的位置移动到更高位的单个位。 4)如果我将DataToWrite [0]信号路由到外部世界,问题就会消失。 5)使用DataToWrite将工具的输出与外部差异而不是向外部传播并没有发现任何差异。 当信号没有被发送到外部引脚时,我有点希望看到一些东西得到优化,但没有运气。 关于下一步该尝试的任何想法? 该PCB具有5位易于访问的IO,并且没有jtag,因此无法进行32个调试通道。 下一个董事会将有更多。 系统时钟为48 MHz.SPI时钟以12 MHz运行。 ClkDiv4实际上以24 MHz运行。 ClkDiv4由48 MHz时钟驱动的计数器导出。 状态[0]由48 MHz时钟设置/清除。 这是开始写作的指示。 //状态机抽出数据通道@(posedge ClkDiv4)开始大小写(状态)IDLE:如果(Status [0])开始//如果设置,我们需要开始在DataToWrite中传输数据TXBuf SPIClkReg 谢谢你的任何建议。 以上来自于谷歌翻译 以下为原文 First, I'm a long time microcontroller guy, and never thought I'd get as far as I have with hdl. My hat is off to Xilinx and the tools. But I'm still learning a lot. I'm stuck on a problem right now with a simple SPI. In the code below, I can see the value of DataToWrite is not changing on my logic analyzer when I force writes from a computer program. And most of the time the output is correct. But occasionally I'll see a bit that is supposed to be a '1' in the SPIData stream instead be a zero. Behavioral simulation works as expected, and speeds are slow (12 MHz SPI clock) There are a few clues that I don't understand, but perhaps someone else does 1) I discovered the problem when I was using ISE 11.1. When using that, writing FFFF would show some low order bits flicking to zero unexpectedly. They are correctly aligned time wise. It's just I was expecting to see a '1' there and a zero was seen instead. 3) After I moved to 11.4 tonight (hoping that might fix the problem), the location of the bits flicking to zero moved to a single bit in the higher orders. 4) If I route the DataToWrite[0] signal to the outside world, the problem goes away. 5) Diff'ing the output of the tools with DataToWrite going to the outside and not going to the outside didn't reveal any difference. I was kind of hoping to see something get optimized away when the signal wasn't getting routed to an outside pin, but no luck. Any thoughts on what to try next? This PCB has 5 bits of easily accessed IO, and no jtag, so 32 channels of debug isn't possible. Next board will have more. The system clock is 48 MHz. The SPI clock is running at 12 MHz. ClkDiv4 is actually running at 24 MHz. ClkDiv4 is derived by a counter driven by 48 MHz clock. Status[0] is set/cleared by the 48 MHz clock. This is the indication to start writing. // State machine to pump out dataalways @(posedge ClkDiv4)begin case (State) IDLE: begin if (Status[0]) begin // If set, we need to begin transmission of the data in DataToWrite TXBuf <= DataToWrite; State <= TX0; end else begin // Nothing to do SPICSReg <= 1; end endTX0: begin State <= TX1; SPICSReg <= 0; SPIClkReg <= 0;BitCounter <= 6'd32; // Each count is half a cycle, so this will transmit 16 bitsSPIDataReg <= TXBuf[15];TXBuf <= {TXBuf[30:0], 1'b0}; end TX1:begin BitCounter <= BitCounter - 1'b1; if (BitCounter > 0) begin SPIClkReg <= ~SPIClkReg; end else State <= IDLE; // Only change data on falling edge if (SPIClkReg) begin SPIDataReg <= TXBuf[15]; TXBuf <= {TXBuf[30:0], 1'b0}; endenddefault: State <= IDLE; endcaseend// If we don't have this going to the outside world, this doesn't work. Don't know why. What happens is the SPIData signal goes low corrupted at times. // Perhaps there is some optimization going on that isn't clear????assign debug1 = DataToWrite[0]; Thanks for any suggestions. |
|
相关推荐
3个回答
|
|
嗨,
为简单起见,我重构了一些代码: //状态机抽出dataalways @(posedge ClkDiv4)开始大小写(状态)IDLE:开始SPICSReg BitCounter如果(Status [0])开始//如果设置,我们需要开始在DataToWrite中传输数据SPICSReg TXBuf状态结束 结束TX:开始SPIClkReg如果(BitCounter> 0)开始BitCounter状态SPIDataReg TXBuf结束其他开始状态结束TOGGLE_CLOCK:开始SPIClkReg状态结束默认值:状态endcaseend CS在第一个时钟沿之前被置位,时钟切换到自己的状态。 数据移位寄存器现在只有16位宽,因为这只是需要的。 我会添加某种重置状态,以确保在初始化期间没有声明CS。 如果您有5位IO,您可以将状态置于其上(2位)和CS等,您可以使用示波器或逻辑分析仪进行探测。 首先进行一些模拟并阅读综合报告; 他们将报告任何逻辑优化,移位寄存器推断等。 如果仍然没有产生任何线索,请尝试对场所和网络列表进行门级模拟(设置起来可能有点繁琐)。 这应该提供FPGA的确切行为。 干杯, 约翰 以上来自于谷歌翻译 以下为原文 Hi, I refactored the code a bit for simplicity: // State machine to pump out data always @(posedge ClkDiv4) begin case (State) IDLE: begin SPICSReg <= 1; BitCounter <= 15; if (Status[0]) begin // If set, we need to begin transmission of the data in DataToWrite SPICSReg <= 0; TXBuf <= DataToWrite; State <= TX; end end TX: begin SPIClkReg <= 1'b0; if (BitCounter > 0) begin BitCounter <= BitCounter-1; State <= TOGGLE_CLOCK; SPIDataReg <= TXBuf[15]; TXBuf <= {TXBuf[14:0], 1'b0}; end else begin State <= IDLE; end end TOGGLE_CLOCK: begin SPIClkReg <= 1'b1; State <= TX; end default: State <= IDLE; endcase end The CS gets asserted before the first clock edge and the clock toggle its own state. The data shift register is now only 16 bits wide as that is only what's needed. I would add a reset state of some kind to make sure CS is not asserted during initialization. If you have 5 bits of IO, you can put the state on it (2 bits) and CS etc you can probably probe with a scope or logic analyzer. Do some simulations first and read the synthesis reports; they will report any logic optimization, shift register inference etc. If this still doesn't produce any clues, try to do a gatelevel simulation (can be a bit tedious to set up) of the place and outed netlist. That should provide the exact behavior of the FPGA. Cheers, Johan |
|
|
|
嗨约翰,谢谢花时间看这个。
我认为你的BitCounter需要设置为16,是吗? 这大部分时间都有效,但是出现了另一个问题,就像第一个问题一样,我不明白这是怎么回事:时钟会退出,但有时CS永远不会变低。 为了进入TX状态,CSReg也必须设置为低。 似乎不可能。 怎么会发生这种情况? 也许他们的逻辑都被排到了xilinx上的坏块之后,这会导致问题? 这是另一个难题:这块木板是在中国使用匆忙获得的零件制造的,而那些制造它们的人说他无法保证一切都不是伪造的。 我在这里或那里正在考虑一个假冒运算放大器,但是当我在网上看时,似乎确实存在伪造的xilinx部件。 我需要更多地研究这个。 http://www.smttech.com/pdf/Engineered-Blacktop-Material-Analysis-SMT-Corporation-PP-08-27-09.pdf 感谢关于门级仿真的建议。 在我的新奇中,我没有意识到这一点,但我肯定会学习。 我要把这个问题放在次要位置,直到我有更多的主板和对硬件的信心。 非常感谢你的帮助。 以上来自于谷歌翻译 以下为原文 Hi Johan, thanks for taking the time to look at this. I think your BitCounter needed to be set to 16, is that right? This works most of the time, but another problem has shown up, and like the first problem, I don't understand how this is possible: The clocks will clock out, but sometimes the CS never goes low. In order to get into TX state the CSReg must also get set low. Seems impossible. How can this happen?? Perhaps they logic is all getting routed into a bad block on the xilinx and this is causing problems?? Here's another piece to the puzzle: This board was built in China using parts that were obtained in a rush, and the guy that had them built said he couldn't guarantee that everything was not counterfeit. I was thinking a counterfeit op-amp here or there, but as I look on the web it seems that there are indeed counterfeit xilinx parts floating about. I need to study this more. http://www.smttech.com/pdf/Engineered-Blacktop-Material-Analysis-SMT-Corporation-PP-08-27-09.pdf Thanks for the advice on the gate level simulation. In my newness, I wasn't aware of this but I'll definitely study. I'm going to put this problem on the back burner until I have some more boards and confidence in the hardware. Thanks so much for your help. |
|
|
|
当我看到这个部件时,BGA是激光标记的
XC3S400 FT256AFQ0409 D1297924A 4C-ESA ESA指定是否意味着Easypath? 工程样品? 在12/9/2009 Spartan 3数据表中没有提到它。 也许这解释了奇怪的行为? 或者我对FPGA的新见解是更大的罪魁祸首? :) 以上来自于谷歌翻译 以下为原文 As I look at the part, the BGA is laser-marked XC3S400 FT256AFQ0409 D1297924A 4C-ESA Does the ESA designation mean Easypath? Engineering Sample? It's not mentioned in the 12/9/2009 Spartan 3 data sheet. Perhaps that explains the odd behavior? Or is my newness to FPGAs the bigger culprit? :) |
|
|
|
只有小组成员才能发言,加入小组>>
2380 浏览 7 评论
2797 浏览 4 评论
Spartan 3-AN时钟和VHDL让ISE合成时出现错误该怎么办?
2262 浏览 9 评论
3335 浏览 0 评论
如何在RTL或xilinx spartan fpga的约束文件中插入1.56ns延迟缓冲区?
2428 浏览 15 评论
有输入,但是LVDS_25的FPGA内部接收不到数据,为什么?
755浏览 1评论
请问vc707的电源线是如何连接的,我这边可能出现了缺失元件的情况导致无法供电
543浏览 1评论
求一块XILINX开发板KC705,VC707,KC105和KCU1500
365浏览 1评论
1961浏览 0评论
681浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-22 15:04 , Processed in 1.506345 second(s), Total 80, Slave 63 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号