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.

TMS570LC4357: TMS570LC4357

Part Number: TMS570LC4357

Hi,

We are having a problem with the code segment below. In our device, there is one eeprom device on one I2C bus and no other devices. 

while (length > 0U) // Read the data bytes
{

while ((i2c->STR & (uint32)I2C_RXRDY) == 0U)
{
} /* Wait */

*data = ((uint8)i2c->DRR);
data++;
length--;
}

We are reading a small number of data bytes from the eeprom. We transmit the read command, which works. The problem we are seeing is the execution of code sometimes freezes at the  while loop highlighted in red and the read never completes.

As a test, we put a counter into the loop, to force an exit. The time period is long enough that data should be available. We also print a message that the count has expired and we are forcing an exit from the loop.

When we do this, the data is always read correctly and all of the time. Even when  the error message is printed. This implies that the data must be available even though the i2c->STR doesn't appear to have bit 8 (I2C_RXRDY) set. We can see that the bit is 0 from the IDE.

Can someone provide help/ideas as to why the bit, I2C_RXRDY, may not get set, even though the data appears to be available. 

Thanks

Malcolm