Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > USB Controllers > GPIO

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



GPIO
Moderator:
RSKV

Post Reply
Follow this topic



GPIO

Nazila posted on 18 Oct 2011 11:41 AM PST
Top Contributor
55 Forum Posts

Hi,

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?

Thanks,

Nazila




Re: GPIO

Gayathri posted on 19 Oct 2011 04:22 AM PST
Cypress Employee
327 Forum 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.

Thus 

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.






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.