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.

RTOS/TM4C1292NCPDT: SPI Interrupt

Part Number: TM4C1292NCPDT

Tool/software: TI-RTOS

Hi,

In my code,I want to generate an interrupt when  spi write happens. I am using SPI2 and SPI is in slave mode . For interrupt generation, I did the following,

void AnalogOutputDACISRHandler()

{

uint32_t ui32Status;

 int count=0;

 GPIO_toggle(Board_LED2);       // Given for testing purpose

  if (count <= 100) {

  count ++;

  }

/* Read the interrupt status of the SSI. */

ui32Status = SSIIntStatus(SSI2_BASE, TRUE);

SSIIntClear(SSI2_BASE, ui32Status);

}

And in the function from which interrupt should be generated, I have given

SSIIntRegister(SSI2_BASE, AnalogOutputDACISRHandler);

SSIIntEnable(SSI2_BASE,SSI_TXFF);

 

In spi.h I have seen a function ,

SPI_serviceISR(SPI_Handle handle)

Is this function needed? Where to use this?

 

Is anything else needed to generate SPI interrupt? Please guide me.

 

Thanks & Regards

Sandra

 

  • As you note that your MCU is a "slave" to an SPI "master" - would not it prove more robust to have that master "monitor its data received" - and employ that (more complete) event as, "verification of the slave's SPI write?"    (i.e. the slave's transmission - and the wired connection - and the master's reception - are ALL confirmed - via this (more complete) transaction monitor.)

    The method you suggest does not speak to the: success of the reception by the master - which is the (real) objective - is it not?

  • Please tell me how to configure SPI interrupt.
    After getting interrupt I have to post an event and have to do further tasks when this event is pended.
    Please tell me why the function SPI_serviceISR(SPI_Handle handle) is provided in spi.h and how to use this function in code?
  • Your MCU is a "slave" to another - is it not - thus that "master" must receive your slave's transmission.    (I'm repeating here - what was presented earlier - as you've made no response (avoided) the earlier suggestion...)

    It is easiest if you employ a, "Command-Response" style of SPI operation - in which the master makes a request (i.e. command) of the slave - and then "expects" the slave's response.   In high contrast - you (seem) to be seeking a, "Slave driven interrupt" upon the slave's "SPI Write" - (which is clearly known - your slave has generated that write - has it not?) - thus appears w/out value.

    Should you "disagree" w/this (more normal) approach - perhaps your use of the forum's Search Box - aimed specifically at "Slave SPI operation" -may uncover "successful implementations" by other users... I am doubtful that (others) have employed the method you have chosen (and locked onto...)

  • Thank you very much for the response.
  • You and others must note the, "Lack of clear & detailed" code examples - when the MCU is cast as, "SPI Slave." Thus - much (needed) info remains w/in the "belly of the beast" (i.e. vendor) and they (usually) arrive here "late in the day" Sunday (US time) and may be able to supply such "inside, unpublished" (yet needed) detail.

    I've made the effort to read the API & MCU manual - keying on "Slave-specific" implementations - nothing of high value (to your requirement) revealed to me...