Part Number: MSP430FR5994
Other Parts Discussed in Thread: HDC2010,
For our hardware, we are using the MSP430FR5994’s Port B2 in I2C master mode to communicate with a HDC2010 humidity sensor on a battery-powered device. We’ve had some rare occasions on the boards in which the MSP430 locks up and the battery drains. We’ve finally traced it down to an issue with I2C master receive mode. In the file I2CEUSCIB.c in the MSP430 TI Drivers (version 2.20.00.08), in the function I2CEUSCIB_hwiIntFxn(), lines 315 through 325 are as follows:
/*
* Start the I2C transfer in master receive mode by sending a
* START and STOP bit since it's the last byte
*/
EUSCI_B_I2C_masterReceiveStart(hwAttrs->baseAddr);
while ( EUSCI_B_I2C_masterIsStartSent(hwAttrs->baseAddr) ) ;
EUSCI_B_I2C_masterReceiveMultiByteStop(hwAttrs->baseAddr);
Log_print1(Diags_USER2, "I2C:(%p) I2CEUSCIB_WRITE_MODE: -> I2CEUSCIB_READ_MODE; "
"Reading w/ RESTART and STOP",
hwAttrs->baseAddr);
The MSP430 will occasionally get stuck indefinitely on the while loop in the code above. It initiates the I2C start, but it never sees an acknowledgement that the start is sent. On a few boards, this occurs more regularly than others; it also appears that in certain high/low environmental temperature situations it occurs more frequently with certain boards. I believe a proper solution would be to have a count limit on the while loop and then to abort the transfer upon failure. However, we’re unsure of a reasonable loop limit count for this location. I’m assuming there is a reasonable limit based upon the I2C clock speed, but I’m not sure what that is. Do you have a suggested limit based upon the I2C bus settings, or another approach that may be suitable?
I also see a similar loop in I2CEUSCIB_primeTransfer(). Whatever solution makes sense in the ISR should also be applied in I2CEUSCIB_primeTransfer.
