Hello LPC Support,
I am having an issue with I2C communication using LPC4078 when bootloaded (see Note). LPC is set as master and is communicating with a temperature sensor (TMP75CIDGK). The problem occurs in event handler:
void Chip_I2C_EventHandler(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;
/* Wait for the status to change */
while (*stat == I2C_STATUS_BUSY) {} /*CODE STUCKS HERE*/
}
The I2C2 Status Register has a value of 0x8 which according to datasheet is start condition is sent, which is correct:


When the I2C bus is configured it is checked if the SCL and SDA is low, if yes then try to send dummy clocks on SCL to unlock it. But the code does not execute because SCL and SDA are high before and after initialization. The problem occurs when the data is sent using the API. The start condition is send when the transfer starts using Chip_I2C_MasterTransfer function:
/* Transmit and Receive data in master mode */
int Chip_I2C_MasterTransfer(I2C_ID_T id, I2C_XFER_T *xfer)
{
struct i2c_interface *iic = &i2c[id];
iic->mEvent(id, I2C_EVENT_LOCK);
xfer->status = I2C_STATUS_BUSY;
iic->mXfer = xfer;
/* If slave xfer not in progress */
if (!iic->sXfer) {
startMasterXfer(iic->ip); /* Start condition set SCL = SDA = 0(low)*/
}
iic->mEvent(id, I2C_EVENT_WAIT); /* This function gets stuck */
iic->mXfer = 0;
/* Wait for stop condition to appear on bus */
while (!isI2CBusFree(iic->ip)) {}
/* Start slave if one is active */
if (SLAVE_ACTIVE(iic)) {
startSlaverXfer(iic->ip);
}
iic->mEvent(id, I2C_EVENT_UNLOCK);
return (int) xfer->status;
}
Can someone please explain what exactly is the problem here?
Thanks in advance.
NOTE: The application is bootloaded from 0x48000. The same appliction when running without bootloading, from 0x00, it works without any issue.