This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

IRQ Help

Hi there,

I am trying to using 2 IRQ's for 2 external interrupt in my program. The problem comes when I enable ENT2(ENT1 has already been activated). None of the interrupts works correctly at this stage. I doubt on acknowledging the interrupt at the end of ISR. When we acknowledge a ISR for ex ENT2, does it mean acknowledging for even ENT1? and so the EXT1 does not execute?

ext_irq.c

void EINT1Init( void )
{

PINSEL4 |= 0x00400000;/* set P2.10 as EINT0 and //P2.0~7 GPIO output */ EXTMODE |= EINT1_EDGE; EXTPOLAR = 0; /* INT0 is falling edge by default */

install_irq( EINT1_INT, (void *)EINT1_Handler, 2 ); return;
}

/*****************************************************************************
** Function name: EINT0_Handler
**
** Descriptions: external INT handler
**
** parameters: None
** Returned value: None
**
*****************************************************************************/
void EINT1_Handler (void) __irq
{

#if DEBUG myprintf("In EINT0_Handler\n");
#endif EXTINT |= EINT1; //code of interrupt isr VICVectAddr = 0; /* Acknowledge Interrupt */
}

void delay(void)
{ long int i=0; for(i=0;i<9;i++); return;
}

/**********************************************************************/
/**********************************************************************/
void EINT2Init( void )
{

PINSEL4 |= 0x01000000;/* set P2.12 as EINT0 and //P2.0~7 GPIO output */ EXTMODE |= EINT2_EDGE; EXTPOLAR = 0; /* INT0 is falling edge by default */

install_irq( EINT2_INT, (void *)EINT2_Handler, 5 ); return;
}

/*****************************************************************************
** Function name: EINT0_Handler
**
** Descriptions: external INT handler
**
** parameters: None
** Returned value: None
**
*****************************************************************************/
void EINT2_Handler (void) __irq
{

#if DEBUG myprintf("In EINT2_Handler\n");
#endif EXTINT |= EINT2; //code of interrupt isr FIO1PIN ^= ~(1 << 18); VICVectAddr = 0; /* Acknowledge Interrupt */
}

Kindly help on this....Thanks..

Parents
  • Why do we have to guess if you have a NXP LPC23xx or some other processor?

    You don't show any code to set up the EINT1 interrupt. But the code to set up EINT2 doesn't seem to play nicely with EXTPOLAR - don't modify more bits than what is related to EINT2. Especially since the requirements of the chip is that you clear the interrupt bit in EXTINT whenever you change a setting for the interrupt source - your init code does not contain any EXTINT = EINT2 after having configured the interrupt source.

    I don't think you need any bit or in the interrupt handler. EXTINT = EINT2 should be fine. The manual says you clear it by writing a one to it - so writing a zero to all other bits will not clear them.

Reply
  • Why do we have to guess if you have a NXP LPC23xx or some other processor?

    You don't show any code to set up the EINT1 interrupt. But the code to set up EINT2 doesn't seem to play nicely with EXTPOLAR - don't modify more bits than what is related to EINT2. Especially since the requirements of the chip is that you clear the interrupt bit in EXTINT whenever you change a setting for the interrupt source - your init code does not contain any EXTINT = EINT2 after having configured the interrupt source.

    I don't think you need any bit or in the interrupt handler. EXTINT = EINT2 should be fine. The manual says you clear it by writing a one to it - so writing a zero to all other bits will not clear them.

Children
No data