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.

TMS320F28030: SPI Rx problem

Expert 1190 points
Part Number: TMS320F28030
Other Parts Discussed in Thread: C2000WARE

HI  I'm having a problem with  the SPI and can't seem to figure it out..

When sending 2 bytes of data,  data is stored and is followed by a null .

The data is sent once, but the pattern is repeated. until the fifo overflows setting  the overflow flag.

If a new word is sent it is ignored,  Can you review by source code to narrow down the problem

       SpiaRegs.SPICCR.bit.SPISWRESET=0;           // Reset SPI
       SpiaRegs.SPICCR.bit.SPICHAR = 0x0007;       // 8-Bit Character
       SpiaRegs.SPICCR.bit.SPILBK= 0;                       // Loop Back Disable
       SpiaRegs.SPICCR.bit.CLKPOLARITY = 0;          //



     SpiaRegs.SPICTL.all=0x0000;                                   //slave , normal spi clk,
    SpiaRegs.SPICTL.bit.OVERRUNINTENA = 1;          //Enable Over run flag
    SpiaRegs.SPICTL.bit.TALK = 1;                                    //enable the receiver’s SPISTE input pin
    SpiaRegs.SPICTL.bit.MASTER_SLAVE = 0;               // SLAVE
    SpiaRegs.SPICTL.bit.CLK_PHASE = 0;
    SpiaRegs.SPISTS.all=0x0000;                                       // Over run Flag ???



    SpiaRegs.SPICCR.bit.SPISWRESET= 1

 
    SpiaRegs.SPIFFRX.all=0x0028;                                    // Set RX FIFO level to 8
    SpiaRegs.SPIFFCT.all=0x00;                                         //    Transfer Buffer
    SpiaRegs.SPIPRI.all=0x0010;
    SpiaRegs.SPICCR.bit.SPISWRESET=1;                       // Enable SPI

   
    SpiaRegs.SPIFFRX.bit.RXFIFORESET=1;
    SpiaRegs.SPIFFTX.bit.TXFIFO=1;

  • Hi jw.

    • There is only a 4 word FIFO on the F2803x device. So SPIFFRX is not going to interrupt when you expect it. it will overrun at 4 words in the current configuration.
    • I do not understand what you mean when there are 2 words stored followed by a null after 2 bytes are received.
    • What is the goal of this code? Do you need to receive and store data? are you trying to just loop the received data back out of the SPI?
    • Does this always occur, or only sporadically happen?
    • Have you run through the examples provided for SPI in C2000Ware?
    • Have you read through the SPI users guide (http://www.ti.com/lit/sprug71) and do you understand it? 

    Thanks,
    Mark

  •  problem resolved
    thanks