Support Question of the Week: Why Does My Aardvark I2C/SPI Host Adapter Send a NACK When I’m Trying to Read From It?

I am using an Aardvark I2C/SPI Host Adapter as an I2C slave and another device as a master. I am using 7-bit addressing. After every write command to the Aardvark I2C slave device, the master device tries to read what it has written. The Aardvark is sending a NACK after the master executes a Read command immediately after the Write command. I have some questions about this:

  • Why is the I2C slave device, the Aardvark adapter, giving a NACK for a Read command after each Write?
  • Do I have to delay the read operation after each write?
  • Must a NACK always occur after each Write operation from the master?

Thanks for your questions! The Aardvark I2C/SPI Host Adapter's behavior, as a master and a slave, follow theI2C standard specifications. These specifications are described in detail in section 2.3 of the Aardvark Host Adapter User Manual.

What you have observed in your setup is the normal behavior of the Aardvark I2C/SPI Host Adapter as an I2C slave device. Following are examples of setting Max Rx bytes and how the Aardvark I2C slave responds.

To answer your questions, the Aardvark adapter, as a slave, gives a NACK for a read command because it is unable to accept data.  It will not occur after every write operation, only when it is unable to accept data.  The reason the Aardvark adapater is unable to accept data is due to “Max Rx Bytes” setting in the Control Center Software as shown below.

Setting Max Rx Bytes for the Aardvark Adapter in I2C Slave Mode Figure 1: Setting Max Rx Bytes for the Aardvark I2C/SPI Host Adapter in I2C Slave Mode

 

  • If the Max Rx bytes is set to 9 and the master sends the Aardvark 9 bytes of data, then the Aardvark sends the NACK after it receives the 9th byte. The Aardvark I2C slave informs the master device to not send (write) more bytes of data.
  • If the Max Rx bytes is set to 4 and the master sends the Aardvark 9 bytes, then the Aardvark sends the NACK after it receives the 4th byte. The Aardvark I2C slave informs the master device to not send more bytes of data.
  • However, if the Max Rx bytes is set for 20 and the master sends the Aardvark 9 bytes, then the Aardvark receives 9 bytes without delivering a NACK. In this case, the Aardvark I2C slave does not receive a 20th byte - therefore, a NACK is not sent. In this case, you would not have to delay the read operation after each write. The master device can read the data from the Aardvark slave by using a Read ACK.

For additional information, please refer to the following documents:

We hope this answers your question. If you have other questions about our host adapters or other Total Phase products, feel free to email us at sales@totalphase.com or submit a request for technical support.

Leave a Reply