1 Reply Latest reply on Jul 2, 2019 2:39 AM by BragadeeshV_41

    Add interrupt to MISO input of SPI SCB

    stem_1497646

      I would like to add an interrupt to a MISO input on a SPI SCB.  The external IC pulls down the MISO when data is ready, and I want to generate an interrupt when this happens.  Is it possible to configure a pin to connect both to an interrupt and a SPI SCB MISO line?  When I try to do this in the schematic editor (TopDesign), I get the error "Pin guidance unavailable: Invalid connection for output spi_miso connected to interrupt." 

       

      I am using PSoC6 module CYBLE-416045-02.

        • 1. Re: Add interrupt to MISO input of SPI SCB
          BragadeeshV_41

          Hi stem_1497646,

           

          Yes, this is possible. You can't directly connect a pin to the interrupt. Do the following:

           

          1.  In SPI configurator, navigate to Pins tab and enable "Show SPI terminals".

           

          2. Connect the digital input pin to MISO terminal. In the MISO pin configurator,

          a) Set drive mode as resistive pull up in general tab.

          b) Set Interrupt type as Falling Edge in Input tab

           

          3. Drag and drop a Global signal component (interrupt component is already connected to it). In the Global Signal configurator, choose Global Signal name as Port Interrupt x (PICU[x]), according to the port of the chosen MISO pin.

           

          4. Your schematic looks something like below:

           

           

          5. Configure the interrupt in firmware and enable the interrupt

              Cy_SysInt_Init(&MISOInt_cfg,MISO_InterruptHandler);

              NVIC_EnableIRQ((IRQn_Type) MISOInt_cfg.intrSrc);

           

          6. Write the interrupt handler:

           

          void MISO_InterruptHandler()

          {

              if(Cy_GPIO_GetInterruptStatusMasked(MISO_PORT,MISO_NUM))

              {

                  /*Data is available*/

                  dataReady = 1;

                  /*Clear the interrupt*/

                  Cy_GPIO_ClearInterrupt(MISO_PORT,MISO_NUM);

                  NVIC_ClearPendingIRQ((IRQn_Type) MISOInt_cfg.intrSrc);

              }

          }

           

          7. I've attached a sample project showcasing the same.

           

          Please let us know if you need further help.

           

          Regards,

          Bragadeesh