1 Reply Latest reply on May 9, 2018 6:44 AM by abga

    FX3: GPIO on GPIO[14] fails to configure

    ffranck_1997381

      Hi.

       

      I'm having a problem configuring the GPIO pins on my FX3.  Specifically, the CyU3PDeviceConfigureIOMatrix() call returns CY_U3P_ERROR_BAD_ARGUMENT whenever I set any of the bits in io_cfg.gpioSimpleEn[0].

       

      Some details:

       

      The code is as follows:

       

          CyU3PIoMatrixConfig_t io_cfg;
          CyU3PMemSet ((uint8_t *)&io_cfg, 0, sizeof(io_cfg));
          io_cfg.isDQ32Bit = CyFalse;
          io_cfg.s0Mode = CY_U3P_SPORT_INACTIVE;
          io_cfg.s1Mode = CY_U3P_SPORT_INACTIVE;
          io_cfg.useUart = CyFalse;
          io_cfg.useI2C = CyFalse;
          io_cfg.useI2S = CyFalse;
          io_cfg.useSpi = CyFalse;
          io_cfg.lppMode = CY_U3P_IO_MATRIX_LPP_DEFAULT;

          /* Enable GPIOs needed for FPGA programming */
          io_cfg.gpioSimpleEn[0] = 0x00000000 | (0x1 << (GPIO_FPGA_DIN))
                    | (0x1 << (GPIO_LED_ORANGE));
          io_cfg.gpioSimpleEn[1] = 0x00000000 | (0x1 << (GPIO_FPGA_PROG_L - 32))
                    | (0x1 << (GPIO_FPGA_INIT_L - 32))
                    | (0x1 << (GPIO_FPGA_DONE - 32))
                    | (0x1 << (GPIO_FPGA_CCLK - 32));

          //    io_cfg.gpioSimpleEn[0]  = 0;
          //    io_cfg.gpioSimpleEn[1]  = 0x01E00000;

          io_cfg.gpioComplexEn[0] = 0;
          io_cfg.gpioComplexEn[1] = 0;

          status = CyU3PDeviceConfigureIOMatrix(&io_cfg);

      That last line returns CY_U3P_ERROR_BAD_ARGUMENT if anything other than zero is present in io_cfg.gpioSimpleEn[0] (as veried by uncommenting the line that clears the value).  GPIO_FPGA_DIN and GPIO_LED_ORANGE are 14 and 23 respectively.  All the other defines are over 32.

       

      What am I missing here to be able to use the low pins as GPIO pins?

       

      Thanks,

      /Franck

        • 1. Re: FX3: GPIO on GPIO[14] fails to configure
          abga

          Hi,

           

          If  you are using 16 bit GPIF interface so GPIO 0 to GPIO 15 will be mapped to 16 bit data bus.

          Hence, GPIO 14 can not be used. This is why you are getting the error. If you want to use GPIO 0 To GPIO 15. Make use of CyU3PDeviceGpioOverride API to override GPIO's 0 to 15. Bydefault they are mapped to GPIF

           

          Thanks & Regards

          Abhinav