Hello everyone
I am trying to simply configure an interrupt to detect a rising or falling edge on a pin. But whenever I want to finally enable the interrupt the SW gets "stuck".
Here my code:
GPIOInit();
// Configure P0.10 as input
LPC_GPIO_PORT->CLR0 = 0x400; // Clear P0.10 to '00'
LPC_GPIO_PORT->DIR0 &= 0xFFFFFBFF; // Set P0.10 as input
// Configure P0.10 as pin interrupts 0 by writing to the PINTSELs in SYSCON
LPC_SYSCON->PINTSEL[0] = 10; // PINTSEL0 is P0.10
// Configure the Pin interrupt mode register (a.k.a ISEL) for edge-sensitive
LPC_PIN_INT->ISEL = 0x0;
// Configure the IENR (pin interrupt enable rising) for rising edges
LPC_PIN_INT->IENR = 0x1;
// Configure the IENF (pin interrupt enable falling) for falling edges
LPC_PIN_INT->IENF = 0x1;
// Clear any pending or left-over interrupt flags
LPC_PIN_INT->IST = 0xFF;
NVIC_SetPriority(PININT0_IRQn, 1);
// Enable pin interrupts 0 in the NVIC
NVIC_EnableIRQ(PININT0_IRQn); // --> SW stucks here
Here is what NVIC_EnableIRQ does:
__STATIC_INLINE void NVIC_EnableIRQ(IRQn_Type IRQn)
{
NVIC->ISER[0] = (1 << ((uint32_t)(IRQn) & 0x1F));
}
The SW can not pass the last line. I am not exaclty sure what happens in this moment because I only flash the device with the hex file without the possibility for debugging. But no command after the last line will get executed. When I disable the last line all is running fine (apart from the interrupt of course). I have another interrupt (SPI0) activated with the same command (NVIC_EnableIRQ(SPI0_IRQn)) and this is working correctly.
I tried a lot of things but I could not find the problem.
I really appriciate your help.
Regards Robin