lpcware

Cannot ACK/NACK I2C data byte based on contents

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by xlnt on Wed Jun 13 04:24:52 MST 2012
The following question holds for the I2C controller found in the various LPCxxxx devices. I found consistent information for LPC17xx and LPC43xx, but I think it will also hold for other devices.

According to the LPC43xx user manual, in master/(addressed) slave receiver mode, the Assert Acknowledge (AA) flag is used to acknowledge or not-acknowledge each byte received from another device on the bus:

LPC4350/30/20/10 User manual, Rev. 3.1
http://www.nxp.com/documents/user_manual/UM10503.pdf
Page 1028:

> AA is the Assert Acknowledge Flag. When set to 1, an acknowledge
> (low level to SDA) will be returned during the acknowledge clock
> pulse on the SCL line on the following situations:
>
> ...
> 3. A data byte has been received while the I2C is in the master
>    receiver mode.
> 4. A data byte has been received while the I2C is in the addressed
>    slave receiver mode
>
> The AA bit can be cleared by writing 1 to the AAC bit in the CONCLR
> register. When AA is 0, a not-acknowledge (HIGH level to SDA) will
> be returned during the acknowledge clock pulse on the SCL line on
> the following situations:
>
> 1. A data byte has been received while the I2C is in the master
>    receiver mode.
> 2. A data byte has been received while the I2C is in the addressed
>    slave receiver mode.

However, AA must be set prior to reception of the byte. This seems to be confirmed in Table 970 (master receiver mode) and Table 973 (slave receiver mode). E.g. Status code 0x40 in Table 970:

When AA is set to 0, the next (first) data byte will be received and NACK is returned.
When AA is set to 1, the next (first) data byte will be received and ACK is returned.

From this I conclude that a data byte cannot be acknowledged/not-acknowledged based on its value. I.e. it is automatically acknowledged/not-acknowledged based on AA.

It also means that the I2C controller inside LPCxxxx devices cannot be used to conform to the full I2C bus specification which specifies that a receiver can generate a NACK when it received data that it does not understand:

I2C-bus specification and user manual
http://www.nxp.com/documents/user_manual/UM10204.pdf
Page 10:

> The acknowledge takes place after every byte. The acknowledge bit
> allows the receiver to signal the transmitter that the byte was
> successfully received and another byte may be sent.
>
>...
>
> There are five conditions that lead to the generation of a NACK:
>
>...
> 3. During the transfer, the receiver gets data or commands that
> it does not understand.

Off course when data is received that cannot be understood, the next byte can be not-acknowledged, but this doesn’t hold for the last byte of a transmission.

So my question is:

Is the previous conclusion true, or do I misinterpret the user manual and is it possible to acknowledge/not-acknowledge a data byte based on its value?

Outcomes