Aria Ti am335x GPIO control: Difference between revisions
Jump to navigation
Jump to search
(Created page with " ==Control GPIO via Shell== ===init=== # mount -t debugfs none /sys/kernel/debug # echo 7 > /sys/kernel/debug/omap_mux/mcasp0_ahclkx # echo 117 > /sys/class/gpio/export #...") |
m (C2h2 moved page Aria am335x GPIO control to Aria Ti am335x GPIO control) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
==Control GPIO via Shell== | ==Control GPIO via Shell== | ||
To control GPIO3_21, we need to control on gpio117 (32*3+21 = 117) | |||
===init=== | ===init (only do once)=== | ||
# mount -t debugfs none /sys/kernel/debug | # mount -t debugfs none /sys/kernel/debug #mount debugfs | ||
# echo 7 > /sys/kernel/debug/omap_mux/mcasp0_ahclkx | # echo 7 > /sys/kernel/debug/omap_mux/mcasp0_ahclkx #pinmux to mode 7 (gpio mode) | ||
# echo 117 > /sys/class/gpio/export | # echo 117 > /sys/class/gpio/export #export the pin | ||
# echo out > /sys/class/gpio/gpio117/direction | # echo out > /sys/class/gpio/gpio117/direction #set direction, out or in | ||
===on and off=== | ===on and off=== | ||
# echo 1 > /sys/class/gpio/gpio117/value #on | # echo 1 > /sys/class/gpio/gpio117/value #on | ||
# echo 0 > /sys/class/gpio/gpio117/value #off | # echo 0 > /sys/class/gpio/gpio117/value #off | ||
==LED | ==LED Blink test== | ||
# while | # while true;do echo 1 > /sys/class/gpio/gpio117/value ; sleep 1 ;echo 0 > /sys/class/gpio/gpio117/value ;sleep 1 ;done |
Latest revision as of 04:44, 3 November 2020
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