4 Replies Latest reply on Nov 17, 2019 10:34 PM by YaXi_4492421

    FX3/CX3(CYUSB3065) GPIO does not generate input interrupts

    YaXi_4492421

      I use GPIO for input interrupt, but I can't get in to interrupt, may I ask where I made a mistake? Here is my initialization and interrupt code:

       

      // gpio int

      void CyFxGpioIntrCb (uint8_t gpioId)

      {

      CyBool_t gpioValue = CyFalse;

      CyU3PReturnStatus_t apiRetStatus = CY_U3P_SUCCESS;

       

       

      /* Get the status of the pin */

      apiRetStatus = CyU3PGpioGetValue (gpioId, &gpioValue);

       

       

      if (gpioValue == CyTrue)

      {

      CyU3PGpioSetValue (22, CyFalse); // FOR IR LED

      }

      else

      {

      CyU3PGpioSetValue (22, CyTrue); // FOR IR LED

      }

       

       

      if( GPIO_SSOR_XVS == gpioId)

      {

      }

      }

       

       

      // init gpio

      void

      CyFxGpioInit (void)

      {

      CyU3PGpioClock_t gpioClock;

      CyU3PGpioComplexConfig_t gpioConfig;

      CyU3PReturnStatus_t apiRetStatus = CY_U3P_SUCCESS;

       

       

      /* Init the GPIO module */

      gpioClock.fastClkDiv = 2;

      gpioClock.slowClkDiv = 0;

      gpioClock.simpleDiv = CY_U3P_GPIO_SIMPLE_DIV_BY_2;

      gpioClock.clkSrc = CY_U3P_SYS_CLK;

      gpioClock.halfDiv = 0;

       

       

      vJackyTestPrintNormal (4, "CyU3PGpioInit begin\n");

      apiRetStatus = CyU3PGpioInit(&gpioClock, CyFxGpioIntrCb);

      if (apiRetStatus != 0)

      {

      /* Error Handling */

      vJackyTestPrintErr (4, "CyU3PGpioInit failed, error code = %d\n", apiRetStatus);

      // CyFxAppErrorHandler(apiRetStatus);

      }

       

       

       

       

      CyU3PGpioSimpleConfig_t gpioConf = {0};

      gpioConf.inputEn     = CyTrue;

      gpioConf.driveLowEn  = CyFalse;

      gpioConf.driveHighEn = CyFalse;

      gpioConf.outValue    = CyFalse;

      gpioConf.intrMode    = CY_U3P_GPIO_INTR_BOTH_EDGE;

       

       

      apiRetStatus = CyU3PGpioSetSimpleConfig (44, &gpioConf);

       

       

      }

       

       

      main function´╝Ü

      io_cfg.gpioSimpleEn[1]  = io_cfg.gpioSimpleEn[1]  | FX3_GPIO_TO_HIFLAG(44);