Confused about GPIO's

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

cross mob
TeIk_3653391
Level 4
Level 4
25 sign-ins First like received 10 questions asked

Hi,

What is the correct way to use GPIO's? We have a board where CYPD5225 has to control few devices by pulling several gpios low and high. Simple enough. However I can't seem to find clear example what is the right way (tm) of doing this.

Only clue is FW_IND pin that is configured by default in the shipped example project.

q1.png

This autogenerates some pin functions but those are not used.

q2.png


Instead example code uses some low level api and hardcoded defines.


...

    gpio_set_value (FW_LED_GPIO_PORT_PIN, !(gpio_read_value (FW_LED_GPIO_PORT_PIN)));

...

...

   /* Configure the LED control GPIO as an output. */

   gpio_hsiom_set_config (FW_LED_GPIO_PORT_PIN, HSIOM_MODE_GPIO, GPIO_DM_STRONG, true);

...


Is there a simple example how GPIO's should be used?

0 Likes
1 Solution
VenkataD_41
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi,

Please go through the following application note on PSoC 4 GPIOs

https://www.cypress.com/documentation/application-notes/an86439-psoc-4-using-gpio-pins

The above web page has a document along with a zip folder containing projects on the usage of GPIOs. Please go through first 2 projects.

Also, please go through Digital Pins code example present in PSoC Creator code examples section.

Thanks

Ganesh

View solution in original post

3 Replies
VenkataD_41
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi,

Please go through the following application note on PSoC 4 GPIOs

https://www.cypress.com/documentation/application-notes/an86439-psoc-4-using-gpio-pins

The above web page has a document along with a zip folder containing projects on the usage of GPIOs. Please go through first 2 projects.

Also, please go through Digital Pins code example present in PSoC Creator code examples section.

Thanks

Ganesh

Thank you, this helps a lot.


If I've understood correctly I don't need to initialize GPIO's myself, the framework handles that as long pins have been bound in PSoC Creators "Design Wide Resources"-pins view.

0 Likes

Hi TeIk_3653391​,

Yes, You do not need to initialize the GPIOs. As already mentioned in the App Note : https://www.cypress.com/documentation/application-notes/an86439-psoc-4-using-gpio-pins , the Pins Component is the recommended method for connecting internal PSoC resources to a physical pin. It allows PSoC Creator to automatically place and route the signals within the PSoC device based on the chosen pin configuration.

Best Regards,

Aashita

0 Likes