FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [August 2008 Threads] Spurious Interrupts ond LPCPosted by stefanvogel on August 13, 2008 Hi all.
In my project I loose interrupts from time to time. As I can see in the LPC214x usermanual the reason could be spurious interrupts. I would like to add those lines (according to NXP usermanual) at the beginning of portSAVE_CONTEXT() to aviod spurious interrupts: __asm{ SUB LR, LR, #4 }; /* Spurious Interrupts: Adjust LR to point to return */ \ __asm{ STMFD SP!, {..., LR} }; /* Spurious Interrupts: Get some free regs */ \ __asm{ MRS LR, SPSR }; /* Spurious Interrupts: See if we got an interrupt while */ \ __asm{ TST LR, #0x80 }; /* Spurious Interrupts: interrupts were disabled. (I_Bit 0x80) */ \ __asm{ LDMNEFD SP!, {..., PC}^ }; /* Spurious Interrupts: If so, just return immediately.*/ \ /* Spurious Interrupts: The interrupt will remain pending since we haven’t */ \ /* Spurious Interrupts: acknowledged it and will be reissued when interrupts */ \ /* Spurious Interrupts: are next enabled. */ \ /* Spurious Interrupts: Rest of interrupt routine */ \
But then the controller ends in a data abort interrupt.
Any idea (I'm not very familiar with assembler)?
Thanks for your answer, kind regards stefan
RE: Spurious Interrupts ond LPCPosted by Dave on August 13, 2008 This will definitely crash the code. Is there not a separate spurious interrupt handler that can be defined, or am I thinking of the SAM7?
RE: Spurious Interrupts ond LPCPosted by stefanvogel on August 14, 2008 There is a default interrupt handler and I set it up. But I'm still loosing some interrupts without getting into this routine (I set a breakpoint in it). So it seems that the default interrupt handler doesn't solve all problems with spurious interrupts.
RE: Spurious Interrupts ond LPCPosted by David Farrell on August 20, 2008 It looked like I was loosing interrupts by using level triggered interrupts for the task tick. I switched to edge and things ran much better. Review my thread on this. David.
RE: Spurious Interrupts ond LPCPosted by stefanvogel on September 10, 2008 No, im not using level triggered interrupts. I'm already using edge interrupts.
I added a function vtogglePIN() to vPortEnterCritical() and vPortExitCritical() which toggles an output port. Now i can see that in some cases my interrupts are disabled for about 20ms. This is a strange behaviour and i don't know really why this ist happening. In my application im waiting for an semaphore which is given by an ISR from an externel Interrupt. Normally I'm just yielded while waiting for this interrupt. But sometimes I'm yielded with interrupts disabled (vPortEnterCritical entered and vPortExitCritical not yet called). In my code I commented all vPortEnterCritical() out, so this must be generated by freeRTOS itself.
Any idea?
RE: Spurious Interrupts ond LPCPosted by Richard on September 10, 2008 > I added a function vtogglePIN() to vPortEnterCritical() and > vPortExitCritical() which toggles an output port. Now i can > see that in some cases my interrupts are disabled for about > 20ms. This is a strange behaviour and i don't know really why > this ist happening. In my application im waiting for an > semaphore which is given by an ISR from an externel > Interrupt. Normally I'm just yielded while waiting for this > interrupt. But sometimes I'm yielded with interrupts disabled
In the existing ARM7 port each task maintains its own interrupt status. The scheduler will yield from within a critical section but this does not mean that interrupt remain disabled until the task runs again - if that were the case then everything would just come to a halt immediately. When a task yields from within a critical section it can yield to a task that has interrupts enabled, so adding a pin toggle in the enter/exit critical macros does not show you how long interrupts are being disabled for. When the original task runs again it will resume from within the critical section so will start with interrupts disabled. This is how that particular port is intended to work. More recent ports use a different scheme.
Regards.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|