I am using the CSL to interface to an I2C flash and I can single step through my code but I get CSL_I2C_TIMEOUT_ERROR when I don't single step. Looking at the csl_i2c.c file I see that it is caused by the ICXRDY (I2C_write) or the ICRRDY (I2C_read) not being set. I noticed in the example code that delays were added, see example code below. Are these delays required and if they are, how long do they need to be?
/* Write data */
status = I2C_write(gI2cWrBuf, (CSL_I2C_DATA_SIZE + CSL_EEPROM_ADDR_SIZE),
CSL_I2C_EEPROM_ADDR, TRUE, startStop,
CSL_I2C_MAX_TIMEOUT);
if(status != CSL_SOK)
{
printf("I2C Write Failed!!\n");
return(result);
}
printf("I2C Write Complete\n");
/* Give some delay */
for(looper = 0; looper < CSL_I2C_MAX_TIMEOUT; looper++){;}
/* Write data EEPROM page address for read operation */
status = I2C_write(gI2cWrBuf, CSL_EEPROM_ADDR_SIZE, CSL_I2C_EEPROM_ADDR,
TRUE, startStop, CSL_I2C_MAX_TIMEOUT);
if(status != CSL_SOK)
{
printf("I2C Write Failed!!\n");
return(result);
}
/* Give some delay */
for(looper = 0; looper < CSL_I2C_MAX_TIMEOUT; looper++){;}
/* Read data */
status = I2C_read(gI2cRdBuf, CSL_I2C_DATA_SIZE, CSL_I2C_EEPROM_ADDR,
TRUE, startStop, CSL_I2C_MAX_TIMEOUT, FALSE);
if(status != CSL_SOK)
{
printf("I2C Read Failed!!\n");
return(result);
}
printf("I2C Read Complete\n");