High priority interrupt is not calling while currently in low priority interrupt in Aurix TC27x

542 Views Asked by At

I am using Aurix Tricore TC27x board. Here I am using two interrupts, one interrupt will occur for every 5us(High Priority) and another interrupt will occur for every 100us(Low Priority). The time for executing the 100us(Low Priority) interrupt is 40us, so while executing the 100us(Low Priority) interrupt if 5us(High Priority) interrupt comes context switching is not happening.

After completing the Low priority interrupt then only switching is happening to High Priority interrupt. Because of this I lost data.

Why it is not preempted?

Thanks in Advance.

2

There are 2 best solutions below

0
On

As Martin James already mentioned in his comment and Steve Mitchell in his answer, you need to re-enable interrupts in the ISR. In TASKING Compiler, this is done a bit more intuitively with the __enable_ statement in the function definition:

void __interrupt(YOUR_INT_PRIO) __vector_table(YOUR_INT_PROVIDER) __enable_ name_of_your_isr (void)
{
   /* this ISR may be interrupted */
   /* your code here */
}

If you don't use the __enable_ statement, the ISR can't be interrupted, even if it has a lower priority than a more recent priority. After finishing the ISR, the IRQ with the highest priority (=highest number) of all pending IQRs is served.

void __interrupt(YOUR_INT_PRIO) __vector_table(YOUR_INT_PROVIDER) name_of_your_isr (void)
{
   /* this ISR will NOT be interrupted */
   /* your code here */
}

For other compilers read the user manual of your compiler or have a look at the "TriCore TC1.6P & TC1.6E Core Architecture User Manual" from Infineon in the section about the Interrupt System.

0
On

try using the __bisr(IPRN) when installing the interrupt handler, this will allow high priority interrupts to interrupt lower priority interrupts. Im not sure if this is included with all compilers but is definitely available with the tasking compiler.