FX3: How to config GPIO in firmware?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
doch_3739346
Level 4
Level 4

Hi,

I'm referencing SlaveFifoSync firmware.

In cyfxslfifosync.c, line 887, it's enable GPIO 59 as below.

    /* No GPIOs are enabled. */

    io_cfg.gpioSimpleEn[0]  = 0;

    io_cfg.gpioSimpleEn[1]  = 0x08000000; /* GPIO 59 */

    io_cfg.gpioComplexEn[0] = 0;

    io_cfg.gpioComplexEn[1] = 0;

My questions are

1. Why GPIO 59 is enabled? Since I can't find it from GPIF Designer.

pastedImage_0.png

2. What's the general guiding rules for GPIO initialisation.

Thanks!

0 Likes
1 Solution
SrinathS_16
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

Hello,

- The GPIO 59 is used as a RESET pin for the FPGA. Please refer to section 10.2 in the AN65974 Application Note document.

- General steps to configure a GPIO pin:

    1. Enable the GPIO pins by initializing the CyU3PIoMatrixConfig_t structure (gpioSimpleEn and gpioComplexEn) and passing it as parameter to the CyU3PDeviceConfigureIOMatrix() API. Depending on the configuration of the GPIF II, certain GPIO pins belong to the GPIF II interface and are not directly available as simple GPIOs. In order to use these GPIOs, the CyU3PDeviceGpioOverride() API needs to be used.

    2. The GPIO clock needs to enabled using the CyU3PGpioInit() API along with its structure parameter.

    3. Configure the GPIO using the CyU3PGpioSetSimpleConfig() API along with its associated parameters.

    4. The value to be driven on the GPIO can be set using the CyU3PGpioSetValue() API. In case a simple GPIO pin is used, the CyU3PGpioSimpleSetValue() API can also be used since this will be faster.

Kindly, refer to the FX3 API Guide document for details on the parameters of the API. For reference implementation of the above mentioned procedure, refer to GpioApp example firmware that comes with the FX3 SDK.

Best regards,

Srinath S

View solution in original post

0 Likes
1 Reply
SrinathS_16
Moderator
Moderator
Moderator
1000 replies posted 750 replies posted 500 replies posted

Hello,

- The GPIO 59 is used as a RESET pin for the FPGA. Please refer to section 10.2 in the AN65974 Application Note document.

- General steps to configure a GPIO pin:

    1. Enable the GPIO pins by initializing the CyU3PIoMatrixConfig_t structure (gpioSimpleEn and gpioComplexEn) and passing it as parameter to the CyU3PDeviceConfigureIOMatrix() API. Depending on the configuration of the GPIF II, certain GPIO pins belong to the GPIF II interface and are not directly available as simple GPIOs. In order to use these GPIOs, the CyU3PDeviceGpioOverride() API needs to be used.

    2. The GPIO clock needs to enabled using the CyU3PGpioInit() API along with its structure parameter.

    3. Configure the GPIO using the CyU3PGpioSetSimpleConfig() API along with its associated parameters.

    4. The value to be driven on the GPIO can be set using the CyU3PGpioSetValue() API. In case a simple GPIO pin is used, the CyU3PGpioSimpleSetValue() API can also be used since this will be faster.

Kindly, refer to the FX3 API Guide document for details on the parameters of the API. For reference implementation of the above mentioned procedure, refer to GpioApp example firmware that comes with the FX3 SDK.

Best regards,

Srinath S

0 Likes