Stuck in ISR, data abort problem ?

barden18 wrote on Tuesday, January 02, 2007:

Hi all,

I am using the yagarto toolchain, with gnuarm 4.1.1 and eclipse.

i am currently working on a CAN driver for the sam7x.

I have a test setup with two dev. boards, where one of the boards sends
a data frame to the other every 100ms. And when the dev. baord receives this
data frame it responds with an other data frame.

When two dev. boards are connected to each other the communication works
fine and the rtos is running nicely. However if i disconnect the CAN link for
some time (e.g 15 seconds) and reconnect. The application gets stuck in the CAN ISR.
And the CAN task is never run again.

If i halt execution randomly after the communication failure, i can see the line __dabt gets

if i have a breakpoint in the CAN ISR at this point, it will be continually hit. But there is no source
for the interrupt.

if i step through the last lines of the interrupt which are:

0x0010054c <vCANISR+600>: sub   sp, r11, #28    ; 0x1c
0x00100550 <vCANISR+604>: ldmia sp, {r0, r1, r2, r3, r11, sp, lr}
0x00100554 <vCANISR+608>: ldmia sp!, {r12}
0x00100558 <vCANISR+612>: subs  pc, lr, #4    ; 0x4
0x0010055c <vCANISR+616>: eoreq r0, r0, r12, lsr r8
0x00100560 <vCANISR+620>: eoreq r0, r0, r8, lsr r8
0x00100564 <vCANISR+624>: eoreq r0, r0, r1, lsr r8
0x00100568 <vCANISR+628>: eoreq r0, r0, r0, lsr r8
0x0010056c <vCANISR+632>: eoreq r0, r0, r4, lsr r8

i get the following error when executing line 0x00100550:

Thread [0] (Suspended: Signal ‘SIGINT’ received. Description: Interrupt.) <Stack is not available: Cannot access memory at address 0x1111110d.>

i have tried with different stack sizes from 200 to 1024. which didn’t solve the problem.

the weird thing though, is that if i step through the code, after reconnecting the CAN link (in which case i will get a transmit interrupt) the application is behaving as expected and returning nicely after completing the ISR.

any help with this is greatly appreciated. thx

barden18 wrote on Tuesday, January 02, 2007:

Hi again,

I have got to work with a rather crude workaround.

It seems that allthough

ulIntStatus = AT91C_BASE_CAN->CAN_SR;
ulIntStatus &= ulIntMask;

results in ulIntStatus = 0. The CAN ISR would still fire.

the workaround i made was to disable the CAN Controller if ulIntStatus = 0.
And then from my CAN task, from where i also send out data frames, check
CAN_MR to see if it is disabled. And if it is, i reenable the CAN Controller.

If anyone has some experience using the CAN controller with freertos or otherwise,
i would be glad to some of the insights or solutions you might have to this problem.