MX1010: how to find the source of an GPIO-interrupt?

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

MX1010: how to find the source of an GPIO-interrupt?

跳至解决方案
755 次查看
Elmi77
Contributor III

Hi,

I'm developing a bare-metal application on a MIMX1010-EVK board. Now I have implemented a functionality to raise an interrupt whenever a falling or a rising edge occurs on a GPI. This is the ISR generated by MCUXpresso which works properly:

/* GPIO1_Combined_0_15_IRQn interrupt handler */
void GPIO1_GPIO_COMB_0_15_IRQHANDLER(void)
{
  uint32_t pins_flags = GPIO_GetPinsInterruptFlags(GPIO1);

  /* Place your interrupt code here */

  /* Clear ins flags */
  GPIO_ClearPinsInterruptFlags(GPIO1, pins_flags);

  /* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F
     Store immediate overlapping exception return operation might vector to incorrect interrupt. */
  #if defined __CORTEX_M && (__CORTEX_M == 4U)
    __DSB();
  #endif
}

 

The point is, this ISR is used for all GPIs from 0 to 15. Now when I have more than one GPI bound to this interrupt - how can I find out which one has caused the IRQ?

Reading the current state of an GPI does not help as the interrupt happens on a rising or falling edge but not on an input level 0 or 1.

So how can one find the source GPI of the interrupt?

Thanks!

 

0 项奖励
回复
1 解答
744 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @Elmi77 ,

    Thanks you for your interest in the NXP MIMXRT product, I would like to provide service for you.

   Yes, to the RT1010 GPIO1 interrupt, the IRQ is shared:

kerryzhou_0-1661144244934.png

About how to check which detail pin in the 16 pin when GPIO1 interrupt happens.

You can check this register:

kerryzhou_1-1661144292564.png

Check the ISR which flag is set, then you will know which detail pin interrupt happens.

Use this code to get the ISR, then check which pin is set in the interrupt handler:

kerryzhou_2-1661144795485.png

 

Best Regards,

Kerry

 

 

 

在原帖中查看解决方案

1 回复
745 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @Elmi77 ,

    Thanks you for your interest in the NXP MIMXRT product, I would like to provide service for you.

   Yes, to the RT1010 GPIO1 interrupt, the IRQ is shared:

kerryzhou_0-1661144244934.png

About how to check which detail pin in the 16 pin when GPIO1 interrupt happens.

You can check this register:

kerryzhou_1-1661144292564.png

Check the ISR which flag is set, then you will know which detail pin interrupt happens.

Use this code to get the ISR, then check which pin is set in the interrupt handler:

kerryzhou_2-1661144795485.png

 

Best Regards,

Kerry