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
Mahesh Mahadevan 2018-04-16 16:31:13 -05:00
parent f73415e9f8
commit 69a950c6eb
2 changed files with 18 additions and 0 deletions

View File

@ -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;
}

View File

@ -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;
}