5 Replies Latest reply on May 26, 2019 11:11 PM by SarthakB_01

    How to clear GPIO Interrupt ?

    jamec_2673086

      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.

        • 1. Re: How to clear GPIO Interrupt ?
          LinglingG_46

          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.

          • 2. Re: How to clear GPIO Interrupt ?
            jamec_2673086

            Can we have 2 GPIO connected to same Interrupt component ?

            • 3. Re: How to clear GPIO Interrupt ?
              LinglingG_46

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

              • 4. Re: How to clear GPIO Interrupt ?
                jamec_2673086

                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 ?

                • 5. Re: How to clear GPIO Interrupt ?
                  SarthakB_01

                  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.