6 Replies Latest reply on Jun 13, 2012 2:43 AM by israel.rodriguez

    Manage external interrupt in FX3

    israel.rodriguez

       Hi all,

         

      Does anybody know how to manage an interrupt produced by GPIF machine into ARM?.

         

      Thanks in advance,

         

      Israel

        • 1. Re: Manage external interrupt in FX3
          rama.sai.krishna.vakkantula

          Could you please elloborate little bit more on your application requirement.

             

          Thanks,

             

          sai krishna.

          • 2. Re: Manage external interrupt in FX3
            israel.rodriguez

             Hi Khrisna,

               

            We are using FX3 to develop a USB camera. At the end of every frame we send an interruption from GPIF to ARM to perform some tasks.

               

            I found the solution using     CyU3PGpifRegisterCallback (&cbFunction); and CYU3P_GPIF_EVT_SM_INTERRUPT event.

               

            Regards,

               

            Israel

            • 3. Re: Manage external interrupt in FX3
              jake.janovetz

              Are you referring to the FW_TRIG GPIF action?

              • 4. Re: Manage external interrupt in FX3
                rama.sai.krishna.vakkantula

                Jake,

                   

                I think it is INTR_CPU action.

                • 5. Re: Manage external interrupt in FX3
                  israel.rodriguez

                   Yes, INTR_CPU action.

                     

                  Regards,

                     

                  Israel

                  • 6. Re: Manage external interrupt in FX3
                    rachid.labidi

                     hi every body

                       

                    how to reduce latency between GPIO interrupt  trigger and  start of reading  data from GPIF using CyU3PGpifReadDataWords function 

                       

                    the actual latency that I have is 14 us  and its very long !!!!

                       

                     

                       

                     

                       

                    my callback function is 

                       

                    void CyFxGpioIntrCb (

                       

                            uint8_t gpioId /* Indicates the pin that triggered the interrupt */

                       

                            )

                       

                    {

                       

                        CyBool_t gpioValue = CyFalse;

                       

                        CyU3PReturnStatus_t apiRetStatus = CY_U3P_SUCCESS;

                       

                        uint8_t data;

                       

                        /* Get the status of the pin */

                       

                        apiRetStatus = CyU3PGpioGetValue (gpioId, &gpioValue);

                       

                        if (apiRetStatus == CY_U3P_SUCCESS)

                       

                        {

                       

                            /* Check status of the pin */

                       

                            if (gpioValue == CyTrue)

                       

                            {

                       

                     

                       

                                /* Set GPIO high event */

                       

                                CyU3PEventSet(&glFxGpioAppEvent, CY_FX_GPIOAPP_GPIO_HIGH_EVENT,

                       

                                        CYU3P_EVENT_OR);

                       

                            }

                       

                            else

                       

                            { GPIF_ReadByte(&data, 0xDD);

                       

                                /* Set GPIO low Event */

                       

                                CyU3PEventSet(&glFxGpioAppEvent, CY_FX_GPIOAPP_GPIO_LOW_EVENT,

                       

                                        CYU3P_EVENT_OR);

                       

                            }

                       

                        }

                       

                    }

                       

                     

                       

                     

                       

                     

                       

                    where  GPIF_ReadByte is 

                       

                     

                       

                    CyU3PReturnStatus_t GPIF_ReadByte(uint8_t *buffer, uint8_t Address)

                       

                    {

                       

                    CyU3PReturnStatus_t apiRetStatus = CY_U3P_ERROR_FAILURE;

                       

                    uint32_t word;

                       

                    uint8_t state = 100;

                       

                    int32_t Try_Counter;

                       

                     

                       

                     

                       

                    if(GPIF_Busy_Flag)

                       

                    {

                       

                    /* the GPIF interface is reserved */

                       

                    return CY_U3P_ERROR_DEVICE_BUSY;

                       

                    }

                       

                    /* reserve the GPIF interface */

                       

                    GPIF_Busy_Flag=CyTrue;

                       

                     

                       

                    Try_Counter = 10000;

                       

                    do

                       

                    {

                       

                    apiRetStatus = CyU3PGpifGetSMState(&state);

                       

                    Try_Counter--;

                       

                    }while(((apiRetStatus != CY_U3P_SUCCESS) || (state != WAIT1)) && (Try_Counter));

                       

                     

                       

                    if((apiRetStatus == CY_U3P_SUCCESS) && (state == WAIT1))

                       

                    {

                       

                    /* set the address bus */

                       

                    CyU3PGpifInitAddrCounter((uint32_t)Address,CyFalse,CyFalse,CyFalse,0);

                       

                    CyU3PGpifControlSWInput (CyTrue);

                       

                    /* extract data from the data bus */

                       

                    Try_Counter = 1000;

                       

                    do{

                       

                    apiRetStatus = CyU3PGpifReadDataWords (0,CyFalse, 1, &word, CYU3P_NO_WAIT);

                       

                    }while((apiRetStatus != CY_U3P_SUCCESS) && (Try_Counter));

                       

                    CyU3PGpifControlSWInput (CyFalse);

                       

                    *buffer = (unsigned char)word;

                       

                     

                       

                    /* free the GPIF interface */

                       

                    GPIF_Busy_Flag=CyFalse;

                       

                    return(apiRetStatus);

                       

                    }

                       

                    /* free the GPIF interface */

                       

                    GPIF_Busy_Flag=CyFalse;

                       

                    return CY_U3P_ERROR_DEVICE_BUSY;

                       

                    }