完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
嗨,我的问题是:我在PIC32 MZ2048 ECM144上使用Hydio1.07.01。我从外部RTC读取时间通过主I2C使用标准的静态驱动器(速度= 100kHz从60MHz外围总线时钟)。所有的工作都在几分钟内完成(我每秒读取时间),但是随机接收阶段(7字节)在收到的一个字节的ACK脉冲之后停止,显然是因为没有产生发送ACK序列中断(在调试中,每次接收I2C主控器时,我切换输出引脚值)。中断,以查看是否产生了所有中断。我现在看到的是ACK脉冲被发送,但是发送ACK序列中断没有产生,SCL不再高。我试图去初始化和重新初始化I2C模块,但是恢复这种情况的唯一方法是软件重置。在重新初始化之后,我还检查了中断标志的状态,启用了主和总线冲突中断,因此我不知道发生什么情况或如何在没有软复位的情况下恢复这种情况。我附上示波器跟踪的图片:SDA=信号1,SCL=信号2,Inte。Rrutt切换=信号3。提前感谢。
以上来自于百度翻译 以下为原文 Hi, My problem is the following: I'm working with HARMony 1.07.01 on a PIC32MZ2048ECM144. I read time from an external RTC via a master I2C using the standard static driver (speed = 100kHz from a 60MHz peripheral bus clock). All works fine for some minutes (I read time every second), but randomly the receive phase (7 bytes) stops after the ack impulse of one of the received bytes, apparently because the Send ACK sequence interrupt is not generated (In debug, I toggle an output pin value each time I receive a I2C Master interrupt, in order to see if all interrupts are generated). What I see at this moment is that the ACK impulse is sent, but the Send ACK sequence interrupt is not generated and the SCL never goes high anymore. I tried to deinitialize and re-initialize the I2C module, but the only way to recover the situation is a software reset. I also checked the status of interrupt flags after re-initialization, and master and bus collision interrupts are enabled, so I have no idea of what happens or how to recover this situation without a softrare reset. I attached a picture of the oscilloscope trace: SDA = signal 1, SCL = signal 2, Interrupt toggle = signal 3. Thanks in advance. Attached Image(s) |
|
相关推荐
1个回答
|
|
您的跟踪显示了8个时钟的突发,它们之间只有一个时钟。由于您没有显示传输的第一个时钟,因此我不能确定哪些时钟用于数据,哪些时钟用于ACK。如果用箭头和标签对跟踪进行注释会有帮助。如果8条紧挨在一起的是时钟,而孤立的一条是ACK,那么有两件事情需要注意。由于某种原因,最后一个时钟比以前的任何一个都有更长的延迟(从突发到那个)。是什么引起的?你知道你的RTC是“时钟延长”吗?下一步,如果最后一个时钟是ACK时钟,那么RTC没有激活时钟。数据引脚在前沿上高,这意味着“不ACK”。I2C容易锁定。主要问题是CPU在传输过程中被重置(您没有重置),但是外带消息是锁定的I2C总线可能需要“超时”。初始化应该将管脚编程为GPIO,然后在SCL管脚上手动生成至少8个“虚拟时钟”,以确保从机不在传输过程中。您应该尝试这个作为您尝试恢复的一部分。为了发现从设备是否引起问题并驱动时钟引脚,请将电阻器与SCL线串联,每端都有大的值上拉。当不同的设备驱动线路时,这将给出不同的电压电平,让您在示波器轨迹中随时看到哪个设备是活动的。
以上来自于百度翻译 以下为原文 Your trace shows bursts of 8 clocks with a single clock between them. Since you didn't show the first clock of the transfer, I can't tell which clocks are for the data and which one is for the ACK. It would help if you annotated the trace with arrows and labels. If the 8 ones close together are the clock and the isolated one is the ACK, then there are two things to notice. For some reason the last single clock had a far longer delay (from the burst to that one) than any of the previous ones. What caused that? Do you know if your RTC is "clock stretching"? Next, if that last clock is the ACK clock, then the RTC didn't ACK that clock. The Data pin goes high on the leading edge, which means "no ack". I2C is prone to locking up. The main problem is having the CPU reset in the middle of a transfer (which you're not having), but the take-away message is that a locked up I2C bus may need to be "clocked out". Initialisation should program the pins as GPIOs and then manually generate at least 8 "dummy clocks" on the SCL pin to make sure the slave isn't in the middle of a transfer. You should try this as part of your attempted recovery. In order to find if the slave is causing a problem and driving the clock pin, put a resistor in series with the SCL line with large value pullups at each end. That will give different voltage levels when the different devices are driving the line, letting you see which one is active at any one time in your oscilloscope trace. Tom |
|
|
|
只有小组成员才能发言,加入小组>>
5003 浏览 9 评论
1921 浏览 8 评论
1852 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3066 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2143 浏览 5 评论
574浏览 1评论
431浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
475浏览 0评论
367浏览 0评论
IPECMD命令烧录AVR128DA48芯片,报找不到芯片错误
852浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-8-16 13:25 , Processed in 1.046228 second(s), Total 77, Slave 61 queries .
Powered by 电子发烧友网
© 2015 www.ws-dc.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号