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.

SPI Interrupts

Hi again,

I am using the SPI module in interrupt mode with FIFO.  I am using the STE signal as a chip select which in most cases works fine.  The case that I am having issues with is when the SPI interrupt for transmitting fires multiple times in a row.  I have set the FIFO level to 3 and SPICHAR to 8, but I am seeing back to back bursts of 24 bits without the chip select going low.

How can I force the STE pin low after 24 bits exactly are transmitted?  My best solution at this point was to pause at the end of the TX interrupt with a simple for loop counting to 100k.  It's hacky at best and unreliable at worst, so is there a better way?

I doubt it makes much of a difference for this problem but I'm using an F28377S.

Thanks!

  • David,

    The C28x SPI module will hold the SPISTE module low as long as there is data available to transmit. You are using FIFO, and I am assuming that you are referring to the TX FIFO level being set to 3, correct? 

    If this is the case, when the number of words in the TX FIFO drop below three, you will (and I am assuming here again, correct me if I am wrong) add more data, probably another 24 bits to the FIFO.  Since there is always data, the SPISTE will stay low. The only way to allow SPISTE to return to the inactive state, you need to allow the TX FIFO to fully empty, and the last word be fully transmitted.

    One suggestion would be to use the RX Interrupt exclusively. Since the SPI is basically just an automated shift register, you know that when you receive 3 words, or 24 bits in this case, the Transmitter has completed sending the full 3 words. There will be some latency in the SPI recognizing the condition, and reaching the RX FIFO interrupt, but you can immediately place three more words in the transmit buffer to send. 

    Here is some (very quickly typed up) pseudocode to help explain what I mean.

    spiconfig{

    //spi config 

    ..

    SPIFFRX.RXFFIL = 3;
    SPIFFRX.RXFFIENA = 1;

    //more config

    ..

    }

    SpiRx_Isr{

    SPITXBUF = data[0] << 0x8;
    SPITXBUF = data[1] << 0x8;
    SPITXBUF = data[2] << 0x8;

    // do rx stuff here

    }

    -Mark