Other Parts Discussed in Thread: C2000WARE
Hello,
I have the following code to begin i2C communication which was extracted from the library provided
the MCU is getting stuck on the second while loop(I2C_STS_REG_ACCESS_RDY) if you have wrong slave address or if the sensor is faulty (due to power loss / or defective part) . otherwise it work well.
could you please advise how to detect sensor failure.
void I2CbeginTransmission(uint16_t slaveAddr)
{
while (I2C_getStopConditionStatus(I2CA_BASE));
I2C_setConfig(I2CA_BASE, (I2C_MASTER_SEND_MODE|I2C_REPEAT_MODE));
I2C_setSlaveAddress(I2CA_BASE, slaveAddr);
I2C_sendStartCondition(I2CA_BASE);
while(!(I2C_getStatus(I2CA_BASE) & I2C_STS_REG_ACCESS_RDY));
}
Best Regards,
M.