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.

CCS/TMS320F28069M: My SPI interrupt isn't being triggered

Part Number: TMS320F28069M


Tool/software: Code Composer Studio

Dear forum,

recently I am working on project, in which I have to implement SPI interrupt triggered by writing to SPIBTX (16 bit value for my ADAC). I followed steps from Motorware HAL tutorial (because I have to use HAL in my project). From point 6.7, which is about UART interrupt I followed steps for implementing my SPI interrupt. So I did as follows:

1. Added spi.c and spi.h to my project.

2. Edited HAL_Obj.h 

3. Initialized SPI handles in hal.c

4. Prototyped and defined HAL_setupSpiB() init functions.

5. Called setup functions, enabled peripheral clocks (also changed GPIO's).

6. Added SPI interrupt enable "extern void HAL_enableSpiInts()"

7. I wanted my interrupt to be triggered by writing something in TX buffer, so I added int service in PIE table (group 6 is for SPI interrupts).

8. Added next few commands.

My code for interrupt looks like this:

The problem is that the interrupt won't be triggered by itself. I wanted it to be looped - by writing once dummy byte to TX buffer interrupt should be looped, but all i can see are static responses. What am I doing wrong?

  • Part Number: TMS320F28069M

    Tool/software: Code Composer Studio

    Dear forum,

    recently I am working on project, in which I have to implement SPI interrupt triggered by writing to SPIBTX (16 bit value for my ADAC). I followed steps from Motorware HAL tutorial (because I have to use HAL in my project). From point 6.7, which is about UART interrupt I followed steps for implementing my SPI interrupt. So I did as follows:

    1. Added spi.c and spi.h to my project.

    2. Edited HAL_Obj.h 

    3. Initialized SPI handles in hal.c

    4. Prototyped and defined HAL_setupSpiB() init functions.

    5. Called setup functions, enabled peripheral clocks (also changed GPIO's).

    6. Added SPI interrupt enable "extern void HAL_enableSpiInts()"

    7. I wanted my interrupt to be triggered by writing something in TX buffer, so I added int service in PIE table (group 6 is for SPI interrupts).

    8. Added next few commands.

    My code for interrupt looks like this:

    The problem is that the interrupt won't be triggered by itself. I wanted it to be looped - by writing once dummy byte to TX buffer interrupt should be looped, but all i can see are static responses. What am I doing wrong?

  • Your interrupt set up looks okay. To clarify the TX FIFO interrupt behavior--the interrupt is triggered when the TX FIFO level status (TXFFST) is less than or equal to the TX FIFO interrupt level (TXFFIL). Basically it's letting you know there's room in the FIFO--not that something has been written to it.

    You didn't share your actual SPI configuration. Are you just using the defult HAL_setupSpiB function from the HAL or did you edit it?

    Also, I don't see where you ack the interrupt either. If you aren't clearing PIEACK in your ISR, you won't get any additional interrupts.

    Whitney

  • Hello and thank You for Your response.

    Yes of course, here is my SPI setup:


    I edited original one by adding Phase and changing Baud Rate.

    Do I have to ACK interrupts triggered by "events"? I didn't know that, can I ACK tchem like I ACK Timer Interrupts?

  • Yes, you need to ACK all the interrupts that you configure in the PIE. You can use PIE_clearInt() to do it. You'll see that the mainISR() does it for the ADC interrupt in HAL_acqAdcInt().

    Did you set the FIFO level anywhere (SPI_setTxFifoIntLevel) or did you just leave it at the default?

    Whitney