1
\$\begingroup\$

I have an I2C signal chain as given below.

Arduino <-> Level Shifter <-> DUT.

Arduino is the master and used to write and read from the DUT.

In any of these scenarios (Read/Write) will the master (Arduino) generate the ACK bit? Or is the ACK bit is always generated by the slave (DUT)?

\$\endgroup\$

3 Answers 3

5
\$\begingroup\$

The ACK bit is always generated by the device that just received that byte.

When the I2C master transmits the address/RW byte, a recognising target device generates the ACK bit. This informs the master that a target is ready for communications.

When the I2C master transmits a data byte, the target device generates the ACK bit. This is an ACK if it can receive another byte, no ACK if the message will end.

When the I2C master receives a data byte, the master generates the ACK bit. This is an ACK if it will be reading another byte, no ACK if the message will end.

\$\endgroup\$
1
\$\begingroup\$

During a master polling for devices, a slave which recognizes its address sends an ACK. This tells the master that the slave it is trying to reach is actually on the bus. If no slave devices recognize the address, the result is a NACK. During transmission after the side reading a byte (master on a receive or slave on a send) receives a byte, it must send an ACK. Check out the "UM10204 I2C-bus specification and user manual" for exact details and all special cases that may diverge.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Master must send ACK if it wants to continue reading more bytes. It will send a NAK to signal that it does not want to continue transferring bytes. \$\endgroup\$
    – Justme
    Commented Jan 30, 2023 at 12:11
  • \$\begingroup\$ @Justme. Yes that's one of the more "special" cases detailed in the document ... \$\endgroup\$
    – citizen
    Commented Jan 30, 2023 at 13:07
  • \$\begingroup\$ I don't see why would reading one byte or multiple bytes over I2C would be "special". Sounds extremely common to me. \$\endgroup\$
    – Justme
    Commented Jan 30, 2023 at 13:45
1
\$\begingroup\$

Each device will generate the ACK when needed by the protocol. So both devices will send ACK at some point.

Slave sends an ACK when it has received data, master sends an ACK when it wants to receive more data from slave, NAK if it does not want more data.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.