Dear Community, specially Kerry:
I still have this problem, the code is running on a loop during the while while (*stat == I2C_STATUS_BUSY).
I'm using a LPC1769. I'll attacht the configuration function, just to share, i think that the problem isn't there.
void Chip_I2C_EventHandlerPolling(I2C_ID_T id, I2C_EVENT_T event)
{
struct i2c_interface *iic = &i2c[id];
volatile I2C_STATUS_T *stat;
/* Only WAIT event needs to be handled */
if (event != I2C_EVENT_WAIT) {
return;
}
stat = &iic->mXfer->status;
/* Call the state change handler till xfer is done */
while (*stat == I2C_STATUS_BUSY) {
if (Chip_I2C_IsStateChanged(id)) {
Chip_I2C_MasterStateHandler(id);
}
}
}
void init_memoriai2c (void)
{
//Inicializo i2c de la memoria
Chip_IOCON_PinMux(LPC_IOCON, I2C_DEVICE_PORT, I2C_SDA_PIN, IOCON_MODE_INACT, IOCON_FUNC3);
Chip_IOCON_PinMux(LPC_IOCON, I2C_DEVICE_PORT, I2C_SCL_PIN, IOCON_MODE_INACT, IOCON_FUNC3);
Chip_IOCON_EnableOD(LPC_IOCON,I2C_DEVICE_PORT, I2C_SDA_PIN);
Chip_I2C_Init(I2C_DEVICE_NUM_MEMR);
Chip_I2C_SetClockRate(I2C_DEVICE_NUM_MEMR,I2C_SPEED_MMR);
Chip_I2C_SetMasterEventHandler(I2C_DEVICE_2,Chip_I2C_EventHandlerPolling);
}
Port 0, SDAPin = 0, SCLPin = 1, I2C_DEVICE_NUM_MEMR = 2, I2C_SPEED_MMR = 256000, I2C_DEVICE_2 = IC2C