[beagleboard] GPIO Pinmuxing

With much help from emeb on the #beagleboard IRC channel, I’ve managed to configure McSPI 3 and 4, and UART2 via the kernel’s pinmuxing mechanism (files attached). However, I still cannot get GPIOs 131 through 135 and 162 working correctly.

The gpio-grep.txt attachment is a result of “grep -ni “GPIO” .config”, and the snip-kernel-boot.txt attachment is the relevant kernel boot output.

When I look at /sys/class/gpio, I have the following files:

export gpiochip0 gpiochip32 gpiochip64 gpiochip96 gpiochip128 gpiochip160 gpiochip192 unexport

When I try to open a GPIO by “echo 162 > ./export” I get “-bash: ./export: Permission denied”, even when I use sudo.

The permissions on export are:
–w------- 1 root root 4096 1969-12-31 17:00 export

Has anybody else successfully set the pinmux for these GPIOs in the kernel or in U-Boot? And is it possible to mix-and-match pinmuxes between U-boot and the kernel - eg: setup the GPIOs in U-boot and SPI and UART2 in the kernel?

Any help is greatly appreciated.

Thanks.
– Andruk

snip-kernel-boot.txt (3.28 KB)

board-omap3beagle.c (14.7 KB)

mux.c (23.5 KB)

mux.h (17.9 KB)

gpio-grep.txt (712 Bytes)

Andruk Tatum wrote:

When I try to open a GPIO by "echo 162 > ./export" I get "-bash: ./export: Permission denied", even when I use sudo.

The permissions on export are:
--w------- 1 root root 4096 1969-12-31 17:00 export

I think your issue is not related to the code but to the bash shell.

I assume you said "sudo echo 162 > ./export". What happens in this case is that just "echo 162" is executed with root permissions, but the opening and access to "export" is made with your normal user rights.

Instead you can do for example:

   sudo su
   echo 162 > ./export
   exit

That should work (as far as shell and permissions are concerned).

Kind regards,
Stefan

That did it. Thank you!

Is it possible to run a program without root privileges and have it do the same thing?

– Andruk

This is getting a bit off-topic now, but you should be able to set different permissions for 'export'.

You can read it up in the man pages for chmod and chown/chgrp.

If your account is in group 'user' you should be able to allow access to 'export' for all accounts in group 'user' by

   sudo chgrp user export
   sudo chmod g+w export

you can find out which groups you are in by issuing

   groups

Kind regards,
Stefan

Andruk Tatum wrote:

Hi All,
I have read somewhere that only a few pins among gpios can be used for generating irq. Can gpio 183 be used for irq? If not which gpio pin on the 24 pin expansion connector be used as irq?

Everett

ll GPIO pins can be used to generate interrupts. Only a few pins can generate a interrupt that will wake the processor up from a powerdown state.

Gerald