Hello,
I'm having an issue with the last byte of a MasterSend transmission not being transmitted, and I have a feeling it's with the order of calls I'm making( or not making). I've tested this with both my I2C Slave, and with an Aardvark as I2C slave, and they both behave the same, so I'm feeling the problem lies in my master code.
The only interrupt I'm using is the EUSCI_B_I2C_NAK_INTERRUPT, as this code communicates with multiple slaves, and which can sometimes be not present. Here is the order of calls.
//Specify slave address EUSCI_B_I2C_setSlaveAddress(EUSCI_B0_BASE, toSlaveAddress); //Set Master in transmit mode EUSCI_B_I2C_setMode(EUSCI_B0_BASE, EUSCI_B_I2C_TRANSMIT_MODE); //Enable I2C Module to start operations EUSCI_B_I2C_enable(EUSCI_B0_BASE); EUSCI_B_I2C_enableInterrupt(EUSCI_B0_BASE,EUSCI_B_I2C_NAK_INTERRUPT); EUSCI_B_I2C_masterSendMultiByteStart (EUSCI_B0_BASE,command[0] ); while(!(EUSCI_B_I2C_getInterruptStatus(EUSCI_B0_BASE, EUSCI_B_I2C_TRANSMIT_INTERRUPT0))){ if (NACKReceived == true) { NACKReceived = false; StopI2C(); return; } } EUSCI_B_I2C_masterSendMultiByteNext(EUSCI_B0_BASE,command[1]); while(!(EUSCI_B_I2C_getInterruptStatus(EUSCI_B0_BASE, EUSCI_B_I2C_TRANSMIT_INTERRUPT0))){} EUSCI_B_I2C_masterSendMultiByteFinish(EUSCI_B0_BASE,command[2]); StopI2C();
If I add another call to EUSCI_B_I2C_masterSendMultiByteNext prior to the EUSCI_B_I2C_masterSendMultiByteFinish, that byte is transmitted, and the last byte is still not sent.
I'm fairly new to the MSP platform, but not to embedded, so feel that I'm missing something, obviously
Any thoughts appreciated
Regards
Jonny