How to solve the problem that the slave does not send an ACK response signal to the master after the master sends the address

1. The iic bus slave does not return a response to the host

I used a fuel gauge with an iic interface to communicate with my single-chip microcomputer. I analyzed the data with a logic analyzer and found that after the master wrote a byte of data, the slave did not return an ack to the master, which caused me to read the data from the slave later. When it is all ff, I would like to ask you iic gods, how can I check the problem?

On the hardware, check whether the iic device is soldered, whether the bus conflicts, whether the scl and sda lines of the oscilloscope have a half-high level;
if your code is not guaranteed to be mature, it is recommended to trigger the oscilloscope to see if the timing is satisfied or not. iic protocol requirements; the
read data is the bus default state ff, indicating that the device has not responded, most likely: the
address is incorrect; the
timing is incorrect; the
rate does not match

 

1. When the slave cannot respond to the slave address (for example, it is busy with other things and cannot respond to the operation of the IIC bus, or this address does not have a corresponding slave), the SDA line is not pulled low in the 9th SCL cycle, that is There is no ACK signal. At this time, the host sends a P signal to terminate the transmission or resends an S signal to start a new transmission.
2. If the slave receiver cannot receive more data during transmission, it will not send out an ACK signal. In this way, the host can be aware of this and send a P signal to terminate the transmission or resend an S signal to start a new transmission.
3. The host receiver will not send out an ACK signal after receiving the last byte. Then, the slave transmitter releases the SDA line to allow the master to send a P signal to end the transmission

 

2. In I2C communication, sometimes the master cannot receive the ACK response from the slave, and the SDA line will be pulled to death (low level) at this time. Everyone can help!

https://bbs.csdn.net/topics/300222638

Is there a timing problem? You can set the timeout to a larger value and look for the reason.

Is there any problem in setting several I2C registers?

Take a look at the timing of I2C. If there is no problem with the timing of the master sending, the lack of response is likely to be a slave problem.

 

3. A little understanding of IIC bus timing and ACK and NACK (NAK)

https://blog.csdn.net/weixin_34357928/article/details/85618325

In summary, in IIC communication , both SDA and SCL are controlled by the host, and the slave can only pull the SDA line low . For the SCL line, the slave does not have any ability to control. The slave can only passively follow the SCL.

In a word: SCL is one-way and controlled by the master. The SDA is two-way, the master can control it, and the slaver can also control it.

4. Understanding of ACK in I2C bus (easy to understand)

https://wenku.baidu.com/view/ee41bc881eb91a37f1115ce2.html

Guess you like

Origin blog.csdn.net/chenhuanqiangnihao/article/details/115000657