Spurious Interrupts ond LPC

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

Spurious Interrupts ond LPC

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?

Spurious Interrupts ond LPC

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.

Spurious Interrupts ond LPC

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.

Spurious Interrupts ond LPC

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?

Spurious Interrupts ond LPC

> 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.