VoCore: GPIO Test

GPIO works, not that hard. 🙂

GPIO is map to linux file system.
It is here: /sys/class/gpio
in this folder, there are three files/folders:

root@OpenWrt:/sys/class/gpio# ls
export     gpiochip0  unexport

export: this is used to export GPIO interface, so we are able to use it by command/code directly.
unexport: unexport the exported GPIO interface.
gpiochip0: not sure about that, should be a map for gpio control driver.

Export one GPIO, for example, GPIO0, it is at top-right of VoCore.

vocore.gpio.1

echo 0 > export

Now, interesting, a new folder named gpio0 appears:

root@OpenWrt:/sys/class/gpio# ls
export     gpio0      gpiochip0  unexport

So we have succeeded map gpio0 to the file system.
Go into that folder, we will see:

root@OpenWrt:/sys/devices/10000000.palmbus/10000600.gpio/gpio/gpio0# ls
active_low  device      direction   edge        subsystem   uevent      value

active_low: looks like a notify. 🙂
device: it is a link, device -> ../../../10000600.gpio
direction: in/out, depend on this.
edge: do not know… 🙂
subsystem: a link again, subsystem -> ../../../../../class/gpio
uevent: emm, I am too lazy to search it. 😀
value: this is input/output/current value of GPIO.

If we want to use GPIO0 control a LED, we must make its direction out.

echo out > direction

Now, use a simple script to make the LED flash:

while [ 1 ]
do
echo 1 > value
sleep 1
echo 0 > value
sleep 1
done

Looks like everything works fine. Video here:
Youtube: http://youtu.be/aOTZYtB8U3w
Youku: http://v.youku.com/v_show/id_XNzE5Nzc2MzI4.html

Just one problem, the WLAN_LED should remain bright when it boots into Linux as the old version, weird, it just come to dark when wifi is ready. I think there must be something wrong with dts, I changed it. 😀

2 thoughts on “VoCore: GPIO Test

    1. vongervonger Post author

      The chip has that function, but also depend on openwrt GPIO driver.

Comments are closed.