Content originally posted in LPCWare by Forrest on Fri Feb 17 05:55:21 MST 2012
Hi all,
I have problem with generating external interrupt at port 0. I use 3 pins (P0.7 P0.6 P0.3) this pins are configured as gpio inputs and set to generate interrupt at rising adge.
Code:
[I]GPIOSetDir(INPUT_25_PORT, INPUT_25_BIT, 0);
GPIOSetDir(INPUT_26_PORT, INPUT_26_BIT, 0);
GPIOSetDir(INPUT_27_PORT, INPUT_27_BIT, 0);
GPIOSetInterrupt(INPUT_25_PORT,INPUT_25_BIT, 0, 0, 0);
GPIOSetInterrupt(INPUT_26_PORT,INPUT_26_BIT, 0, 0, 0);
GPIOSetInterrupt(INPUT_27_PORT,INPUT_27_BIT, 0, 0, 0);
GPIOIntEnable(INPUT_25_PORT, INPUT_25_BIT);
GPIOIntEnable(INPUT_26_PORT, INPUT_26_BIT);
GPIOIntEnable(INPUT_27_PORT, INPUT_27_BIT);[/I]
[I]NVIC_SetPriority(UART_IRQn, 5);
NVIC_SetPriority(TIMER_16_0_IRQn, 4);
NVIC_SetPriority(SysTick_IRQn, 3);
NVIC_SetPriority(EINT0_IRQn, 1);
NVIC_SetPriority(EINT2_IRQn, 1);[/I]
And interrupt handler looks like this.
[I]unsigned int inputs = 0; //global wariable
void PIOINT0_IRQHandler(void)
{
unsigned int source = LPC_GPIO0->MIS;
inputs |= source;
LPC_GPIO0->IC |= source;
}[/I]
So problem is that I connect function generator(square 5Hz) parallel to at all pins. Sometimes any enterrupt miss and I miss edge.
Have you any idea? Becouse I think that MCU cant correctly generate interrupt.
Thanks Forrest