9 Replies Latest reply on Feb 17, 2018 4:25 PM by BoTa_264741

    PSoC Pins Component Interrupt

      How does the pins component interrupt generation function when the number of pins is set > 1 and mulptiple pins are set to generate interrupts?

        • 1. Re: PSoC Pins Component Interrupt

          You can use the interrupt component (Systems Tab), and connect one to each pin requiring an interrupt.


          Then you can use the interrupt API, and the Design Wide Resources tab, to change interrupt priorities etc.

          • 2. Re: PSoC Pins Component Interrupt

            I was really trying to find out how does the hardware side deal with multiple sources of interrupts if more than one were active at the same time? Does the API resolve this some how? If an interrupt is being serviced, but has not yet released the request at the pin and another request is activated, is the newer request recognized? Is there a detailed description of this somewhere?

            • 3. Re: PSoC Pins Component Interrupt

              Interrupts are handled in hardware by the Interrupt Controller. It can handle 32 interrupts and allows the user to assign eight levels of interrupt priority, 0 to 7.

              Priority 0 is the highest and 7 the lowest. Priorities can be set at design time and changed/set dynamically at runtime.

              If two interrupts occur at the same time the interrupt with the highest priority (lowest number) is serviced first.

              If an interrupt is being serviced and a higher priority interrupt occurs, then the current interrupt service is suspended and the higher priority interrupt gets serviced, and when done the lower level one will resume.


              For more detail of the interrupt hardware, see chapter 8 (Interrupt Controller) of the TRM here http://www.cypress.com/?docID=18266 www.cypress.com/

              • 4. Re: PSoC Pins Component Interrupt

                I must not be wording the question properly...


                If I place a pins component on a schematic sheet and set the number of pins to a value greater than 1 and set each pin to generate interrupts, I only have a single interrupt which connects to the interrupt controller. How does the hardware/API deal with multiple sources connected to this single interrupt source? How do I know which pin generated the interrupt? What happens when the interrupt for one of the lines is generated and is being serviced and another line connected to the same pins component should cause an interrupt? Will it happen? Creator will not permit multiple pins components for the same group of port pins to have individual interrupts. So my question is...How does the port/pins component deal with multiple pins attached to a single pins component that can generate interrupts? I looked through the documentation and cannot find this topic dealt with...I understand the priorities and the interrupt controller, but this occurs before that point in the hardware.



                • 5. Re: PSoC Pins Component Interrupt

                  Hi smurask,


                  I think you may be missing a step. This is how to do it.


                  Place the pins component, and configure for the number of pins required.
                  Then, as you have done before, configure the pins component, for the interrupts on each pin.
                  Now, place the Interrupt component, as many times as you have pins, and wire one to each pin.


                  Now you can configure the interrupt priorities on the Interrupts Tab of DWR.
                  Hope this works for you.



                  • 6. Re: PSoC Pins Component Interrupt

                    OK...I guess I thought that the pins component was able to multiplex the interrupt requests somehow and that was the purpose of the interrupt output from the pins component??? I guess that is only for a single pin interrupt application. Thanks.

                    • 7. Re: PSoC Pins Component Interrupt

                      I tried implementing something in this way and it wouldn't work for me.

                      • 8. Re: PSoC Pins Component Interrupt

                        There is only one interrupt line used for a port. You will need to read all pins in the handler to determine which pin(s) were causing the interrupt.



                        • 9. Re: PSoC Pins Component Interrupt


                          interrupts sources within the port are OR-ed together. That is when you instantiate several grouped pins within the port and enable the interrupt, you will get a single ISR for all pins in the group. When ISR fires you have to find which of the pins caused the interrupt. To do that, inside ISR routine use API PinName_ClearInterrupt(), which returns all sources for interrupt event (while also clearing interrupt source): bit 0 - pin0, bit1 - pin1, etc.


                          #define MASK2  0x4 // pin: 2




                              uint8 intSource = `$INSTANCE_NAME`_ClearInterrupt(); // must clear


                              if ((intSource & MASK2)==1)


                                   //your code ....