Beagle Board xm GPIO using ubunut 12.04

Hi!,

I am using Beagle board xm A3 which running with ubuntu 12.04 but when i am trying to read GPIO( e.g. expansion connector signal GPIO_157) using user or driver method.I am not able to read GPIO port.

So please let me know how can i read GPIO port from Expansion connector of Beagle Board xm using ubuntu? (Beagle Board xm reference manual page 108 )

Regards,
Chetan

I can’t give you really detailed help, but I hope I can provide enough to point you the right way.

You need to be sure the pin is configured to read by setting the pin Mux (as root), that the pin is exported via sysfs, and that the user that is trying to read the pin has read permission (I think that is the default, but you should double-check). The hardest part (I think) is figuring out what the pin is called by the OS for setting the Mux; my guess from the SRM (I have a Beaglebone, not the BB xm) is that it is /sys/kernel/debug/omap_mux/mcbsp1_fsr , but you will have to have a look and see. I set the pin mux on boot from /etc/rc.local. My Beaglebone-specific /etc/rc.local, which uses P8_04 for digital output and P8_11 for digital input is excerpted here:
`

Set MUX settings

/sys/kernel/debug/omap_mux/gpmc_ad13 is P8_11 per

Beaglebone_A5_SRM.pdf

echo 7 > /sys/kernel/debug/omap_mux/gpmc_ad13

/sys/kernel/debug/omap_mux/gpmc_ad7 is P8_04

echo 27 > /sys/kernel/debug/omap_mux/gpmc_ad7

export P8_04 (Enable line to motion detector)

echo 45 > /sys/class/gpio/export

Set direction to output

echo ‘out’ > /sys/class/gpio/gpio45/direction

Make pin writeable by members of gpioaccess group

chown root:gpioaccess /sys/class/gpio/gpio45/value

chmod g+w /sys/class/gpio/gpio45/value

export P8_11 (Sense line from motion detector)

echo 39 > /sys/class/gpio/export

Set direction to input

echo ‘in’ > /sys/class/gpio/gpio39/direction

exit 0
`

Reading the following helped me a lot:
http://elinux.org/BeagleBoardPinMux

http://www.gigamegablog.com/2012/01/05/beaglebone-coding-101-blinking-an-led/

http://www.gigamegablog.com/2012/03/16/beaglebone-coding-101-buttons-and-pwm/

Keep in mind that any examples for Angstrom may not work verbatim for Ubuntu, because usually the code you write is executed as the root user on Angstrom and therefore issues pertaining to file permissions are absent. There may be more BB xm -specific information out there; I just know that sometimes I had to extrapolate from what I read pertaining to the Beageboard to Beaglebone for my uses.

Hope this helps.
Al

Thanks for quick reply,

I will study Pin mux configuration of uboot and kernel for beagle board xm board (ubuntu OS).

Regards,
Chetan