Part Number: MSP432P401R
Working with a TCA6408A I'm trying to do an I2C read, and the EUSCI_B peripheral appears to be behaving badly as reported here:
and marked as resolved (but the resolution is claimed to be insufficient by the poster and appears insufficient on my end.
After a sequence of writes to configure an I2C Peripheral I try to perform a read as shown:
With the following code:
I2C_setMode(EUSCI_B0_BASE, EUSCI_B_I2C_TRANSMIT_MODE);
I2C_masterSendMultiByteStart(EUSCI_B0_BASE,0x00);
I2C_setMode(EUSCI_B0_BASE, EUSCI_B_I2C_RECEIVE_MODE);
buttonState = I2C_masterReceiveSingleByte(EUSCI_B0_BASE);
On the bus I can observe: 0x42,0xFF,0x43,0x7F so I'm concerned it doesn't transmit the register address properly unless I insert a delay.
I2C_setMode(EUSCI_B0_BASE, EUSCI_B_I2C_TRANSMIT_MODE);
I2C_masterSendMultiByteStart(EUSCI_B0_BASE,INPUTMANAGERINPUTPORTREG);
for(volatile unsigned long i = 500;i;i--){}
I2C_setMode(EUSCI_B0_BASE, EUSCI_B_I2C_RECEIVE_MODE);
buttonState = I2C_masterReceiveSingleByte(EUSCI_B0_BASE);
I intend to clean up that delay and make something interrupt driven in the future. but for now I can get it to transmit the register address with the above code: 0x42,0x00,0x43,0xDF,0xDF
So having paused and gotten through the transmission, I find that I2C_masterReceiveSingleByte doesn't in fact send a NACK or STOP. Why does it receive so much more than a byte?
Why does it leave the bus busy after I2C_masterReceiveSingleByte?
Is there a good example out there of an I2C read with this driver?
Thanks