Aria am335x GPIO control

From Aria Wiki
Jump to: navigation, search

Control GPIO via Shell

To control GPIO3_21, we need to control on gpio117 (32*3+21 = 117)

init (only do once)

# mount -t debugfs none /sys/kernel/debug  #mount debugfs
# echo 7 > /sys/kernel/debug/omap_mux/mcasp0_ahclkx #pinmux to mode 7 (gpio mode)
# echo 117 > /sys/class/gpio/export #export the pin
# echo out > /sys/class/gpio/gpio117/direction #set direction, out or in

on and off

# echo 1 > /sys/class/gpio/gpio117/value #on
# echo 0 > /sys/class/gpio/gpio117/value #off

LED Blink test

# while true;do echo 1 > /sys/class/gpio/gpio117/value ; sleep 1 ;echo 0 > /sys/class/gpio/gpio117/value ;sleep 1 ;done