FreeRTOS IRQ handler problem

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
jju
Level 2
Level 2
10 sign-ins 5 replies posted 5 sign-ins

Hi,

I have a system with different interrupts running, some which sets FreeRTOS events.

It was working fine, until I defined a new PIN interrupt:

void AdcRdyIRQHandler(void)
{
BaseType_t xHigherPriorityTaskWoken; // = SetGroupEventFromISR(xLoadcellTaskEventGroup, evADCReady);
xEventGroupSetBitsFromISR(xLoadcellTaskEventGroup, evADCReady, &xHigherPriorityTaskWoken);
portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
}

 

If I comment the two FreeRTOS lines in the ADCRdyIRQ (SetBits... and portYIELD...), the problem disappears. 

So I know it has something to do with the FreeRTOS calls, but I'm stuck now.

The failure is shown below:

Thread #1 57005 (Suspended : Signal : SIGTRAP:Trace/breakpoint trap)
VADC0_G3_3_IRQHandler() at startup_XMC4400.S:353 0x8000298
<signal handler called>() at 0xfffffffd
ERU0_3_IRQHandler() at ADC.c:350 0x8000976
0x0

Where ADC.c:350 is dissassembly:

349 portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
08000960: ldr r3, [r7, #4]
08000962: cmp r3, #0
08000964: beq.n 0x8000976 <ERU0_3_IRQHandler+54>
08000966: ldr r3, [pc, #28] ; (0x8000984 <ERU0_3_IRQHandler+68>)
08000968: mov.w r2, #268435456 ; 0x10000000
0800096c: str r2, [r3, #0]
0800096e: dsb sy
08000972: isb sy
350 }
08000976: adds r7, #8
08000978: mov sp, r7
0800097a: pop {r7, pc}
0800097c: ldmia r3, {r2, r3, r5, r6}
0800097e: subs r7, r7, #7
08000980: ldmia r3!, {r6, r7}
08000982: subs r7, r7, #7
08000984: stc 0, cr14, [r4, #-0]

The Registers:

r7 0x20001f90 (Hex)
r8 0xa5a5a5a5 (Hex)
r9 0xa5a5a5a5 (Hex)
r10 0xa5a5a5a5 (Hex)
r11 0xa5a5a5a5 (Hex)
r12 0xa5a5a5a5 (Hex)
sp 0x1fffc780
lr 0x800a6f9 (Hex)
pc 0x8000976 <ERU0_3_IRQHandler+54>
xpsr 0x21000014 (Hex)
msp 0x1fffc760 (Hex)
psp 0x20001f70 (Hex)
primask 0
basepri 0
faultmask 0
control 0

0 Likes
1 Solution
jju
Level 2
Level 2
10 sign-ins 5 replies posted 5 sign-ins

Hi,
Yes - Thank you.
It ended up being an ISR priority issue.
PEND and SYSTICK priority was set to something higher than lowest.

View solution in original post

0 Likes
5 Replies
sujatapatil
Moderator
Moderator
Moderator
50 solutions authored 10 likes received 100 sign-ins

Hello , 

Can you modify interrupt handler as below 

void AdcRdyIRQHandler(void)
{
BaseType_t xHigherPriorityTaskWoken, xResult ; 
xHigherPriorityTaskWoken = pdFALSE;
xResult = xEventGroupSetBitsFromISR(xLoadcellTaskEventGroup, evADCReady, &xHigherPriorityTaskWoken);
   if( xResult == pdPASS )
   {
   portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
   }
}
0 Likes
sujatapatil
Moderator
Moderator
Moderator
50 solutions authored 10 likes received 100 sign-ins

Hi ,

I just wanted to check if you received my previous response. Is there anything we can do to assist you better with your request?

Thanks and Regards,
Sujata

0 Likes
jju
Level 2
Level 2
10 sign-ins 5 replies posted 5 sign-ins

Hi,
Yes - Thank you.
It ended up being an ISR priority issue.
PEND and SYSTICK priority was set to something higher than lowest.

0 Likes
sujatapatil
Moderator
Moderator
Moderator
50 solutions authored 10 likes received 100 sign-ins

Hi , 

So can i say that issue is resolved . Do you need any further assistance for this.

 

Thanks

Sujata

0 Likes
jju
Level 2
Level 2
10 sign-ins 5 replies posted 5 sign-ins

Yes, it has been resolved.

0 Likes