完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
先生:
我在sparatan-6 LX75T中实现了I2C写入和读取。 但我遇到了一些奇怪的错误。 I2C写入的模拟是可以的,当我将位文件下载到FPGA时,chipcope还显示sda_in,sda_out,sda_en,scl_in,scl_out,scl_en的逻辑也在我的逻辑下运行。 但是当我用示波器查看信号时,SCL线上没有信号,SDA线上的信号是错误的。 只有当我将IO缓冲区更改为Obuffer(只使用逻辑的sda_out,scl_out)时,SDA和SCL线上的写操作信号才是正确的。 这个错误的可能原因是什么? 谢谢 问候 张学友 二零一四年一月三十日 以上来自于谷歌翻译 以下为原文 Sir: I implement a I2C write and read in sparatan-6 LX75T. But I meet some strangeous errors. The simulation of I2C write is OK, and when I download the bit file to FPGA, the chipscope also show that the logic of sda_in, sda_out, sda_en, scl_in, scl_out, scl_en are also running under my logic. But when I peek the signal with oscilloscope, there are no signal on SCL line, and the signal on SDA line is wrong. Only when I change the IO-buffer to a Obuffer(just use the sda_out, scl_out of the logic), the signal of write operation on SDA and SCL lines are right. What's the possible reason for this error? Thank you Regards Jacky 2014-01-30 |
|
相关推荐
14个回答
|
|
嗨,
IIC是双向低速协议。 因此SDA / SCL通常在IOB中实现。 因此,当FPGA驱动器中实现I2C控制器时,当sda_t使能时,输出将在sda_o上显示。 sda_t是一个控制信号,它将IOB配置为输出。 --HS -------------------------------------------------- --------------------------------------------请注意 - 请注明 如果提供的信息有用,请回答“接受为解决方案”。给予您认为有用并回复导向的帖子。感谢K-- -------------------------------------------------- --------------------- 以上来自于谷歌翻译 以下为原文 Hi, The IIC is a bi-directional low speed protocol. So the SDA/SCL are usually implemented in IOB's. So when the I2C controller is implemented in FPGA is driving, the output will be seen on sda_o when sda_t is enabled. sda_t is a control signal that configures the IOB as an output. --HS ---------------------------------------------------------------------------------------------- Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful. Give Kudos to a post which you think is helpful and reply oriented. ---------------------------------------------------------------------------------------------- |
|
|
|
I2C“驱动”为漏极开路,需要电路板上的外部上拉电阻。
你在电路板上使用什么价值的上拉? - 鲍勃埃尔金德 签名:新手的自述文件在这里:http://forums.xilinx.com/t5/New-Users-Forum/README-first-Help-for-new-users/td-p/219369总结:1。 阅读手册或用户指南。 你读过手册了吗? 你能找到手册吗?2。 搜索论坛(并搜索网页)以寻找类似的主题。 不要在多个论坛上发布相同的问题。 不要在别人的主题上发布新主题或问题,开始新的主题!5。 学生:复制代码与学习设计不同.6“它不起作用”不是一个可以回答的问题。 提供有用的详细信息(请与网页,数据表链接).7。 您的代码中的评论不需要支付额外费用。 我没有支付论坛帖子的费用。 如果我写一篇好文章,那么我一无所获。 以上来自于谷歌翻译 以下为原文 I2C "drive" is open-drain, and requires external pullup resistors on the board. What value pullup Rs do you use on your circuit board? -- 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. |
|
|
|
嗨鲍勃:
感谢您的回复。 在进行设计时我犯了一个错误,我忘了连接SDA和SCL线上的上拉电阻。 但我在ucf中使用PULLUP约束。 SDA和SCL的文件。 这可以吗? 谢谢 问候 张学友 2014年2月4日 以上来自于谷歌翻译 以下为原文 Hi Bob: Thanks for your reply. I make a mistake when make the design, in which I forget to connect the pullup resistors on SDA and SCL line. But I use the the PULLUP constraints in ucf. file for SDA and SCL. Is that OK? Thanks Regards Jacky 2014-02-04 |
|
|
|
内部弱上拉很弱,很可能对于典型的I2C工作频率而言太弱。
对于SDA信号,您很可能希望在电路板上添加1K - 10K值上拉。 对于SCL信号,您有两种选择: 如果I2C通道允许I2C从器件进行时钟延长,则添加上拉。 如果不允许时钟延长,则使用推挽输出驱动(而不是开漏)。 - 鲍勃埃尔金德 签名:新手的自述文件在这里:http://forums.xilinx.com/t5/New-Users-Forum/README-first-Help-for-new-users/td-p/219369总结:1。 阅读手册或用户指南。 你读过手册了吗? 你能找到手册吗?2。 搜索论坛(并搜索网页)以寻找类似的主题。 不要在多个论坛上发布相同的问题。 不要在别人的主题上发布新主题或问题,开始新的主题!5。 学生:复制代码与学习设计不同.6“它不起作用”不是一个可以回答的问题。 提供有用的详细信息(请与网页,数据表链接).7。 您的代码中的评论不需要支付额外费用。 我没有支付论坛帖子的费用。 如果我写一篇好文章,那么我一无所获。 以上来自于谷歌翻译 以下为原文 The internal weak pullups are weak, most likely too weak for typical I2C operating frequencies. For the SDA signal you will most likely want a 1K - 10K value pullup added to the board. For the SCL signal, you have two options:
-- 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. |
|
|
|
鲍勃:
谢谢你的解释。 现在我对I2C有了很多了解。 我向SDA和SCL添加了2.2K的上拉电阻,但IObuffer的错误问题仍然存在。 我使用两个简单的IObuffer用于I2C总线,如下所示(见附录)。 问题是FPGA中的逻辑和FPGA引脚上的逻辑是不一致的。 确切地说,芯片显示器显示sda_in,sda_out,sda_en,scl_in,scl_out,scl_en的逻辑都在我的逻辑下运行。 但是当我使用示波器查看I2C总线上的信号时,SCL线上没有信号,SDA线上的信号错误。 这个错误的可能原因是什么? 谢谢 问候 张学友 2014年2月4日 附录: IOBUF#(。DRIVE(12),. IOSTANDARD(“LVCMOS33”),. SLEW(“FAST”))IOBUF_inst001(.O(dac_sda_in),//缓冲输出.IO(IO_DAC_SDA),//缓冲输入端口(连接) 直接到顶级端口).I(dac_sda_out),//缓冲输入.T(dac_sda_en)// 3状态使能输入,高=输入,低=输出); IOBUF#(。DRIVE(12),. IOSTANDARD(“LVCMOS33”),. SLEW(“FAST”))IOBUF_inst002(.O(dac_scl_in),//缓冲输出.IO(IO_DAC_SCL),//缓冲输入端口(连接) 直接到顶级端口).I(dac_scl_out),//缓冲输入.T(dac_scl_en)// 3状态使能输入,高=输入,低=输出); 以上来自于谷歌翻译 以下为原文 Bob: Thanks for your explaination. Now I have much understanding about the I2C. I add pullup resistor of 2.2K to both SDA and SCL, but the problem of error of IObuffer still exist. I use two simple IObuffer for I2C bus as below (in Appendix). The problem is that the logic in FPGA and that on the FPGA pin are inconsistent. Exactly, the chipscope show that the logic of sda_in, sda_out, sda_en, scl_in, scl_out, scl_en are all running under my logic. But when I peek the signal on I2C bus using oscilloscope, there are no signal on SCL line, and the signal on SDA line is wrong. what's the possible reason for this error? Thanks Regards Jacky 2014-02-04 Appendix: IOBUF #(.DRIVE(12),.IOSTANDARD("LVCMOS33"),.SLEW("FAST")) IOBUF_inst001 ( .O(dac_sda_in), // Buffer output .IO(IO_DAC_SDA), // Buffer inout port (connect directly to top-level port) .I(dac_sda_out), // Buffer input .T(dac_sda_en) // 3-state enable input, high=input, low=output ); IOBUF #(.DRIVE(12),.IOSTANDARD("LVCMOS33"),.SLEW("FAST")) IOBUF_inst002 ( .O(dac_scl_in), // Buffer output .IO(IO_DAC_SCL), // Buffer inout port (connect directly to top-level port) .I(dac_scl_out), // Buffer input .T(dac_scl_en) // 3-state enable input, high=input, low=output ); |
|
|
|
您可能正在探测错误的信号引脚,或者您正在将I2C信号分配给错误的IO引脚。
这是我的猜测。 您的设计是否有其他迹象表明FPGA上的“运行”? 您确定您的FPGA配置代码已加载并正在执行吗? 系统时钟是否正常运行?您是否检查过综合报告的引脚排列报告? 就您的SDA / SCL IO缓冲区编码而言,您仍有问题。 开漏意味着您不驱动“高”电平,只驱动“低”输出电平,外部电阻提供“高”信号电平。 这有意义吗? 以下是SDA / SCL信号的典型I2C编码方式: 分配I2C_SDA_T =〜(SDA_OUT_ENA&&!SDA_OUT); // T引脚变为低电平以驱动输出低电平 IOBUF IOBUF_inst001(.O(SDA_IN),//输入缓冲输出.IO(I2C_SDA),//缓冲输入端口(直接连接到顶级端口).I(1'b0),//输出缓冲输入,始终为低电平 .T(I2C_SDA_T)); // LOW驱动输出LOW,否则为HIGH 分配I2C_SCL_T =〜(SCL_OUT_ENA&&!SCL_OUT); // T引脚变为低电平以驱动输出低电平 IOBUF IOBUF_inst002(.O(SCL_IN),//输入缓冲输出.IO(I2C_SCL),//缓冲输入端口(直接连接到顶级端口).I(1'b0),//输出缓冲输入,始终为低电平 .T(I2C_SCL_T)); // LOW驱动输出LOW,否则为HIGH - 鲍勃埃尔金德 签名:新手的自述文件在这里:http://forums.xilinx.com/t5/New-Users-Forum/README-first-Help-for-new-users/td-p/219369总结:1。 阅读手册或用户指南。 你读过手册了吗? 你能找到手册吗?2。 搜索论坛(并搜索网页)以寻找类似的主题。 不要在多个论坛上发布相同的问题。 不要在别人的主题上发布新主题或问题,开始新的主题!5。 学生:复制代码与学习设计不同.6“它不起作用”不是一个可以回答的问题。 提供有用的详细信息(请与网页,数据表链接).7。 您的代码中的评论不需要支付额外费用。 我没有支付论坛帖子的费用。 如果我写一篇好文章,那么我一无所获。 以上来自于谷歌翻译 以下为原文 You probably are either probing the wrong signal pins or you are assigning the I2C signals to the wrong IO pins. That's my guess.
Here is typical I2C coding style for SDA/SCL signals: assign I2C_SDA_T = ~(SDA_OUT_ENA && !SDA_OUT); // T pin goes LOW to drive output LOW IOBUF IOBUF_inst001 ( .O (SDA_IN), // Input buffer output .IO (I2C_SDA), // Buffer inout port (connect directly to top-level port) .I (1'b0), // output buffer input, always LOW .T (I2C_SDA_T) ); // LOW to drive output LOW, otherwise HIGH assign I2C_SCL_T = ~(SCL_OUT_ENA && !SCL_OUT); // T pin goes LOW to drive output LOW IOBUF IOBUF_inst002 ( .O (SCL_IN), // input buffer output .IO (I2C_SCL), // Buffer inout port (connect directly to top-level port) .I (1'b0), // output buffer input, always LOW .T (I2C_SCL_T) ); // LOW to drive output LOW, otherwise HIGH -- 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. |
|
|
|
Bob:谢谢。虽然我将i2c iobuffer更改为您所说的样式,如下所示,但ISE在生成位文件时仍会报告错误。
分配scl =(scl_en)? ((scl_clk)?1'bz:1'b0):1'bz;赋值sda =(sda_o)? 1'bz:1'b0; ISE报告错误如下:错误:PhysDesignRules:368 - 信号不完整。 信号不是由设计中的任何源引脚驱动的.ERROR:PhysDesignRules:368 - 信号不完整。 信号不是由设计中的任何源引脚驱动的。为什么工具会报告这种错误。谢谢问候Jacky2014-02-07 以上来自于谷歌翻译 以下为原文 Bob: Thanks. While I change the i2c iobuffer to the style as you said, which is showed below, the ISE still report a error when generating the bit file. assign scl = (scl_en)? ((scl_clk)? 1'bz : 1'b0) : 1'bz; assign sda = (sda_o)? 1'bz : 1'b0; The ISE report error like this: ERROR:PhysDesignRules:368 - The signal ERROR:PhysDesignRules:368 - The signal Why the tools report this kind of error. Thanks Regards Jacky 2014-02-07 |
|
|
|
示例和模板的整个概念是您必须重命名信号以适合您的设计。
您的代码必须提供缺失的信号,或者您应该重命名信号以匹配设计中的信号。 这有意义吗? - 鲍勃埃尔金德 签名:新手的自述文件在这里:http://forums.xilinx.com/t5/New-Users-Forum/README-first-Help-for-new-users/td-p/219369总结:1。 阅读手册或用户指南。 你读过手册了吗? 你能找到手册吗?2。 搜索论坛(并搜索网页)以寻找类似的主题。 不要在多个论坛上发布相同的问题。 不要在别人的主题上发布新主题或问题,开始新的主题!5。 学生:复制代码与学习设计不同.6“它不起作用”不是一个可以回答的问题。 提供有用的详细信息(请与网页,数据表链接).7。 您的代码中的评论不需要支付额外费用。 我没有支付论坛帖子的费用。 如果我写一篇好文章,那么我一无所获。 以上来自于谷歌翻译 以下为原文 The whole idea of examples and templates is that you must rename signals to fit into your design. Your code must provide the missing signals, or you should rename the signals to match those in your design. Does this make sense? -- 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. |
|
|
|
鲍勃:谢谢。我不明白你的观点。
我在顶级实例化模块并将scl和sda直接连接到顶级端口,如下面的代码所示:DAC_CONFIG dac_u1(.clk(CLK_GC_40M),//系统时钟.st(reset_i2c),//系统复位。 i2c_config_en(i2c_config_en),。dout(dout),. scl(IO_DAC_SCL),// i2c总线的串行时钟输出.sda(IO_DAC_SDA)// i2c总线的串行数据输出);我检查scl和sda信号是否为 在每个级别正确连接。 为什么ISE报告错误如此?ThanksRegardsJacky 以上来自于谷歌翻译 以下为原文 Bob: Thanks. I do not get your point. I instantiate the module in the top level and connect scl and sda directly to the top level port, as the code below shows: DAC_CONFIG dac_u1( .clk(CLK_GC_40M), // system clock .rst(reset_i2c), // system reset .i2c_config_en(i2c_config_en), .dout(dout), .scl(IO_DAC_SCL), // serial clock output of i2c bus .sda(IO_DAC_SDA) // serial data output of i2c bus ); I check it that the scl and sda signal are connected correctly in each level. why the ISE report error like this ? Thanks Regards Jacky |
|
|
|
建议您发布顶级模块和模块DAC_CONFIG的源代码。
- 鲍勃埃尔金德 签名:新手的自述文件在这里:http://forums.xilinx.com/t5/New-Users-Forum/README-first-Help-for-new-users/td-p/219369总结:1。 阅读手册或用户指南。 你读过手册了吗? 你能找到手册吗?2。 搜索论坛(并搜索网页)以寻找类似的主题。 不要在多个论坛上发布相同的问题。 不要在别人的主题上发布新主题或问题,开始新的主题!5。 学生:复制代码与学习设计不同.6“它不起作用”不是一个可以回答的问题。 提供有用的详细信息(请与网页,数据表链接).7。 您的代码中的评论不需要支付额外费用。 我没有支付论坛帖子的费用。 如果我写一篇好文章,那么我一无所获。 以上来自于谷歌翻译 以下为原文 Suggest you post your source code for top-level module and for module DAC_CONFIG. -- 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. |
|
|
|
鲍勃:
谢谢 在设计中,我使用Simple2Master模块来实现基本的I2C读写。 然后模块ctp_cosole将为DAC寄存器实现32位写或32位读。 在DAC_config模块中,提供了DAC器件的整个配置。 DAC_CONFIG模块在顶层实例化,scl和sda信号直接连接到顶层端口。 谢谢 问候 张学友 DAC_CONFIG.v 3 KB ctp_console.v 5 KB SimpleI2CMaster.v 8 KB 以上来自于谷歌翻译 以下为原文 Bob: Thanks In the design, I use the module Simple2Master to implement basic I2C read and write. Then the module ctp_cosole is to implement a 32bit write or 32 bit read for DAC register. In the DAC_config module, the whole configuration for a DAC device is meeted. And the DAC_CONFIG module is instantiated in the top level and the scl and sda signal is connected directly to the top level port. Thanks Regards Jacky DAC_CONFIG.v 3 KB ctp_console.v 5 KB SimpleI2CMaster.v 8 KB |
|
|
|
鲍勃:
我在这里发布了顶级文件 TI_ADC_TOP.v 14 KB 以上来自于谷歌翻译 以下为原文 Bob: I post the top-level file here TI_ADC_TOP.v 14 KB |
|
|
|
错误消息表明通过代码在连接链中的某处错误键入了信号名称。
我没有看到任何明显的错误。 其他的建议: 合成时是否出现错误消息? 还是在.bit文件生成? 你使用什么综合工具? “scl”信号没有给出相同的错误信息? 合成或.bit文件生成中是否还有其他错误消息? 在sclist报告中,'scl'和'sda'是否符合预期? 在最低级别,您是否为SimpleI2CMaster.v编写了代码? SimpleI2CMaster.v使用2进程状态机实现。 这应该是不鼓励的,有利于单进程状态机。 在这种情况下,输出启用是组合分配的,而不是(直接)注册。 结果是输出启用的故障是不可避免的。 这是一个有问题的做法! 如果您仍然遇到问题,我建议将sda(inout)逻辑简化为错误消息消失的程度。 然后进行小的增量更改 - 一次一个 - 将sda信号返回到其预期的设计实现。 当错误消息重新出现时,您将非常清楚地知道哪个小的更改会引发错误消息。 - 鲍勃埃尔金德 签名:新手的自述文件在这里:http://forums.xilinx.com/t5/New-Users-Forum/README-first-Help-for-new-users/td-p/219369总结:1。 阅读手册或用户指南。 你读过手册了吗? 你能找到手册吗?2。 搜索论坛(并搜索网页)以寻找类似的主题。 不要在多个论坛上发布相同的问题。 不要在别人的主题上发布新主题或问题,开始新的主题!5。 学生:复制代码与学习设计不同.6“它不起作用”不是一个可以回答的问题。 提供有用的详细信息(请与网页,数据表链接).7。 您的代码中的评论不需要支付额外费用。 我没有支付论坛帖子的费用。 如果我写一篇好文章,那么我一无所获。 以上来自于谷歌翻译 以下为原文 The error message suggests a mis-typing of a signal name somewhere in the connection chain through the code. I did not see any glaring error. Other comments:
-- 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. |
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
2178 浏览 7 评论
2616 浏览 4 评论
Spartan 3-AN时钟和VHDL让ISE合成时出现错误该怎么办?
2089 浏览 9 评论
3156 浏览 0 评论
如何在RTL或xilinx spartan fpga的约束文件中插入1.56ns延迟缓冲区?
2210 浏览 15 评论
有输入,但是LVDS_25的FPGA内部接收不到数据,为什么?
446浏览 1评论
1539浏览 1评论
在使用xc5vsx95T时JTAG扫片不成功,测量TDO无信号输出
2184浏览 0评论
515浏览 0评论
1658浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-5-11 21:55 , Processed in 1.860161 second(s), Total 104, Slave 88 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号