On this Page

Control Overo GPIO

The Overo kernels support the sysfs gpio implementation for accessing GPIO from userspace.

This allows you to control GPIO from the command line this way.

root@overo# echo 146 > /sys/class/gpio/export
root@overo:/sys/class/gpio# cat gpio146/direction
root@overo# echo out > /sys/class/gpio/gpio146/direction
root@overo:/sys/class/gpio# cat gpio146/direction
root@overo# cat /sys/class/gpio/gpio146/value
root@overo# echo 1 > /sys/class/gpio/gpio146/value
root@overo# cat /sys/class/gpio/gpio146/value

If you have an expansion card with a 40 pin header, then this will be controlling pin 27. You can use pin 1 for a ground. (If you don't have a meter, a p/n 276-0330 1.8V Red LED from Radio Shack works for testing.)
Schematics and pin-outs for the Gumstix expansion boards can be found here.

How It Works

Making Modifications

Overo Kernel Usage

Just because pins are configured as GPIO in u-boot, doesn't necessarily mean you can use them. If you look at /sys/class/gpio on a default Overo, you'll get something like this.

root@overo:~# ls /sys/class/gpio
export	gpio164  gpio65       gpiochip160  gpiochip64
gpio15	gpio168  gpiochip0    gpiochip192  gpiochip96
gpio16	gpio176  gpiochip128  gpiochip32   unexport

The reason you see some GPIO already exported is because the linux code in arch/arm/mach-omap2/board-overo.c is explicitly exporting these pins for another use. Whether they are being used depends on the hardware you have attached. The kernel also uses pins configured as GPIO that it doesn't export. These depend on the board configuration and the kernel drivers being used.

To be more explicit, look inside board-overo.c, you'll see these definitions

#define OVERO_GPIO_BT_XGATE     15
#define OVERO_GPIO_W2W_NRESET   16
#define OVERO_GPIO_PENDOWN      114
#define OVERO_GPIO_BT_NRESET    164
#define OVERO_GPIO_USBH_CPEN    168
#define OVERO_SMSC911X_GPIO    176
#define OVERO_SMSC911X2_GPIO   65
#define OVERO_GPIO_LCD_EN 144
#define OVERO_GPIO_LCD_BL 145

Follow their usage inside the file and you will be able to explain the /sys/class/gpio output you see above.

Input or Output

Pins configured as GPIO are sometimes also specified as being strictly input or output. This can happen when they are mux'd or when they are explicitly exported by the kernel. In either of those cases, you won't be able to change the I/O direction from userspace.

Electrical Specifications

Voltage is 1.8v.

Usable Pins

Here's a few GPIO you can use immediately from userspace without any u-boot or kernel changes. It will however require that the specific GPIO isn't used by the attached expansion board.

40 Pin Expansion Header

Palo43 Board

Programming Pins

Example Changing the Multiplexing for a Pin

Interrupts on GPIO Pins

GPIO Software for the Overo

More Links

Here is another article BeagleBoardPinMux talking about OMAP3 pin muxing.

Verdex GPIO

GPIO( n )

  • Logic level (3.3V) signals
  • 3-4mA max
  • Note: This section is incomplete. GPIO's information and examples should go here.

According to the PXA270 datasheet, most of the pins are limited to 3mA, and a few can go upto 4 mA (see page 5-9).

Accessing GPIO's from userland

Alternative method to access GPIO's from userland

The User GPIO Driver provides a reflection of the kernel's gpiolib library into userspace.

GPIO Event Driver

The GPIO Event Driver allows gpio changes to be captured from user-space.