完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我设计了一个小型板使用MCP30F521芯片来监测交流线路电压和功率。I2C接口运行良好,我指示芯片从RMS电压寄存器开始读取24个字节(0x18),90%的时间得到预期结果,24个字节加上3个字节用于芯片ACK/NACK字节、字节计数和校验和。校验和匹配,并且显示在将来的控制方案中使用的数据。每秒读取一次数据。我看到的其他90%的时间对我来说完全没有意义。正常数据读取具有0x06字节第一(ACK),然后字节数为27(0x1b),然后是数据和校验和。我在坏数据中看到的是ACK字节是正确的,但是字节数的下一个字节可以或多或少地小于正确的数字。我的代码仍然读取27字节,但显然数据需要被拒绝。我的逻辑分析器的时序和响应对于好的和坏的读数都是相同的,但是数据都是错误的,有时坏数据看起来是移位的,其他时候它是完全的垃圾。有没有人看到过这样的事情,发现了一个原因或工作?多谢
以上来自于百度翻译 以下为原文 I have designed a small board using the MCP39F521 chip to monitor AC line voltage and power. The I2C interface is running well, I am instructing the chip to read back 24 bytes (0x18) starting at the RMS Voltage register and 90% of the time I am getting the expected results, 24 bytes with the extra 3 bytes for the chip ACK/NAK byte, byte count, and checksum. Checksums match and I display the data which will be used in a future control scheme. The data is read back once per second. What I see the other 90% of the time makes absolutely no sense to me ... Normal data reads have the 0x06 byte first (ACK), then the number of bytes at 27 (0x1B), then the data, and the checksum. What I see on bad data reads is that the ACK byte is correct, but then the next byte for the number of bytes can be more or less than the correct number. My code still reads back the 27 bytes but obviously the data needs to be rejected. The timing and responses on my logic analyser appear the same for both good and bad reads, but the data is all wrong, sometimes the bad data appears to be shifted, other times it is complete garbage. Has anyone seen anything like this and found a cause or a work around? Thanks In Advance Larry Attached Image(s) |
|
相关推荐
3个回答
|
|
由于您没有显示任何代码,您只需随意猜测可能出错的内容。
以上来自于百度翻译 以下为原文 As you have not shown any of your code, you're just going to get random guesses about what might be wrong. |
|
|
|
好点…我真的不相信这个问题是在我的代码,我不这么说…这样做太久了。1。核心I2C代码是我们自己的库,在许多I2C应用程序中运行了超过5年。2。运行此代码的板是一个在R2C和F2RAM上建立的设计,它在没有错误的情况下运行。这是一个产品设计,我用它来测试新的交流测量板。3。我在第一个消息中有一个打字错误,我估计我的错误率是10%,但我在第二段中键入了90%。4。我做了一个长期的测试,发现我真正的错误率是5%,不是10%。5。我没有从MCP39 F521中检测到任何响应消息,除了在第一个字节中的ACK以外,我的系统也没有检测到任何I2C总线错误。6。昨晚我运行的系统没有交流电源通过电路板,我的错误率从5%下降到0.02%(10的50K响应)。这可能与数据或电路噪声有关?我将尝试在第一个帖子中添加逻辑分析器屏幕截图,绿色箭头指示从MCP30F521正确的格式化的响应,红色箭头指向坏的响应。这些不良反应并不是在这里出现的,而是一个接着一组的3到5个。
以上来自于百度翻译 以下为原文 Good point ... I honestly don't believe the problem is in my code and I don't say that lightly ... been doing this too long. 1. The core I2C code is our own library which has been running over 5 years in many I2C applications. 2. The board running this code is an established design with an RTCC and an FRAM on the I2C bus which operate with no errors. This is a production design which I am using to test the new AC measurement board. 3. I had a typo in the first message, I had estimated my error rate at 10% but I typed 90% in the second paragraph. 4. I ran a long term test and found that my real error rate is 5%, not 10%. 5. I have not detected any response messages from the MCP39F521 with anything other than ACK in the first byte, nor has my system detected any I2C bus errors. 6. Last night I ran the system without the AC power running through the board, my error rate dropped from 5% to 0.02% (10 out of 50k responses). So this might be related to data or circuit noise? I am going to try to add a logic analyzer screenshot to the first post, the green arrows indicate properly formatted responses from the MCP39F521, the red arrows point to the bad responses. These bad responses do not come one here then one there, they tend to come in groups of 3 to 5 one right after the other ... Larry |
|
|
|
经过大量的测试和代码调整,我们有了解决方案,下面的更改将我的错误率降低到超过350K请求的4个被损坏的响应的顺序:1。在发送消息以设置地址并读取字节之后,在尝试从芯片读取数据之前,我们有10ms的延迟。2。我们也有最小的2ms之间的数据包发送到任何设备上的总线。拉里
以上来自于百度翻译 以下为原文 After a lot of testing and code tweaking we have the solution, the changes below decreased my error rate to something on the order of 4 mangled responses out of over 350k requests: 1. After sending the message to set the address and read the bytes, we have a 10mS delay before trying to read the data back from the chip. 2. We also have a minimum of 2mS between the packets sent to any device on the bus. Larry |
|
|
|
只有小组成员才能发言,加入小组>>
5243 浏览 9 评论
2035 浏览 8 评论
1955 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3208 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2258 浏览 5 评论
778浏览 1评论
669浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
597浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
679浏览 0评论
577浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-24 06:53 , Processed in 1.383749 second(s), Total 80, Slave 64 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号