Home/Support/Support Forum/Access GPIO CC6
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

Access GPIO CC6

0 votes
Hello,

I am trying to access the GPIO on my CC6 but I have some problems. I found a programme gpio_test.c ans i tried to execute it but I have the error :
open "/sys/kernel/machine/name: No such file or directory"

Is it normal?

I made a programme that allows me to controle the leds on the board just by giving their linux number ( 34,35 or 36) as argument and I would like to make the same for the gpio but in the documentation they are referenced as "TOUCH_X1" or "EXP_GPIO_0". Is there any way to turn it into numbers so I can try to use the same program to controle also the gpio?

Thanks a lot :)
asked Jul 2, 2015 in Linux by digiConnectcore6 New to the Community (2 points)

Please log in or register to answer this question.

3 Answers

0 votes
I am not sure I understand. LEDs are controlled by GPIOs, so if you can blink LEDs you can do the same with any other GPIO

you can also try something like this:
/sys/class/gpio # echo 117 > export
/sys/class/gpio # echo out > gpio117/direction
/sys/devices/virtual/gpio/gpio117 # echo 1 > value

something similar is described in Linux BSP Reference Manual for cc6sbc:
For example, to enable a GPIO, 36 on the example below, to wake up the system you can do:
# echo -n 36 > /sys/class/gpio/export
# echo in > /sys/class/gpio/gpio36/direction
# echo 1 > /sys/class/gpio/gpio36/active_low
# echo rising > /sys/class/gpio/gpio36/edge
# echo enabled > /sys/class/gpio/gpio36/device/power/wakeup
answered Jul 6, 2015 by LeonidM Veteran of the Digi Community (3,622 points)
0 votes
also see the GPIO chapter in the same document
inux BSP reference manual ConnectCore 6 SBC
http://ftp1.digi.com/support/documentation/90001424_B.pdf

GPIO
The CPU has seven GPIO ports, six with 32 GPIOs and one with 14 GPIOs. GPIOs are multiplexed with
different functionalities of the chip. IOMUX of the pins is done at the device tree.
The GPIO Device Tree binding is described at Documentation/devicetree/bindings/gpio/fsl-imxgpio.
txt.
The GPIOs can be easily accessed from the sysfs. For information about how to manage the GPIOs
from sysfs, refer to the Linux kernel documentation at Documentation/gpio.txt.
The ConnectCore 6 SBC contains three user LEDs that can be used to test GPIOs.
A sample application called gpio_sysfs_test is available and can be added to the rootfs by adding
dey-examples to the EXTRA_IMAGE_FEATURES of your local.conf or by adding
dey-examples-gpio-sysfs to IMAGE_INSTALL_append.
answered Jul 6, 2015 by LeonidM Veteran of the Digi Community (3,622 points)
0 votes
Another example setting GPIO as output
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
answered Jul 6, 2015 by LeonidM Veteran of the Digi Community (3,622 points)
...