cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
sebastianro
Participant
Participant
3,613 Views
Registered: ‎10-22-2010

GPIO access

Hi,

 

This isn't really an embedded Linux question but I don't know where to ask it, so a response or a suggestion for another linux forum are both great. Here I go: i'm trying to access the GPIO pins on a motherboard under linux, 2.6.28 kernel. I read that if I have the sysfs support for the kernel (which I do :D) all I have to do is enable the respectiv pin using: "echo N > /sys/class/gpio/export" and I would get a gpioN directory, but I always get: "write error : invalid argument". Maybe the GPIO number I use it's incorrect. How do I find the GPIO number?

 

Thanks

0 Kudos
2 Replies
linnj
Xilinx Employee
Xilinx Employee
3,592 Views
Registered: ‎09-10-2008

I pasted in from the wiki and I think this answers your question, if not keep asking.  Or provide exactly what you seen in sysfs and what you do.

 

Using the GPIO driver from User Space with Bash

Figuring out the exact GPIO was not totally obvious when there were multiple GPIOs in the system. One way to do is to go into the gpiochips in /sys/class/gpio and view the label as it should reflect the address of the GPIO in the system. The name of the the chip appears to be the 1st GPIO number (I added number here) of the controller.

 

Hope that helps.

0 Kudos
sebastianro
Participant
Participant
3,576 Views
Registered: ‎10-22-2010

Thanks for the response but it doesn't help... In /sys/class/gpio I only have export and unexport, I don't have any GPIO...

0 Kudos