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.

CCS/TMS320F28377S: ?

Part Number: TMS320F28377S


Tool/software: Code Composer Studio

I am using SPI_A on the TMS320F28377S. The TMS320F28377S is the master, and I have several slaves. For each slave, I have a GPIO controlling the chip select.

For one of the slaves, I have to transmit 3 x 16 bit words and the rising chip select latches the data in on the slave side. This forces my program to monitor the end of the SPI data transmission and de-assert chip select only after all data has been sent. I have a while loop to wait until SpiaRegs.SPIFFTX.bit.TXFFST is empty then set chip select high. The oscilloscope shows more data being transmitted after SpiaRegs.SPIFFTX.bit.TXFFST returns zero so my chip select latches only part of the data. It appears the TXFIFO being empty doesn't indicate all data has been sent.

Uint16 sdata, t0, t1;

t0 = 0x0034;

t1 = 0x0177;

GPIO_WritePin(35, 0);  // chip select DDR

sdata = 0x2068; 
spi_xmit(sdata);

sdata = t0 + 0x4000;  
spi_xmit(sdata);

sdata = t1 + 0x4000;
spi_xmit(sdata);


while(SpiaRegs.SPIFFTX.bit.TXFFST != 0)
{
;
} // make sure SPI_A TX BUFFER is empty

GPIO_WritePin(35, 1);

After setting GPIO_35 high, the oscilloscope still showing data being transmitted so the TXFFST being zero is not the end of the transmission. Is there a guaranteed method for the program to know when all SPI data has been sent?