GPIO Sysfs is the standard way to manage the GPIO lines under Linux from user space. It uses the directory /sys/class/gpio to set or read any GPIO line.
Inside this directory there are two directories called:
To manage a GPIO line you have to know its kernel ID. The Kernel IDs of any Acme Systems SoM are available on:
The Atmel chips have the GPIO lines organized by 32 bit port called PA,PB, etc.
Before set or read a port you have to export it. Follow an example on how to set, reset and read the port PA1 (Kernel ID 1) from the command line:
Set the line status of GPIO line PA1
# echo 1 > /sys/class/gpio/export # echo out > /sys/class/gpio/pioA1/direction # echo 1 > /sys/class/gpio/pioA1/value
Reset the line status of GPIO line PA1
# echo 0 > /sys/class/gpio/pioA1/value
Read the line status of GPIO line PA1
# echo in > /sys/class/gpio/pioA1/direction # cat /sys/class/gpio/pioA1/value
The official documentation about the GPIO Sysfs interface is available on: