This short tutorial describes how to get GPIO working. For this you need tool called gpioctl. Table describing which pin is where can be found here: carambola_pinout.


  • Type make menucongfig
  • Under Utilities select package gpioctl and build carambola firmware (although you can do it directly on carambola typing opkg update; opkg install gpioctl)
  • In latest revisions gpioctl become deprecated. If you still need to use it, install from older repository.


Prepare GPIO as output

gpioctl dirout 1;  gpioctl dirout 2

Set both to 1

gpioctl set 1; gpioctl set 2

Clear both

gpioctl clear 1; gpioctl clear 2

Read status

gpioctl dirin 1; gpioctl dirin 2; gpioctl get 1; gpioctl get 2

Controlling gpio pins as files in /sys

Another method for controlling gpios using files instead of commands:

cd /sys/class/gpio
echo 1 > export 

this will make the virtual directory “gpio1” available in /sys/class/gpio/gpio1 inside “gpio1” you will find, among others:

  • direction (“in” or “out”)
  • value (0 or 1)

Just write/read those file to do I/O. For example

echo out > direction
echo 1 > value

will put the pin in output mode and high

echo in > direction
cat value

will read the pin instead

Recent changes RSS feed Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki