From 01c5021a5114fd9c06dd0db2eda5fad8930ee7cc Mon Sep 17 00:00:00 2001 From: "elian.wang" <1914225091@qq.com> Date: Mon, 30 Oct 2023 14:04:24 +0800 Subject: [PATCH] modify iic md --- .../en/hardware/peripheral-interfaces/IIC.md | 13 +------------ .../zh/hardware/peripheral-interfaces/IIC.md | 13 +------------ 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/docs/Application_guide/en/hardware/peripheral-interfaces/IIC.md b/docs/Application_guide/en/hardware/peripheral-interfaces/IIC.md index 258b0e49..0dc68417 100644 --- a/docs/Application_guide/en/hardware/peripheral-interfaces/IIC.md +++ b/docs/Application_guide/en/hardware/peripheral-interfaces/IIC.md @@ -228,18 +228,7 @@ This might be caused by something like wrong baud-rate and wrong HW connection. - Check if module IIC baud rate is above the peripheral limit. - Check hardware connection. Make sure SDA/SCL and GND lines are connected properly. -**2. A successful transmission will fail after some time** - -It's very likely that the IIC is locked-up. A lock-up is typically caused by 1. The master resets abnormally while the slave ACK. 2. The master resets abnormally while the slave transmits data bit of 0. -You may noticed that in both condition, the SDA line are pulled down by the slave while the master has reset abnormally, after which the SCL would be at HIGH (Idle). -Right now the slave is waiting for the master to pull down the SCL to get ACK or Data bit while the master is waiting for the slave to release the SDA line. Both sides are waiting for each other, resulting a lock-up. - -Solution: - -- The master should reset the slave to make it release SDA if the SDA line is pulled-down for a long time. This solution only works under the circumstance that the slave has reset pin that can be controlled by MCU. -- The master can push nine clocks to SCL if the SDA line is pulled-down for a long time. This will get the slave ACK and make the slave release SDA back to HIGH. - -**3. It is normal to transmit/receive, however, the data are wrong** +**2. It is normal to transmit/receive, however, the data are wrong** It could be: diff --git a/docs/Application_guide/zh/hardware/peripheral-interfaces/IIC.md b/docs/Application_guide/zh/hardware/peripheral-interfaces/IIC.md index 27e0b38e..1e96ff7d 100644 --- a/docs/Application_guide/zh/hardware/peripheral-interfaces/IIC.md +++ b/docs/Application_guide/zh/hardware/peripheral-interfaces/IIC.md @@ -205,18 +205,7 @@ IIC是一种非常简单和直接的通信协议,在实际应用中遇到的 - 检查硬件连接,确保SDA和SCL线正确连接,并且地线(GND)也要正确连接。 -**2. 数据正常收发一段时间后收发一直失败** - -极大可能是IIC发生死锁。死锁的产生常见的有两种情况:一种是从机在回复ACK时主机异常复位;另一种是从机在回复数据位是0的时候主机异常复位。 -两种情况的相同点都是主机异常复位时SDA处于被从机拉低状态,而主机复位后SCL处于高电平状态(空闲状态)。 -此时从机会等待主机拉低SCL取走ACK或者数据位,而主机会等待从机释放SDA线。主机和从机互相等待,进入死锁状态。 - -解决方法: -- 主机在检测到SDA被拉低超过一段时间后,主动复位从机从而使之释放SDA。这种方法的前提是从机有复位引脚,MCU可以控制从机的复位引脚使之复位。 -- 主机在检测到SDA被拉低超过一段时间后,推送9个Clock到时钟总线上,取走从机的ACK位从而使从机释放SDA为高电平。 - - -**3. 可以正常进行收发,但是有错误数据** +**2. 可以正常进行收发,但是有错误数据** 可能是以下几个原因: - 主机SDA、SCL和从机SDA、SCL电平不一致。当主机电平为3.3V,从机为1.8V,此时从机的高电平是1.8V,但是主机一般认为电平高于1.65V是高电平,容易产生误判。 -- Gitee