GPIO configuration

cancel
Showing results for 
Search instead for 
Did you mean: 

GPIO configuration

970 Views
Contributor IV

We have configured GPIO using the following statements on IMX53 based custom board. In sysfs we could see "active_low" and "value" files under gpio folder.

       gpio_request(TEST,"test");

       gpio_direction_output(TEST,0);

       gpio_export(TEST,0);

We couldn't able to set value in value file, if we set the value in "active_low" then it is reflecting on "value" file.

Labels (1)
0 Kudos
2 Replies

50 Views
NXP Employee
NXP Employee

Hi Ravi,

You could take a look at the following links, where GPIO configuration information is provided:

Simple GPIO Example - quandry

Basic GPIO usage from Linux on UDOO NEO board

Access GPIO from Linux user space | FalsinSoft

Hope this will be useful for you.
Best regards!
/Carlos
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

50 Views
Contributor II

Hello Carlos!CarlosCasillas

 

I was able to successfully follow the "Simple GPIO Example - quandry" guide and control an GPIO output but now I would like to setup and configure it from the device tree, which I started to learn recently.

In other words, I would like to boot up the board and already have my GPIO listed under /sys/class/gpio/<my_gpio> like other devices that use GPIO in the device tree and have it setup as low by default.

I am using an IMX6Q SABRED SD. I have seen many examples but I get stuck with IMX6 because I don't seems to find a "fsl,imx6q-gpio" or similar and I wouldn't know what to populate in the register field.

 

References I have been using:

Pin settings app note:

http://cache.freescale.com/files/32bit/doc/app_note/AN5078.pdf 

Device tree app note:

http://www.nxp.com/assets/documents/data/en/application-notes/AN5125.pdf 

More on device tree:

Device Tree Customization 

Linux docs:

Documentation/devicetree/bindings/gpio/gpio.txt

 

-Andrey-

0 Kudos