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/TMS320VC5509A: Suspected Stack Corruption Issue

Part Number: TMS320VC5509A

Tool/software: Code Composer Studio

I am having an issue returning from an interrupt.  I am using an interrupt to set a flag that is then dealt with in my main function.  The interrupt returns properly when I only use it to set the flag.  However, I had originally called an assembly function from my C code within the interrupt to set a GPIO bit for debugging purposes and then called another assembly function to clear the GPIO bit.  When I do this, the interrupt never returns and the program stops executing.  I have tried playing with all of the stack settings I have found in the documentation and I have not been able to get it to return properly or figure out where the problem is.  Additionally, the functions return fine when called from main.  I would just take the function calls out of my interrupt, but I am having an issue with another assembly function returning and I suspect they are related.  Any suggestions?

  • Hi Matt,

    Could you attach the source code example?

    BR
    Tsvetolin Shulev
  • Sure,

    Here are my interrupt functions:

    interrupt void int0ISR(){
    SetGPIOInterrupt();
    dataReadyFlag = 1;
    ClearGPIOInterrupt();
    }


    interrupt void InterNull(){

    }

    Here are the SetGPIOInterrupt() and ClearGPIOInterrupt() asm functions:

    _SetGPIOInterrupt:
    OR #0x00004, port(#0x3401)
    RET

    _ClearGPIOInterrupt:
    AND #0xFFFB, port(#0x3401)
    RET

    And here are my interrupt vectors:

    .sect .vectors
    ; Interrupt table (vectors 0 through 15).
    InterDspTable .ivec _InterNull ; Reserved.
    .ivec _InterNull ; NMI.
    .ivec _int0ISR ; INT0 (New segment).
    .ivec _InterNull ; INT2 (New major frame).
    .ivec _InterNull ; TINT0.
    .ivec _InterNull ; RINT0.
    .ivec _InterNull ; RINT1.
    .ivec _InterNull ; XINT1.
    .ivec _InterNull ; USB.
    .ivec _InterNull ; DMAC1.
    .ivec _InterNull ; DSPINT.
    .ivec _InterNull ; INT3. 
    .ivec _InterNull ; RINT2.
    .ivec _InterNull ; XINT2.
    .ivec _InterNull ; DMAC4.
    .ivec _InterNull ; DMAC5.
    ; Interrupt table (vectors 16 through 23).
    InterHostTable .ivec _InterNull ; INT1.
    .ivec _InterNull ; XINT0.
    .ivec _InterNull ; DMAC0.
    .ivec _InterNull ; INT4.
    .ivec _InterNull ; DMAC2.
    .ivec _InterNull ; DMAC3.
    .ivec _InterNull ; TINT1.
    .ivec _InterNull ; IIC.
    ; Interrupt table (vectors 24 through 31).
    InterDspTableCont .ivec _InterNull ; BERR.
    .ivec _InterNull ; DLOG.
    .ivec _InterNull ; RTOS.
    .ivec _InterNull ; SOFT 27.
    .ivec _InterNull ; SOFT 28.
    .ivec _InterNull ; SOFT 29.
    .ivec _InterNull ; SOFT 30.
    .ivec _InterNull ; SOFT 31.

  • I'm sorry for delayed replay. You can find an example for fully functional GPIO interrupt handling project - CSL_GPIO_InputPinExample.

    BR
    Tsvetolin Shulev