GPIO | Cypress Semiconductor


Summary: 2 Replies, Latest post by raj8889 on 08 Apr 2013 06:17 AM PDT
Verified Answers: 0
Last post
Log in to post new comments.
Nazila's picture
55 posts


In the GPIO sample code "cyfxgpioapp", there is a line as

io_cfg.gpioSimpleEn[1] = (1 << 13); /* Enable GPIO 45 */

My questions are only related to simple GPIOs:

1. when should we use this method of GPIO definition versus override API (as for gpio 21 in the same code)?

2. How we come up with the number 13? Where can I lookup the similar number if I want to use other GPIOs?

3. On the DVK, can I use PMODE0 and PMODE2 as simple GPIO output? which method (io matrix or API override) should I use?



gaya's picture
Cypress Employee
578 posts

Hello Nazila,

Answer to your Qn. 2).

We have a total of 64 GPIOs in FX3, divided into two sets of 32 each. In structure, CyU3PIoMatrixConfig_t, 

gpioSimpleEn[2] is an array of two 32 bit elements. gpioSimpleEn[0] represents the first (32) set of Gpios.

gpioSimpleEn[1] represents second (32) set of GPIOs.


Now in order to enable, GPIO 45:

GPIO 45 belongs to second set. Thus taking gpioSimpleEn[1]. In the second set it is 13 pin from the right.

[31,30,29,28,...................4,3,2,1,0 ]          => first set of GPIOs represented by gpioSimpleEn[0].

[63,62,.................45,44,43,42,,41,40,39,38,37,36,35,34,33,32]   => seconde set of GPIOs represnted by gpioSimpleEn[1].


So, as you can see, in  order to enable 45th GPIO pin, you have to left shift 1 thirteen times.


io_cfg.gpioSimpleEn[1] = (1 <<  (45 - 32)); /* Enable GPIO 45 */

                                  = (1 << 13);


Qn.1) Now regarding the difference between the GPIO definintion using IOConfig matrix  (CyU3PDeviceConfigureIOMatrix  API) and CyU3PDeviceGpioOverride API is clear from API guide. The CyU3PDeviceConfigureIOMatrix API checks for validity of the configuration, whereas the override API does not. Also IO matrix cannot be dynamically changed and needs to be invoked during the device initialization, in the main function itself. I will check further for any other notable difference between them, and will let you know if so.

raj8889's picture
57 posts



I find this old thread very useful for me.

But I need further clarifications regarding this

in my custom board a gpio id from FX3 is connected to an LED

I am currently programming a firmware for slavefifo synchronous 32 bit mode.

I have configured the gpio's in slavefifo application initilization function

CyU3PSetGpioOutput(FX3_LED, CyFalse, CyTrue);

and I configure the LED  based on slave fifo mode(16 0R 32 bit) . I configure it using gpiosimple en as you have mentioned. But, the problem starts here if I change the state of LED here, sometimes the LED will never light up or when I program the firmware to the fx3 using control center I cant see any firmware booted but says succesfully configured. What might be the problem??


Log in to post new comments.