Roadrunner technical documentation Buy

Manage the GPIO lines using the sysfs user interface (deprecated)

GPIO sysfs is the legacy 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. replaced with the GPIO character device.

Inside this directory there are two directories called:

  • export
  • unexport

To manage a GPIO line you have to know its kernel ID. The Kernel IDs of any Acme Systems SoM are available on:

Check the port available by typing this command:

sudo less /sys/kernel/debug/pinctrl/fc038000.pinctrl-atmel_pinctrl/pinconf-pins

The Microchip 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

sudo sh -c "echo 1 > /sys/class/gpio/export"
sudo sh -c "echo out > /sys/class/gpio/PA1/direction"
sudo sh -c "echo 1 > /sys/class/gpio/PA1/value"

Reset the line status of GPIO line PA1

sudo sh -c "echo 0 > /sys/class/gpio/PA1/value"

Read the line status of GPIO line PA1

sudo sh -c "echo in > /sys/class/gpio/PA1/direction"
cat /sys/class/gpio/PA1/value

The official documentation about the GPIO Sysfs interface is available on:

Related products

RoadRunner D2

Features Index Buy

Low-power Linux System On Module
  • CPU Microchip SAMA5D27
  • Cortex A5 @ 500 MHz
  • Low power consumption:
    Suspend to RAM mode 10mW
    Full speed: 396mW
  • Debian, Buildroot and Yocto Linux
  • Fully open source drivers
H10

Features Index Buy

Single Board Computer based on RoadRunner Linux SOM (Included)
  • Low power consumption
  • Two USB Host 2.0 ports (one configurable as USB client on the USB-C connector)
  • One 10/100 Mbit/s Lan port
  • 2 Acme Sensor ports
  • Huge set of GPIOS, SPI, I2C and serial lines

Features Buy

Evaluation board for RoadRunner SOM
  • All the circuitries you need to test the RoadRunner SOM
  • USB host, USB device, Ethernet port, MicroSD socket
  • Test points for power consumption measurements
  • All the Roadrunner signals exposed on 2.54mm pitch pins
  • On-board supercap for RTC and backup memory circuit

Home page Roadrunner technical documentation Buy