完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
嘿,我正在开发一个小代码,它是大型项目的一部分,需要使用串口与计算机通信。
我正在使用Digilent Genesys板,Virtex 5,我正在使用XST进行合成。 这是我与Xilinx的第一个项目(我来自Altera和Actel),所以我可能正在做/配置错误...... 所以,代码是这样的,我有一个串行接收器8bfifo 8级和串行输出。 我使用的波特率是115.2kbps。 它不是最优化的代码,我知道... FSM有9个状态,但它是一个快速测试,我认为它应该可以工作。 会发生的是,如果我将串行输入直接连接到串行输出,一切正常,但是,当我把FIFO放在两者的中间时,它不起作用,我没有收到正确的数据(我有 UART接收器输出上的LED)。 所以,这里有代码的重要部分:(newData是接收到8b时为1个Tbaud的信号。) U0:波特率端口映射(clk,baud); U1:uartTX端口映射(波特,newData,dataToPC,结束,txOut); U2:uartRX端口映射(波特,Rs1Rx,dataFromPC,newData); --U3:startGen端口映射(clk,start,x“0001”,x“FFFA”); --U4:FIFO端口映射(baud,newData,dataFromPC,dataToPC); dataToPC 在这里你可以看到它是如何工作的(粉红色是我发送的,黑色是我在PC端收到的) 这是代码,当它不起作用时: U0:波特率端口映射(clk,baud); U1:uartTX端口映射(波特,newData,dataToPC,结束,txOut); U2:uartRX端口映射(波特,Rs1Rx,dataFromPC,newData); --U3:startGen端口映射(clk,start,x“0001”,x“FFFA”); U4:FIFO端口映射(baud,newData,dataFromPC,dataToPC); --dataToPC 至于FIFO代码: 处理(ICLK,enFIFO) 开始 如果iclk'event和iclk ='1'则 如果enFIFO ='1'那么 fifor 在这里,我得到的截图: 怎么了? 我配置错了吗? 为什么我连接它不起作用? 我可以期待前8个数据输入中的一些随机内容,因为我没有重置位,但是没有重置... 我只有一个警告,即结束的信号没有做任何事情。 我还添加了整个事物的vhdl代码...... 谢谢! 塞尔吉 UARTnew.rar 4 KB 以上来自于谷歌翻译 以下为原文 Hey, I'm developing a small code, that is part of larger project, that needs to comunicate with the computer using serial. I'm using a Digilent Genesys board, Virtex 5, and I'm using XST for synthesis. It is my first project with Xilinx (I come from Altera and Actel) , so I might be doing/configuring something wrong... So, the code goes like this, I've a serial receiver a 8bfifo with 8 stages and a serial out. The baud rate I'm using is 115.2kbps. It is not the most optimized code, I know... FSM with 9 states, but it was a quick test , and I think it should work anyways. What happens is that, if I connect the serial input to the serial output directly, everything works, however, when I put the FIFO in the middle of the two, it does not work, I don't receive the right data (I have LEDs on the output of the UART receiver). So, here you have the significant parts of the code when it works: (newData is a signal that is 1 one Tbaud when 8b are received.) U0: baudrate port map(clk,baud);U1: uartTX port map(baud,newData,dataToPC,ended,txOut);U2: uartRX port map(baud,Rs1Rx,dataFromPC,newData);--U3: startGen port map(clk,start,x"0001",x"FFFA");--U4: FIFO port map(baud,newData,dataFromPC,dataToPC);dataToPC <= dataFromPC;Here you can see how is working (pink is what I send, black what I receive in the PC side) An here is the code when it does not work: U0: baudrate port map(clk,baud);U1: uartTX port map(baud,newData,dataToPC,ended,txOut);U2: uartRX port map(baud,Rs1Rx,dataFromPC,newData);--U3: startGen port map(clk,start,x"0001",x"FFFA");U4: FIFO port map(baud,newData,dataFromPC,dataToPC);--dataToPC <= dataFromPC; As for the FIFO code: process(iclk,enFIFO)beginif iclk'event and iclk='1' thenif enFIFO = '1' thenfifor <= fifor(55 downto 0) & iData;elsefifor <= fifor;end if;elsefifor <= fifor;end if;end process;oData <= fifor(63 downto 56); Here, a screenshot of what I get: What's wrong? Am I configuring something wrong? Why when I connect it does not work? I could expect some random stuff in the first 8 data inputs, since I don't reset the bits, but not after... I only have one warning which is that the ended signal is not doing anything. I also added the vhdl code of the whole thing... Thanks! Sergi UARTnew.rar 4 KB |
|
相关推荐
4个回答
|
|
我没有解压缩整个项目存档,但我确实注意到你的一个代码片段中的一些内容,其中没有一个是你问题的可能原因 -
处理(ICLK,enFIFO) //在时钟进程中,只有时钟和异步设置/重置属于灵敏度listbegin如果iclk'event和iclk ='1'然后如果enFIFO ='1'则则其他地方//不必要的fifor结束if; 否则//不必要的fifor结束if; end process; ODATA - 鲍勃埃尔金德 签名:新手的自述文件在这里:http://forums.xilinx.com/t5/New-Users-Forum/README-first-Help-for-new-users/td-p/219369总结:1。 阅读手册或用户指南。 你读过手册了吗? 你能找到手册吗?2。 搜索论坛(并搜索网页)以寻找类似的主题。 不要在多个论坛上发布相同的问题。 不要在别人的主题上发布新主题或问题,开始新的主题!5。 学生:复制代码与学习设计不同.6“它不起作用”不是一个可以回答的问题。 提供有用的详细信息(请与网页,数据表链接).7。 您的代码中的评论不需要支付额外费用。 我没有支付论坛帖子的费用。 如果我写一篇好文章,那么我一无所获。 以上来自于谷歌翻译 以下为原文 I did not unpack your whole-project archive, but I did notice a few things in one of your code snippets, none of which is the likely cause of your problem -- process(iclk, // in clocked process, only clock and async set/reset belong in sensitivity list begin if iclk'event and iclk='1' then if enFIFO = '1' then fifor <= fifor(55 downto 0) & iData; else // unnecessary fifor <= fifor; end if; else // unnecessary fifor <= fifor; end if; end process; oData <= fifor(63 downto 56); -- Bob Elkind SIGNATURE: README for newbies is here: http://forums.xilinx.com/t5/New-Users-Forum/README-first-Help-for-new-users/td-p/219369 Summary: 1. Read the manual or user guide. Have you read the manual? Can you find the manual? 2. Search the forums (and search the web) for similar topics. 3. Do not post the same question on multiple forums. 4. Do not post a new topic or question on someone else's thread, start a new thread! 5. Students: Copying code is not the same as learning to design. 6 "It does not work" is not a question which can be answered. Provide useful details (with webpage, datasheet links, please). 7. You are not charged extra fees for comments in your code. 8. I am not paid for forum posts. If I write a good post, then I have been good for nothing. |
|
|
|
嗨Sergi,
你的FIFO是冒名顶替者! 它只是一个简单的批量移位寄存器,但根本没有FIFO。 那么,计时怎么样? 我看到clk信号进入波特率模块,但没有其他地方。 但是对于如此低的频率,我怀疑波特率是否有一些正确驱动时钟网络的DCM。 在综合报告中是否有关于(ab)使用正常路由资源进行计时的警告? 如果是这样:非常糟糕的设计实践。 现在请告诉我,你为什么要重新发明轮子? Picoblaze资源中提供了包括工作FIFO在内的小型uart。 可靠的代码,适用于数千个应用程序。 使用它们。 节省您的时间进行更重要的工作。 另外,请避免在实例化端口映射中使用位置分配。 使用命名分配。 虽然它可能会使用更多的代码行,但它更不容易出错 有一个很好的综合 Eilert 以上来自于谷歌翻译 以下为原文 Hi Sergi, your FIFO is an impostor! It's just a simple bulk shift register, but no FIFO at all. Also, what about the clocking? I see the clk signal going into the baudrate module, but nowhere else. But for such a low frequency I doubt that baudrate has some DCM in it that properly drives a clock net. Is there some warning in the synthesis report about (ab)using normal routing ressources for clocking purposes? If so: Very bad design practice. Now tell me please, why are you reinventing the wheel? Such small uarts including working FIFOs are available in the Picoblaze ressources. Reliable code that works in thousands of applications. Use them. Save your time for more important work. Also, please abstain from using positional assignment in instantiation port maps. Use named assignments. while it might use some more code lines it is much less error prone Have a nice synthesis Eilert |
|
|
|
@ eteam00:我只是改变它......没什么...... @ eilert:没有警告......一切都好。
关于重新发明轮子,你是对的,我有一个SPI的代码,虽然我很容易为UART更改它,但我没想到它。 我现在要检查一下。 至于FIFO,是的,我知道它是移位寄存器......但是......先进先出没有? :P 以上来自于谷歌翻译 以下为原文 @eteam00 : I just change it... nothing.... @eilert: No warnings... Everything is OK. About reinventing the wheel, you're right, I had a code for SPI and I though I would be easy to change it for a UART, I didn't think about it. I'm going to check it now. As for the FIFO, yes, I know it is shift register... but... First In First Out no? :P |
|
|
|
嗨,
不,FIFO和Shiftreg不是一回事。 Shiftreg不仅仅是一个时钟延迟。 虽然您已经使用了一些启用信号来控制写入,但读取不受控制且不可预测。 什么告诉读数方数据有效? 此外,如果您的Shiftreg具有深度N并且您只发送一条N-1长度的消息,那么您的系统将永远不会得到它。 另一方面,FIFO不仅通过一些标志告诉双方其内部状态(写入侧的满标志,以避免覆盖。空标志指示何时(否)数据存在于读取侧) 此外,即使只有一个字写入FIFO,也可以由读取侧主动读出。 因此系统始终有机会访问每个接收到的数据字。 至于SPI-IP,使用该代码作为UART的基础可能比从头开始编写新内容更有用。 SPI是一种同步协议,因此与UART有很大不同。 再次: 在Picoblaze资源中,UART和FIFO有一些很好的可靠IP。 有一个很好的综合 Eilert 以上来自于谷歌翻译 以下为原文 Hi, no, FIFO and Shiftreg are not the same thing. A Shiftreg is not much more but a clocked delay. While you have used some Enable signal to controll writing into it, the reading happens uncontrolled and unpredictable. What tells the reading side when data is valid? Also, if your Shiftreg has the deepth N and you are just sending a single N-1 length message, your system will never get it. A FIFO on the other hand, not only tells both sides about its internal state by some Flags (Full Flag to the writing side, to avoid overwriting. Empty Flag to indicate when (no) data is present to the reading side) Also, even if just a single word is written to the FIFO, it can be actively read out by the reading side. So the system always has a chance to access every received dataword. As for the SPI-IP, using that code as a base for a UART probably makes even more work than writing something new from scratch. SPI is a synchronous protocol and therefore differs a lot from a UART. Again: There's some nice reliable IP for UART and FIFO in the Picoblaze ressources. Have a nice synthesis Eilert |
|
|
|
只有小组成员才能发言,加入小组>>
2414 浏览 7 评论
2821 浏览 4 评论
Spartan 3-AN时钟和VHDL让ISE合成时出现错误该怎么办?
2292 浏览 9 评论
3371 浏览 0 评论
如何在RTL或xilinx spartan fpga的约束文件中插入1.56ns延迟缓冲区?
2456 浏览 15 评论
有输入,但是LVDS_25的FPGA内部接收不到数据,为什么?
1043浏览 1评论
请问vc707的电源线是如何连接的,我这边可能出现了缺失元件的情况导致无法供电
577浏览 1评论
求一块XILINX开发板KC705,VC707,KC105和KCU1500
434浏览 1评论
1998浏览 0评论
721浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-18 23:06 , Processed in 1.484089 second(s), Total 84, Slave 68 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号