Tool/software:
Hi,
Customer want to reduce the device bootup time. They used I2C in their system and found there is a 30ms delay in I2C_probe. How can customer reduce it?
Below code seems to check if I2C status is correct or not, right? The NACK bit will set then clear, right? Any other way to implement this faster?
/* try to write one byte */
I2CControllerDataPut(object->baseAddr, (uint8_t) 0U);
I2CSetDataCount(object->baseAddr, (uint32_t) 1U);
/* stop bit needed here */
I2CControllerControl(object->baseAddr,I2C_CFG_MASK_STOP,(
I2C_CFG_CMD_TX | I2C_CFG_CMD_START | I2C_CFG_CMD_STOP));
/* enough delay for the NACK bit set */
ClockP_usleep(I2C_DELAY_BIG);
if (0U == I2CControllerIntStatusEx(object->baseAddr, I2C_INT_NO_ACK))
{
retVal = I2C_STS_SUCCESS; /* success case */
}
else
{
/* Clear sources*/
I2CControllerIntClearEx(object->baseAddr, I2C_ALL_INTS);
/* finish up xfer */
I2CControllerStop(object->baseAddr);
(void)I2C_waitForBb(object->baseAddr, I2C_DELAY_MED);
retVal = I2C_STS_ERR; /* Error case */
}
Thanks,
Chris