AFE-E630 GPIO

From ESS-WIKI
Jump to: navigation, search

RTENOTITLE

RTENOTITLE

Test

Export GPIO then you can use control GPIO from userr space through sysfs.

Export GPIO0

# echo 8 > /sys/class/gpio/export

Set GPIO direction to in/out

# echo "out" > /sys/class/gpio/gpio8/direction

Set GPIO value 0/1 if GPIO pin define is output

#  echo 1 > /sys/class/gpio/gpio8/value

Unexport GPIO0

# echo 8 > /sys/class/gpio/unexport

GPIO Test

1. GPIO0 and GPIO1 are taken as an example: Connect GPIO0 and GPIO1

  • Export GPIO0 and GPIO1
# echo 8 > /sys/class/gpio/export
# echo 98 > /sys/class/gpio/export
  • Set GPIO0 to output and GPIO1 to input
# echo "out" > /sys/class/gpio/gpio8/direction
# echo "in" > /sys/class/gpio/gpio98/direction
  • Change GPIO0 to 1 and read GPIO1 value
# echo 1 > /sys/class/gpio/gpio8/value
# cat /sys/class/gpio/gpio98/value 
1
  • Change GPIO0 to 0 and read GPIO1 value
# echo 0 > /sys/class/gpio/gpio8/value
# cat /sys/class/gpio/gpio98/value 
0

AFE-E630 GPIO Function.png

2. Test GPIO mode 2(Short Pin1->6、2->7、3->4)

# /tools/test/adv/gpio/gpio_autotest.sh

AFE-E630 GPIO Loopback.png