EBC Exercise 11c getting more gpio

From eLinux.org
Jump to: navigation, search

thumb‎ Embedded Linux Class by Mark A. Yoder


Many of the gpio pins are preallocated to things like the HDML interface, eMMc, etc. This shows you how to recover those pins.

Seeing if a pin is taken

When you look at the rightmost column of the P8 and P9 header tables you see notes about how the pins can be allocated.

P8allocation.png

You can check each pin with config-pin

bone$ config-pin -q P9_25
ERROR: open() for /sys/devices/platform/ocp/ocp:P9_25_pinmux/state failed, No such file or directory

So, P9_25 is taken for something.

Reclaiming the gpio pins

These can be unallocated by editing /boot/uEnv.txt

bone$ sudo vi /boot/uEnv.txt

Down a ways you'll see:

Line
 29 ###Disable auto loading of virtual capes (emmc/video/wireless/adc)
 30 #disable_uboot_overlay_emmc=1
 31 disable_uboot_overlay_video=1
 32 #disable_uboot_overlay_audio=1
 33 #disable_uboot_overlay_wireless=1
 34 #disable_uboot_overlay_adc=1

Uncomment the line(s) you want to free up. Here I've uncommented line 31 which will free up the hdmi video and audio pins.

Restart

bone$ sudo reboot

and check again.

beon$ config-pin -q P9_25
Current mode for P9_25 is:     gpio

Success!




thumb‎ Embedded Linux Class by Mark A. Yoder