1
完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
大家好,我在I2C上有一个非常奇怪的行为,需要一些建议:我有一个PIC32 MX,它作为我的板上的I2C主控器和一个I2C从机的PIC16F。除作为一个1-Wire主机的其他功能之外,从微处理器芯片应用笔记AN1199实现。当主控器(PIC32)与从机(PIC16)通信时,只调用除1线功能之一以外的任何功能,一切工作正常。主可以尽可能多地写和读数据。但是,当我从主叫线上的1个线函数中的一个调用,这导致在1线线路上的通信时,I2C总线崩溃。这是非常奇怪的,因为1-Wire功能根本不与I2C总线交互。它只驱动一个I/O引脚高和低。有趣的是:公共汽车不是从奴隶一侧坠毁,而是在主人身边坠毁。在发送1线命令后,主机通过发送一个启动条件来读取从结果上的结果,然后用读取位发送地址,读取一个字节并最终设置停止位。当设置停止位时,总线总是崩溃:主机报告I2C总线上的总线冲突。有人知道这里有什么错误吗?
以上来自于百度翻译 以下为原文 Hi everyone, I have a really strange behavior on I2C and need some advice: I have a PIC32MX which works as a I2C master on my board and a PIC16F which is the I2C slave. The slave works in addition to other functionalities as a 1-Wire master which was implemented according to the Microchips application note AN1199. When the master (PIC32) communicates with the slave (PIC16) and just calls any function except one of the 1-Wire functions, everything works well. The master can write and read data as much as he wants. But as soon as I call one of the 1-Wire functions on the slave which causes a communication on the 1-Wire line, the I2C bus crashes. This is really strange, since the 1-Wire functions do not interact with the I2C bus at all. It is only driving an I/O pin high and low. The funny thing is: The bus does not crash on the slave side but on the master side. After the 1-Wire command was sent, the master trys to read the result on the slave by sending a start condition, then send the address with read bit, read one byte and finaly set the stop bit. The bus always crashes when setting the stop bit: The master reports a bus collision on the I2C bus. Does anyone have an idea what could be wrong here? |
|
相关推荐
4个回答
|
|
1-线代码禁用中断长时间吗?
以上来自于百度翻译 以下为原文 Is the 1-wire code disabling interrupts for extended periods? |
|
|
|
不,它不是。我可以写1-Wire命令,使1-线主机通信(切换I/O)尽可能多,而不崩溃I2C总线。但是,当我读了一个字节(在1线通信之后),I2C总线崩溃了。如果中断将被禁用,这将导致问题,就不可能发送一个以上的“写入”命令。
以上来自于百度翻译 以下为原文 No it's not. I can write 1-Wire commands which cause the 1-Wire master to communicate (toggling I/O) as much as I want without crashing the I2C bus. But as soon as I read a byte (after 1-Wire communication) the I2C bus crashes. If the interrupts would be disabled and this would cause the issue, it would not be possible to send more than one "write" command. |
|
|
|
在发送停止之前,您的I2C代码在读取最后一个字节之后是否正确地发送NACK(不是ACK)?
以上来自于百度翻译 以下为原文 Is your I2C code correctly sending a NAK (not an ACK) after reading the last byte, before you send the STOP? |
|
|
|
伟大的!这是个骗局!我做了阅读,这就造成了错误,谢谢你的帮助!
以上来自于百度翻译 以下为原文 Great! This was the trick! I did ACK the read and this caused the error. Thanks for your help qhb! |
|
|
|
只有小组成员才能发言,加入小组>>
5242 浏览 9 评论
2031 浏览 8 评论
1955 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3207 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2256 浏览 5 评论
778浏览 1评论
669浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
596浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
679浏览 0评论
577浏览 0评论
小黑屋| 手机版| Archiver| 德赢Vwin官网 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-23 22:39 , Processed in 1.690730 second(s), Total 82, Slave 66 queries .
Powered by 德赢Vwin官网 网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
德赢Vwin官网 观察
版权所有 © 湖南华秋数字科技有限公司
德赢Vwin官网 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号