LPC1313 NVIC_EnableIRQ function

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

LPC1313 NVIC_EnableIRQ function

跳至解决方案
2,323 次查看
prachipanse
Contributor III

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

标签 (3)
0 项奖励
回复
1 解答
1,771 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

在原帖中查看解决方案

0 项奖励
回复
2 回复数
1,772 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复
1,771 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复