I2C 主机应该总是在 NAK 之后发送停止条件吗?

Should I2C master always send stop condition after NAK?

根据I2C规范,出现NAK的原因有五种:

  1. No receiver is present on the bus with the transmitted address so there is no device to respond with an acknowledgment.
  2. The receiver is unable to receive or transmit because it is performing some real-time function and is not ready to start communication with the master.
  3. During the transfer, the receiver gets data or commands that it does not understand.
  4. During the transfer, the receiver cannot receive any more data bytes.
  5. A master-receiver must signal the end of the transfer to the slave transmitter.

在所有这些情况下,I2C 主机是否应该以停止条件结束通信?

如果您阅读了您从 I2C specification (§ 3.1.6) 引用的内容之前的段落:

When SDA remains HIGH during this ninth clock pulse, this is defined as the Not Acknowledge signal. The master can then generate either a STOP condition to abort the transfer, or a repeated START condition to start a new transfer. There are five conditions that lead to the generation of a NACK:

  1. No receiver is present on the bus with the transmitted address so there is no device to respond with an acknowledge.
  2. The receiver is unable to receive or transmit because it is performing some real-time function and is not ready to start communication with the master.
  3. During the transfer, the receiver gets data or commands that it does not understand.
  4. During the transfer, the receiver cannot receive any more data bytes.
  5. A master-receiver must signal the end of the transfer to the slave transmitter

主机不必总是发送停止条件,但它必须发送停止条件或重复启动条件。​​