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/TMS320F28069: Never go into others interruption that Cpu_timer_0

Part Number: TMS320F28069
Other Parts Discussed in Thread: CONTROLSUITE

Tool/software: Code Composer Studio

Hello everyone ,

I start a new CSS project , I am adding manually all needed files.

Then i configure CPU0 interruption , and SPI interruption.

The problem is that only the cpu_timer_0 interruption works. 

I also add cpu_timer_1 interruption to test , and same result. Only the cpu_timer_0 interrrupt works.

I test with an exemple from ti / Controle suite/ devices support [....] : SPI_ lookback_int , and I add in this example the cpu_timer_0 interruption. and It works.

I am confused , I have probably the same code that in the example from control_ suite, but something is missing .

For the spi_fifo_init I have the same configuration that in your example .

 

 

My configuration :

 

SysCtrlRegs.PCLKCR3.bit.CPUTIMER0ENCLK = 1; // CPU Timer 0

SysCtrlRegs.PCLKCR0.bit.SPIAENCLK = 1;     // SPI-A

I have this line for interruption : 

EALLOW; // This is needed to write to EALLOW protected registers
PieVectTable.TINT0 = &cpu_timer0_isr;
PieVectTable.SPIRXINTA = &spiRxFifoIsr;
PieVectTable.SPITXINTA = &spiTxFifoIsr;

EDIS;

--------------------------------------------------------------------------------------------

// Enable CPU INT1 which is connected to CPU-Timer 0
IER |= M_INT1;
IER |= M_INT6;

--------------------------------------------------------------------------------------------

// Enable TINT0 in the PIE: Group 1 interrupt 7
PieCtrlRegs.PIEIER1.bit.INTx7 = 1;

PieCtrlRegs.PIEIER6.bit.INTx1=1; // Enable PIE Group 6, INT 1 SPI A TX
PieCtrlRegs.PIEIER6.bit.INTx2=1; // Enable PIE Group 6, INT 2 SPI A RX

-------------------------------------------------------------------------------------------

// Enable the PIE
PieCtrlRegs.PIECTRL.bit.ENPIE = 1;

// Enables PIE to drive a pulse into the CPU
PieCtrlRegs.PIEACK.all = 0xFFFF;

For my interruption I have : 

__interrupt void cpu_timer0_isr(void)
{

DAC1(DAC_order1 ,1);

CpuTimer0Regs.TCR.bit.TIF=1; // Timer flag set to 0

PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; // Acknowledge this interrupt to receive more interrupts from group 1

}

__interrupt void spiTxFifoIsr(void)
{
sdata ++ ;
SpiaRegs.SPIFFTX.bit.TXFFINTCLR=1; // Clear Interrupt flag
PieCtrlRegs.PIEACK.all = PIEACK_GROUP6 ; // Issue PIE ACK
}

The sdata variable is never incrementer , and in debug mode I can see that he never pass in the SPI_Tx interruption.

If you have any suggestion .

Thank you

