This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM5718: I2C creates buffer overflow under certain invalid bus conditions

Part Number: AM5718
Other Parts Discussed in Thread: TMDXIDK5718

Tool/software:

Hello,

We think we have identified a potential bug in the I2C module in SDK version 06-03-02-08. I don't see this issue mentioned in release notes of newer versions, so I believe it is not yet solved.

Due to EMI in our system, there is sometimes a bus condition which causes a large buffer overflow. When attempting a transaction with a write operation followed by a read operation, the slave device acknowledges the last byte written and must release SDA before SCL transitions high for the repeated start. If the slave device holds SDA too long and only releases after SCL transitions high, a condition is created where the Bus Busy and Bus Free interrupts are active simultaneously. This causes the master to read an unlimited number of bytes, overflowing the read buffer and continuing until timeout.

The following waveforms show the issue and were set up to write 1 byte and read 2 bytes:

This issue can be fixed by modifying the driver code. Line 348 in I2C_v1.c is currently:

if (object->readBufIdx > 0U)

I suspect it was intended to be:

if (object->readCountIdx > 0U)

This condition should also be handled as an error by adding a check for the simultaneous Bus Bus and Free interrupts and setting the fatalError flag in I2C_v1_hwiFxnMaster().

Thank you for your support,

Vikesh