Other Parts Discussed in Thread: BQ24735, BQ4050
I have a MSP-EXP432P401R connected to a SMBus via eUSCI0_B to a BQ24735 and BQ4050. Expanding the I2C driver lib examples, I was able to get the microcontroller talking to both devices. However I'm experiencing an occasional issue where the I2C_masterSendSingleByte gets stuck into an infinite while loop [while (!(EUSCI_B_CMSIS(moduleInstance)->rIFG.r & UCTXIFG))] causing the microcontroller to stall.
Specifically I'm trying to Read the BQ4050 battery status and then the BQ4050 relative state of charge (although I've tried to reverse the calls with the same result). On the second read the slave address is written out (Acknowledged), and then a stop condition occurs instead of the requested register address being written.
Here is the read function:
uint8_t ReadU1(uint8_t address)
{
uint8_t value = 0;
MAP_I2C_setSlaveAddress(EUSCI_B0_BASE, 0x0B);
// Set the address we want to read
MAP_I2C_setMode(EUSCI_B0_BASE, EUSCI_B_I2C_TRANSMIT_MODE);
MAP_I2C_masterSendSingleByte(EUSCI_B0_BASE, address);
// Verify the completion of the previous message
while (MAP_I2C_masterIsStopSent(EUSCI_B0_BASE));
value = MAP_I2C_masterReceiveSingleByte(EUSCI_B0_BASE);
return value;
}
On the scope you see
where you would expect to see
What could be causing the stop condition to occur earlier than expected?


