I am trying to read the user button using the directions at http://elinux.org/EBC_Exercise_02_Flashing_an_LED. When I navigate to /sys/class/gpio and then echo 4 > export, no folder gets created and no error message gets printed. Why is this? Did the pin get moved? The hardware manual (C.1.0 page 71) says the user button is on pin GPIO_7/SYSBOOT_5 but the schematic in the same manual (page 156) shows it connected to SYS_BOOT/GPIO_4. I can create gpio5 and gpio7 by writing to export, but when I cd gpio5 or gpio7 and then cat value, it always reads 0, so I’m assuming the button isn’t on gpio5 or gpio7? I am using Angstrom.
Seems GPIO for xM user button is 4 (can be checked from the kernel source). I guess the reason why echoing 4 to /sys/class/gpio does not work is that the keys_gpio platform driver reserves the GPIO 4.
If the gpio4 is locked then how can it's state be read?
The same tutorial worked for me before i updated the Angstrom to the
latest version - now it does not.
Yes, you are correct. I recently when through this myself. When I
pulled down the latest kernel (3.0.17 at the time) built with Angstrom
... the user button was reserved by gpio-keys so you cannot access
that button through the sysfs method. If you want to use the sysfs
method then you need to go into the board file and stub out the
platform device registering of the gpio-keys.