How to clear GPIO Interrupt ?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
jamec_2673086
Level 3
Level 3
5 likes given First like received First like given

Hello,

I am Jagir, I am using PSoC63 based dev board,

In my project, I need 2 GPIO interrupts, For clearing of GPIO interrupt I found that few different APIs available.

1) Cy_GPIO_ClearInterrupt(P0_3_PORT, P0_3_NUM);

2) NVIC_ClearPendingIRQ(Digital0_ISR_cfg.intrSrc);

Let me know which API should be used & what is use case of "Cy_GPIO_" APIs & "NVIC_" APIs.

0 Likes
1 Solution

Hi,

All the pin interrupts of a port are OR-ed to produce a single GPIO Port interrupt signal. When the GPIO is routed directly to interrupt, PSoC Creator uses UDB logic to generate interrupt. Hence it is a UDB interrupt. You can confirm by checking the interrupt number after you build the application. A quantity greater than or equal to 122 should be seen. If the number is less than 40, the interrupt is Deep sleep wake-up capable.

I've used CE219521 to note down the observations for both cases of routing Global Reference Signal Component to interrupt and GPIO component to interrupt for more clarity.

Routing interrupt to Global signal reference component

The interrupt is Deep sleep Wake-up capable. The GPIO interrupt logic has additional circuitry to support interrupts on the rising edge, falling edge, and both edges. Here, the interrupt logic generates the signal which is fed to the Interrupt component.

   

Digital Input -> InterruptInterrupt-> Interrupt typeStatus
Rising edgeAuto-Select TriggerWorks
Falling edgeAuto-Select TriggerWorks
Both edgesAuto-Select TriggerWorks

   

Routing interrupt directly to GPIO

The interrupt is not Deep sleep wake-up capable. When you route GPIO directly, the interrupt is driven directly by signal status at the GPIO. So, interrupt is triggered only for rising edge and level change depending on how the interrupt component is configured.

Digital Input -> InterruptInterrupt-> Interrupt typeStatus
Rising edgeRising Edge/ Auto-Select TriggerWorks
Falling edgeLevel TriggeredWorks
Both edgesLevel TriggeredWorks only for falling edge, no response during rising edge
Both edgesRising Edge/ Auto-Select TriggerWorks only for rising edge, no response during falling edge

   

For more information, refer to AN 217666. For information on the interrupt numbers refer to Appendix A of the same.

View solution in original post

0 Likes
5 Replies
LinglingG_46
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 10 questions asked

1) Cy_GPIO_ClearInterrupt(P0_3_PORT, P0_3_NUM); clears the trigged GPIO IRQ mask.

2) NVIC_ClearPendingIRQ(Digital0_ISR_cfg.intrSrc); clear all pending IRQ mask.

0 Likes

Can we have 2 GPIO connected to same Interrupt component ?

0 Likes

Yes, you can connect the two pins from the same port to the interrupt component.

0 Likes

In Top design i get to know that we can use either Interrupt component directly to the GPIO pin as digital input to get GPIO interrupt genereted.

Or we can use Global signal & use interrupt to be generated from same port.

So what is difference between Normal interrupt component & Global signal interrupt ?

Which is better use for GPIO interrupt ?

What is preferable use of global signal component ?

0 Likes

Hi,

All the pin interrupts of a port are OR-ed to produce a single GPIO Port interrupt signal. When the GPIO is routed directly to interrupt, PSoC Creator uses UDB logic to generate interrupt. Hence it is a UDB interrupt. You can confirm by checking the interrupt number after you build the application. A quantity greater than or equal to 122 should be seen. If the number is less than 40, the interrupt is Deep sleep wake-up capable.

I've used CE219521 to note down the observations for both cases of routing Global Reference Signal Component to interrupt and GPIO component to interrupt for more clarity.

Routing interrupt to Global signal reference component

The interrupt is Deep sleep Wake-up capable. The GPIO interrupt logic has additional circuitry to support interrupts on the rising edge, falling edge, and both edges. Here, the interrupt logic generates the signal which is fed to the Interrupt component.

   

Digital Input -> InterruptInterrupt-> Interrupt typeStatus
Rising edgeAuto-Select TriggerWorks
Falling edgeAuto-Select TriggerWorks
Both edgesAuto-Select TriggerWorks

   

Routing interrupt directly to GPIO

The interrupt is not Deep sleep wake-up capable. When you route GPIO directly, the interrupt is driven directly by signal status at the GPIO. So, interrupt is triggered only for rising edge and level change depending on how the interrupt component is configured.

Digital Input -> InterruptInterrupt-> Interrupt typeStatus
Rising edgeRising Edge/ Auto-Select TriggerWorks
Falling edgeLevel TriggeredWorks
Both edgesLevel TriggeredWorks only for falling edge, no response during rising edge
Both edgesRising Edge/ Auto-Select TriggerWorks only for rising edge, no response during falling edge

   

For more information, refer to AN 217666. For information on the interrupt numbers refer to Appendix A of the same.

0 Likes