10-08-2010 06:13 AM
10-11-2010 03:26 AM
You exported one pin of the GPIO Port
echo out > direction
sets this one pin to an output pin.
echo 1 > value sets then the pin
This is now common under many platform, for example on some ARM platforms the GPIOs are also accessed that way.
-Marco
10-08-2010 07:06 AM
please search for "gpio" at xilinx.wikidot.com
10-08-2010 07:52 AM
Thanks, but I don't see 'value' in there:
# ll /sys/class/gpio/gpiochip195/ total 0 drwxr-xr-x 2 root root 0 Oct 4 14:26 ./ drwxr-xr-x 7 root root 0 Oct 4 14:26 ../ -r--r--r-- 1 root root 4.0K Oct 4 14:26 base -r--r--r-- 1 root root 4.0K Oct 4 14:26 label -r--r--r-- 1 root root 4.0K Oct 4 14:26 ngpio lrwxrwxrwx 1 root root 0 Oct 4 14:26 subsystem -> ../../../../class/gpio/ -rw-r--r-- 1 root root 4.0K Oct 4 14:26 uevent
10-08-2010 09:42 AM
Hello,
you need to export the GPIO pins first:
echo 195 > /sys/class/gpio/export
then there should be a new folder which contains value, direction etc.
10-11-2010 02:58 AM
OK, when I do that /sys/class/gpio/gpio195/ indeed appears, but the whole process seems rather 'magical'. I guess that's the way the driver is written, but still...>
The problem now is thus:
# cat /sys/class/gpio/gpio195/direction
in
Does this mean that the GPIO can only have all bits as input or all bits as output ? Where did the direction mask used by the old ioctl go ?!? All my GPIOs (and I have dozens of them) have a mix of input and output bits. So how can I interact with them in user mode ? Do I need to rewrite the driver (which file?) or is there another way besides sysfs ?
Thanks.
10-11-2010 03:26 AM
You exported one pin of the GPIO Port
echo out > direction
sets this one pin to an output pin.
echo 1 > value sets then the pin
This is now common under many platform, for example on some ARM platforms the GPIOs are also accessed that way.
-Marco
10-12-2010 01:31 AM
Thanks.
I decided to use the 'mmap' way of accessing the GPIO, as it is closer to my needs (and probably faster). Seems to be working OK so far.
10-18-2010 07:26 AM
Actually I have an additional question.
So I use the user mode pseudo driver (mmap) to do direct read/write in the GPIOs value and direction registers. It works partially, but I don't find the values I expect when I first boot, so I wonder if there may be some conflict with the sysfs kernel driver (I have left CONFIG_GPIO_SYSFS=y / CONFIG_SYSFS=y / CONFIG_EXPERIMENTAL=y / CONFIG_GPIO_XILINX=y in my kernel, should I remove them ?)