How to use GPIOs on CC6UL and CC6

GPIOs can be accessed from Linux user space through the sysfs interface, example:

echo 4 >/sys/class/gpio/export
echo out >/sys/class/gpio/gpio4/direction
echo 1 >/sys/class/gpio/gpio4/value
echo 0 >/sys/class/gpio/gpio4/value

Digi Embedded Yocto offers an example application gpio_sysfs_test which can be added to local.conf:

EXTRA_IMAGE_FEATURES += dey-examples

IMAGE_INSTALL_append += dey-examples-gpio-sysfs


Usage: gpio-sysfs-test <gpio_in> [gpio_out]

 Where gpio_in is a pushbutton and gpio_out an optional LED



When using GPIOS from the MCA the base address is gpiochip504.

When using GPIOs on the CC6UL development board i/o-expander, make sure you have firmware loaded for the i/o expander:

# sysinfo


|| I/O Expander | HW_VERSION=1  FW_VERSION=0.2


if it shows FW_VERSION=?? or you don't have sysinfo and can't access:

cat /sys/bus/i2c/devices/0-006e/fw_version

check: i/o expander not programmedi/o expander not programmed

The base address for the i/o expander is gpiochip465. See:

The User LED on the CC6UL SBC is connected to IO23 of the i/o expander, its gpio number is 488 (465 + 23), example:

echo 488 >/sys/class/gpio/export
echo out >/sys/class/gpio/gpio488/direction

cat  /sys/class/gpio/gpio488/value

echo 1 >/sys/class/gpio/gpio488/value
echo 0 >/sys/class/gpio/gpio488/value


Last updated: Oct 06, 2017

Filed Under


Recently Viewed

No recently viewed articles

Did you find this article helpful?