Hi,
I have an LPC2378 connected to a MAX3420E USB chip via SPI. I am using an external interrupt to alert the uC whenever it needs service, however, this interrupt has taken over my chip operation, none of the code in my main while loop can run!
What can be doing this? I've tried changing the IRQ priority with no avail.
snippet from main:
while (1) { printf ("."); }
// EINT3 Interrupt handler--MAX3420E INT pin void INT3420 (void) __irq { service_irqs(); // Do the USB thing EXTINT = 0x03; // Clear EINT3 interrupt flag VICVectAddr = 0xFF; // Dummy write to indicate end of interrupt service } DWORD EINTInit( void ) { PINSEL4 |= 0x4000000; IO2_INT_EN_F = 0xFF; EXTMODE = EINT3_EDGE; EXTPOLAR = 0x03; if ( install_irq(EINT3_INT,(void *)INT3420,LOWEST_PRIORITY )==FALSE) { return (FALSE); } return( TRUE ); }
Take a closer look at this line:
EXTINT = 0x03
That is not how you clear the external interrupt 3. EXTINT has one bit for each interrupt source, so you are instead trying to clear external interrupt 0 and external interrupt 1.
Good call Per. I have made that change, however it is still not clearing enough to jump back to other processes. I don't understand why this doesn't work concurrently. Any other ideas?
Have you made sure that you have enough stack? Does your code return back from the service_irqs() call?
A minimalistic interrupt handler should look something like:
void eint3_irq(void) __irq { EXTINT = EINT3; // Clear interrupt. eint3_irq_count++; VICVectAddr = 0; // Acknowledge Interrupt }
Any other ideas?
What about the external interrupt line ? Is your code doing everything it needs to do for the MAX to deassert the interrupt ? Can you check with a 'scope what's going on on that line ?
Did you set the "level/edge triggered" bit correctly ?