Part Number:MSP432WARE
Hi folks,
I'm using the TI DriverLib for the I2C interface. Many of the calls support a 'timeout" option, which prevents hanging. However, there are some basic functions like I2C_isBusBusy(), I2C_getInterruptStatus(), I2C_masterIsStartSent(), I2C_masterReceiveMultiByteNext() and others which do not support a timeout option.
In particular, if I fail to read from a device (perhaps because it isn't connected), I often see the EUSCI_Bx.STATW.UCBBUSY bit set to 1, which indicates that the bus is "busy". That means that then next time I try to do a read or write to some other device on the I2C bus, the following will hang:
while (MAP_I2C_isBusyBusy(moduleInstance));
There is no timeout for this function, and I do not see any way to clear the busy bit to permit other I2C transactions to continue.
If an I2C call fails with a timeout, what is the recommended way to reset the state of the I2C controller to permit other operations to continue (perhaps with other I2C devices on the same EUSCI_Bx channel?
It seems like this is a flaw in DriverLib, where some operations support timeout and some do not. There also does not appear to be a simple way to put the I2C controller back into the state it was in before an operation failed due to a timeout.
Can someone please provide an example of how to properly reset the I2C interface following a timeout? I have tried writing to the UCBBUSY bit to clear it, but that does not seem to work.
I have both TMP007 temperature sensors and AT24D02 EEPROMs on the same I2C interface, and need communications to be robust. Your help is sincerely appreciated!
Scott