Aria Ti am335x GPIO control: Difference between revisions

From Ariaboard Wiki
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 #...")
 
No edit summary
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 IO test==
==LED Blink test==
  # while f=1 ;do echo 1 > /sys/class/gpio/gpio117/value ; sleep 1 ;echo 0 > /sys/class/gpio/gpio117/value ;sleep 1 ;done
  # while true;do echo 1 > /sys/class/gpio/gpio117/value ; sleep 1 ;echo 0 > /sys/class/gpio/gpio117/value ;sleep 1 ;done

Revision as of 00:20, 16 April 2015

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