Hello,
I am currently trying to port the I2C part of the driverlib for my MSP430F2618 project and am also looking at the i2c_master_tx_multi_int example. There is one part I don't understand:
After initializing I2C, the example enables the transmit Interrupt, loads the TX byte counter and initiates the transmission
//Enable transmit Interrupt
I2C_enableInterrupt(__MSP430_BASEADDRESS_USCI_B0__,
I2C_TRANSMIT_INTERRUPT
);
//Delay between each transaction
__delay_cycles(50);
//Load TX byte counter
transmitCounter = 1;
//Initiate start and send first character
I2C_masterMultiByteSendStart(__MSP430_BASEADDRESS_USCI_B0__,
transmitData[0]
);
The I2C_masterMultiByteSendStart function in the driverlib then disables the transmit interrupt again and starts polling on the transmit interrupt flag:
//Disable transmit interrupt enable
HWREGB(baseAddress + OFS_UCBxIE) &= ~(UCTXIE);
//Send start condition.
HWREGB(baseAddress + OFS_UCBxCTL1) |= UCTR + UCTXSTT;
//Poll for transmit interrupt flag.
while (!(HWREGB(baseAddress + OFS_UCBxIFG) & UCTXIFG)) ;
//Send single byte data.
HWREGB(baseAddress + OFS_UCBxTXBUF) = txData;
What is the purpose of the interrupt here if it is disabled and the flag is polled instead? Who is supposed to set the flag when data is put in the buffer after the polling?
Thank you
Andreas