This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello everyone,
as i have started with the SPI interface which i want to communicate with COG LCD, i have a basic questions regarding the SPI configuration:
so after configuring the register for the SPI an looked at the example from MSP430ware, i wanted to understand why when i write to the UCA0TXBUF, after or before the while(!(IFG2 & UCA0TXIFG)); has no effect on the bit UCA0TXIFG (which is all the time 1) and has only set the bit UCA0RXIFG to 1 even though i have used no reception of data.
in the datasheet , it says that when UCA0TXIFG=1 the data has moved to from UCA0TXBUF to Tx shift register and also that the UCA0TXBUF is empty ( interrupt pending), but when i check the register on CCS i see all the time the UCA0TXIFG is set to 1 an theUCA0TXBUF never go empty. please anyone can clear my doubt about it, i will be thankfull.
best regards,
tarik
Hi Tarik,
SPI is a full duplex interface. Every time you transmit one byte, you receive a byte. The byte may have no meaning, depending on the protocol, but at the hardware level, data is always being received. I think what might help clarify what you are seeing is in section 16.3.3 of the reference manual (slau144).
A set transmit interrupt flag, UCxTXIFG, indicates that data has moved from UCxTXBUF to the TX shift register and UCxTXBUF is ready for new data. It does not indicate RX/TX completion.
To receive data into the USCI in master mode, data must be written to UCxTXBUF because receive and transmit operations operate concurrently.
Therefore it is plausible reasonable to expect that the UCxTXIFG always appears to be 1 because its just moving from the register to a shift register in the peripheral, which is very fast unless its busy transmitting and has to wait.
Hello Chris,
thank you very much for your answer, in other term if i want to check that i am sending data(in case of a lot of data), i need just to check the UCBUSY.
Yes, if you are transmitting or receiving a bunch of data and you just want to check when the entire transaction is complete, you could use can check the value of UCBUSY.
**Attention** This is a public forum