Part Number: TMS320F280049C
Tool/software: Code Composer Studio
Hello e2e community,
i've a question:
I made a misstake in the isr nesting programming. I set the IER bit for the TIMER1 ISR in its own ISR:
__interrupt void tim1_isr(void){
IER |= ((1<<12U) | (1<<6) | (1<<5) | (1<<0)); // bit 12 is TIMER1 irq (its own)
IER &= ((1<<12U) | (1<<6) | (1<<5) | (1<<0));
PieCtrlRegs.PIEACK.all = 0xFFFF; // enable PIE interrupts
asm(" NOP"); // wait one cycle
asm(" clrc INTM"); // clear INTM to enable interrupts
// ISR content
CpuTimer1Regs.TCR.bit.TIF = 1; // clear timer irq flag
asm(" setc INTM"); // set INTM to disale interrupts
}
This results in a total software crash. But the crash happens only after a few periods of the isr. After a couple of time, i found out, that the crash happens only if a new interrupt is pending during the execution of the isr. So i tried to manually set the IFR bit in the ISR to force the problem to exclude other issues:
__interrupt void tim1_isr(void){
IER |= ((1<<12U) | (1<<6) | (1<<5) | (1<<0)); // bit 12 is TIMER1 irq (its own)
IER &= ((1<<12U) | (1<<6) | (1<<5) | (1<<0));
PieCtrlRegs.PIEACK.all = 0xFFFF; // enable PIE interrupts
asm(" NOP"); // wait one cycle
asm(" clrc INTM"); // clear INTM to enable interrupts
asm(" OR IFR, #0x1000");
// ISR content
CpuTimer1Regs.TCR.bit.TIF = 1; // clear timer irq flag
asm(" setc INTM"); // set INTM to disale interrupts
}
After setting the IFR bit in the ISR the software crash happen.
Can someone explain this issue, that I have a better understanding of the interrupt nesting?
Thank you!
Just for my better understanding: