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

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

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

ソリューションへジャンプ
1,225件の閲覧回数
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 解決策
1,214件の閲覧回数
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 返信
1,215件の閲覧回数
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