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.

TM4C1294NCPDT: SPI CAN NOT TRANSFER DATA

Part Number: TM4C1294NCPDT
Other Parts Discussed in Thread: EK-TM4C1294XL

Hi,teams

    I want to use  TM4C1294XL  launchpad  to  accomplish  SPI communication.

But now,  I have been unable to write data to SSI_DR_DATA .SSI_DR_DATA register is always 0.

I do not know why.Can I miss something?Below is my code. Can you help me? Thank you.

  • Hi,

      Before your while(1) can you first clear out any residual data from the SSI port? Add the below example line. 

    //
    // Read any residual data from the SSI port. This makes sure the receive
    // FIFOs are empty, so we don't read any unwanted junk. This is done here
    // because the SPI SSI mode is full-duplex, which allows you to send and
    // receive at the same time. The SSIDataGetNonBlocking function returns
    // "true" when data was returned, and "false" when no data was returned.
    // The "non-blocking" function checks if there is any data in the receive
    // FIFO and does not "hang" if there isn't.
    //
    while(SSIDataGetNonBlocking(SSI2_BASE, &pui32DataRx[0]))
    {
    }

    Please replace SSIDataPutNonBlocking with SSIDataPut.  This function places the supplied data into the transmit FIFO. If there is no space available in the transmit FIFO, this function waits until there is space available before returning. Do the same same to replace SSIDataGetNonBlocking with SSIDataGet. SSIDataGetNonBlocking will return zero if there is no data in the FIFO. SSIDataGet will wait until data is received before returning if there is no data available. 

    I will also suggest you take a look at the examples in C:\ti\TivaWare_C_Series-2.2.0.295\examples\peripherals\ssi and C:\ti\TivaWare_C_Series-2.2.0.295\examples\boards\ek-tm4c1294xl\ssi_master_slave_xfer.