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.

TMS320F28335: Confusion about Example_2833xSpi_FFDLB_int

Part Number: TMS320F28335


Hi, I am puzzled by the example.

Is there anyone who can expain it? Here are my questions:

First, how can an interrupt occur when we just loop here? As is shown in the second question, data is sent in the interrupt function and I think nothing has been done in the loop. I am a little confused about SPI interrupt in FIFO mode.

Second, why the data is written to SPITXBUF rather than TXFIFO? Or how can I write data to TXFIFO?

Thanks in advance.

  • First question is about this step:
    // Step 6. IDLE loop. Just sit and loop forever (optional):
    for(;;);
    }

    Second is:
    __interrupt void spiTxFifoIsr(void)
    {
    Uint16 i;
    for(i=0;i<8;i++)
    {
    SpiaRegs.SPITXBUF=sdata[i]; // Send data
    }
    ......
    }
  • The example sets the TXFFIL (FIFO interrupt level field) to 8 which means that the TXFIFO interrupt occurs when there are 8 or fewer words in the TX buffer. At the beginning of the program, there are probably 0 words in the buffer and so you get an interrupt as soon as you enable it without having to take any action in or before the loop.

    To answer your second question, writing to SPITXBUF will put your data into the FIFO. You can't write directly to the FIFO yourself--it all has to go through SPITXBUF. It's explained in a little more detail in Kris' post here:

    e2e.ti.com/.../2257026

    Whitney