Hi,
I have enabled external interrupts on the pin 6 of Port0 of LPC1313 using the following steps-
(I am using the LPCOpen library for this.)
Chip_GPIO_SetPinDIRInput(LPC_GPIO_PORT, 0, 6);
Chip_GPIO_SetPinModeEdge(LPC_GPIO_PORT, 0, 64);
Chip_GPIO_SetEdgeModeSingle(LPC_GPIO_PORT, 0, 64);
Chip_GPIO_SetupPinInt(LPC_GPIO_PORT, 0, 6, GPIO_INT_RISING_EDGE);
Chip_GPIO_EnableInt(LPC_GPIO_PORT, 0, 64);
NVIC_ClearPendingIRQ(EINT0_IRQn);
NVIC_EnableIRQ(EINT0_IRQn);
There is no activity on the specified GPIO pin during this time (also verified in the DATA register for that port). However, as soon as the NVIC_EnableIRQ(EINT0_IRQn); command is executed, an interrupt seems to have occurred and the program goes to the PIOINT0_IRQHandler.
Please tell me why an interrupt is getting registered on enabling and if there is a workaround to avoid this case.
Thanks and Regards,
Prachi
Solved! Go to Solution.
Hello prachi panse,
Please call clear peinding interrupts for selected pins before you enable the IRQ:
STATIC INLINE void Chip_GPIO_ClearInts(LPC_GPIO_T *pGPIO, uint8_t port, uint32_t pinmask)
{
pGPIO[port].IC = pinmask;
}
Please try it on your side at first.
If you still have problem, please let me know!
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello prachi panse,
Please call clear peinding interrupts for selected pins before you enable the IRQ:
STATIC INLINE void Chip_GPIO_ClearInts(LPC_GPIO_T *pGPIO, uint8_t port, uint32_t pinmask)
{
pGPIO[port].IC = pinmask;
}
Please try it on your side at first.
If you still have problem, please let me know!
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello prachi panse,
Please call clear peinding interrupts for selected pins before you enable the IRQ:
STATIC INLINE void Chip_GPIO_ClearInts(LPC_GPIO_T *pGPIO, uint8_t port, uint32_t pinmask)
{
pGPIO[port].IC = pinmask;
}
Please try it on your side at first.
If you still have problem, please let me know!
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------