mirror of https://github.com/ARMmbed/mbed-os.git
MCUXpresso: Fix SDK LPC driver
Poll the Pending bit after START and STOP operations to ensure operation completion. Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>pull/6647/head
parent
f73415e9f8
commit
69a950c6eb
|
@ -163,6 +163,8 @@ status_t I2C_MasterStart(I2C_Type *base, uint8_t address, i2c_direction_t direct
|
|||
/* Start the transfer */
|
||||
base->MSTCTL = I2C_MSTCTL_MSTSTART_MASK;
|
||||
|
||||
I2C_PendingStatusWait(base);
|
||||
|
||||
return kStatus_Success;
|
||||
}
|
||||
|
||||
|
@ -171,6 +173,9 @@ status_t I2C_MasterStop(I2C_Type *base)
|
|||
I2C_PendingStatusWait(base);
|
||||
|
||||
base->MSTCTL = I2C_MSTCTL_MSTSTOP_MASK;
|
||||
|
||||
I2C_PendingStatusWait(base);
|
||||
|
||||
return kStatus_Success;
|
||||
}
|
||||
|
||||
|
|
|
@ -201,6 +201,12 @@ status_t I2C_MasterStart(I2C_Type *base, uint8_t address, i2c_direction_t direct
|
|||
/* Start the transfer */
|
||||
base->MSTCTL = I2C_MSTCTL_MSTSTART_MASK;
|
||||
|
||||
result = I2C_PendingStatusWait(base);
|
||||
if (result == kStatus_I2C_Timeout)
|
||||
{
|
||||
return kStatus_I2C_Timeout;
|
||||
}
|
||||
|
||||
return kStatus_Success;
|
||||
}
|
||||
|
||||
|
@ -214,6 +220,13 @@ status_t I2C_MasterStop(I2C_Type *base)
|
|||
}
|
||||
|
||||
base->MSTCTL = I2C_MSTCTL_MSTSTOP_MASK;
|
||||
|
||||
result = I2C_PendingStatusWait(base);
|
||||
if (result == kStatus_I2C_Timeout)
|
||||
{
|
||||
return kStatus_I2C_Timeout;
|
||||
}
|
||||
|
||||
return kStatus_Success;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue