03-30-2011 09:06 AM
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?
03-31-2011 12:11 PM
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.