Alain

  • I don't see any missing interrupt enables for the SPI. Have you looked at the Registers window in CCS to confirm that the registers reflect the expected values? Can you see the interrupt flags being set in the SPI module?

    Whitney

  • Whitney ,

    Thank you for your answer .

    I control that the register refelct the expected values and I confirm that the values are right.

    I also check interrupt flag , as you can see in the picture the TXFFINT is set to 1.

    I didn't think is an SPI configuration problem.

    Because If I add another interruption , like cpu_timer 1 where is from PIEVECT GROUP 13 , this interruption doesn't work too.

    I think is a general problem with interruption. I don't understand how the Cpu_timer 0 can work and all other interruption not works.

    Alain.

  • Hi Alain,

    I think what might be happening is that your CPU TImer 0 interrupts are happening very fast. It might be so fast that by the time the CPU timer 0 interrupt is serviced, another interrupt is already pending from CPU timer 0. 

    Since the SPI and the Timer 1 interrupt are all lower priority when compared to CPU timer0, the CPU timer 0 is repeatedly getting serviced leaving the other interrupts pending forever. 

    I am not sure what is your purpose of using CPU Timer 0, but if you could lower the frequency at which the CPU timer interrupts the CPU, the CPU will have bandwidth to service other interrupts. 

    Hope this resolves your issue. If it does, please click on "verify answer" button at the end of this post.

    Thanks & Regards

    Pramod

  • Pramod ,

    I change frequency of my cpu_timer_0 interrupt and change nothing( 100 ms)

    What I try , take the example of control suite : spi_loopbackint , which is the example of SPI with interruption. In this example I had the Cpu_timer_0 interrupt.

    And in this example all work fine, with an Cpu_timer_0 interruption of 20 ms.

    In my own project , I have the define the same Spiaregs as found in the example. But never go in others interruption that Cpu_timer_0.

    Maybe a header file is missing ...  I have no warning , no error ... I dont now what really happend.

    Thanks

    Alain

  • I have news information , after using debug mode using " step by step " of CCS , at the end of the interruption Cpu_timer_0 just after the } the program go to void abort (void). ( picture linked )

    Moreover I don't see this problem in "play(running) " mode , my ADC, DAC running good , SPI communication works.( so he never go into this abord function )

    I don't know if this could be linked to the previous problem. Maybe ...

    It seems that he don't go all the time in this abord function.  Just Sometimes.

    Alain

  • Alain,

     

    That’s good progress. Please check the disassembly window to see what instructions are being executed at the end of this ISR (is it a normal LRETR instruction or the IRET)?

    This looks to be an issue with the interrupt function declaration. Please see if you have this line added for the interrupt declaration at the beginning of your file. (I don’t see this in the configuration you have posted above). 

     __interrupt void cpu_timer0_isr(void);

     Ideally all interrupts need to declared the same way.

    Missing the interrupt declaration could be one of the possibilities where the compiler treats the ISR function as a normal function call and you might be seeing this error.

    Hope this resolves your issue. If it does, please click on "verify answer" button at the end of this post.

    Thanks & Regards

    Pramod

  • I found the issu of the abord, It seem that somethings was wrong in the spiTxFifoIsr . if in this interruption I increment a variable and comment these two line :

    SpiaRegs.SPIFFTX.bit.TXFFINTCLR=1; // Clear Interrupt flag
    PieCtrlRegs.PIEACK.all = PIEACK_GROUP6 ; // Issue PIE ACK

    He go in abord (void).

    Moreover , if I add others things like  "SpiaRegs.SPITXBUF = Command_XY.channel_1 ;" and comment the 2 line two , he never go into abord(void).

    So this problem is solve.

     

     

    But my first problem, where was that he never go into others interruption is not. And this is mistery.

    If the spi_lookback_int example from control suite works , by adding the cpu_timer_0 interruption ,

    and my new projet not , this seems that a file or a declaration is mising...

    I have the same declaration , same SPI register values , same interruption frequency , prototypes functions declaration .

    InitSysCtrl(); is same  I control all lane .

    thank you ,

    Alain.

  • Alain,

    Do you have the IRET instruction at the end of CPU timer 0 ISR ?

    Please open the disassembly window(go to View->Disassembly) on CCS and check at the end of ISR which is the return instruction.

    Thanks & Regards

    Pramod

  • Pramod ,

    I think yes , but I add a capture of the disassembly , with a breack point a the end of my interruption.

    I also found this in your forum it was my case.

    The function exit is called when main has completed.  Note how exit ends by calling the function abort, and abort ends with a spin loop.  In most embedded systems, the function main should never finish.  Is this the case in your system?  If so, then you need to work out why the main function somehow completed. 

    Alain.

  • Alain,

    I’ll take it from your answer that the ISR indeed is returning with an IRET instruction.(I don’t see the IRET captured in your snapshot though. Would be good confirm via snapshot whether it is an IRET or an LRETR). 

    It is true that once the main finishes, the exit routine will be called(part of the compiler code). It is very likely that sometimes if the compiler optimizations are enabled and the interrupts are not correctly configured, the compiler treats it like a usual function call instead of an ISR. I am certain that the end of your ISR(interruption) is an LRETR as this seems to be the only logical explanation for the function to come out of main and move on to the exit routine which contains the abort function.

    Since you mentioned that it works on the project from controlsuite, I suggest you make compare the project properties from the control suite with your project properties. That will give you an idea on what the difference could be.

    You could try turning off the optimization from the project settings if in case it is enabled.

     

    Thanks & Regards

    Pramod

  • Pramod ,

    How can i confirm via whether it is an IRET or an LRETR.

    Firstly I don't know what is IRET or LRETR , so i check on google to understand a bit more about this 2 words.

    Now I don't know how I can confirm this.

    If you have advice.

    Thank you ,

    Alain.

  • ALAIN,

    IRET and LRETR are kinds of return instructions for C28. IRET is called when you return from an Interrupt service routine. LRETR is called when you return from a normal function call. More details on these instructions are described in the C28 architecture manual. http://www.ti.com/lit/ug/spru430f/spru430f.pdf.

    The disassembly window snapshot which you have posted does not have either of these instructions. This is not clear from the snapshot. If you could put up the snapshot of the disassembly around the end of your ISR, that would confirm what kind of return instruction you have. Whatever snapshot of the disassembly you have put so far shows the disassembly till the last instruction. My point of interest is what happens after that.

    My guess is that if you have an LRETR at the end of this function, it would return to the function which was last called and that could be your main. Hence you might be seeing it coming out of the main function and execute the abort function.

    Please check the following:

     

    1)      Check for the return instruction from the ISR like I explained above.

    2)      Check for the project properties if you have enabled any optimization and disable it once if enabled.

    3)      Also, since you mentioned that it works on the project from controlsuite, I suggest you make compare the project properties from the control suite with your project properties. That will give you an idea on where the difference could be.

     

    Thanks & Regards

    Pramod

  • Hello , 

    I seem that interruption works now , I just finish my program.

    Maybe because the SPI was not define correctly that could pose problem .

    I don't know , i change nothing else.

    Thanks you for the time you pass to help me to find the issue

    Alain.