9 years, 9 months ago.

I2C Master Mode

I just run a test program to check I2C Master Mode on LPCXpresso824-MAX board

and I2C Slave Mode on Mbed NXP LPC1758 board using the standard compiled version of Mbed library.

The test data is received correctly on Mbed NXP LPC1758 board, however LPCXpresso824-MAX board always

reports No I2C Ack.

How is it possible that data is received correctly but there is no I2C Ack ?

Please check the Attached test program.

/media/uploads/Elianco_ES/lpcx824_i2c_test.txt

The blinking RED LED means that there is no ACK.

The next problem is that the program will stall after this statement:

i2c_ack = MasterI2C.read(i2c_addr, &data, 1, false);

So it looks like MasterI2C.read() function is not working.

Question relating to:

LPCXpresso824-MAX from NXP is an mbed enabled platform which combines the advantages of the mbed ecosystem and Arduino form factor.

1 Answer

9 years, 9 months ago.

In the I2C protocol the receiving side, no matter whether it is a slave or master, will ACK data as long as it is able or willing to accept more data. In the case of the lpc1768 slave you have set the max length at 2 bytes, that means the slave will ACK the first byte and NAK the second byte to indicate that its buffer is full or something. The sender will only see the result of that last transfer and thus gets a NAK.

This limited status feedback is one of the issues with the current implementation of the slave code.

Accepted Answer