TS-7800-V2 GPIO

From Technologic Systems Manuals

The TS-7800-V2 uses a Linux sysfs GPIO driver to access all GPIO. See the master gpio table for information on disambiguation of GPIO numbers and pin names. The Linux Kernel Sysfs GPIO driver is documented at kernel.org here: https://www.kernel.org/doc/Documentation/gpio/sysfs.txt

In the most general of sense, a GPIO on the TS-7800-V2 is treated the same as a set of files in the filesystem. Here is an example in Bash to set and clear DIO_4 (CN8 pin 4) as an output, and then read the value of DIO_5 as an input:

root@ts7800-v2:~# echo 66 > /sys/class/gpio/export  # DIO_4 is GPIO number 66
root@ts7800-v2:~# echo 67 > /sys/class/gpio/export  # DIO_5 is GPIO number 67
root@ts7800-v2:~# echo "out" > /sys/class/gpio/gpio66/direction
root@ts7800-v2:~# echo "in" > /sys/class/gpio/gpio67/direction
root@ts7800-v2:~# echo 1 > /sys/class/gpio/gpio66/value
root@ts7800-v2:~# echo 0 > /sys/class/gpio/gpio66/value
root@ts7800-v2:~# cat /sys/class/gpio/gpio67/value  # DIO_5 has a nominal pull-up to 3.3.
1
root@ts7800-v2:~#

In this manner, dio4 and dio5 could be wired together to demonstrate both functionalities simultaneously. Run the above example, then wire CN 8 pin 4 and CN 8 pin 5 together, and confirm functionality thus:

root@ts7800-v2:~# echo 0 > /sys/class/gpio/gpio66/value
root@ts7800-v2:~# cat /sys/class/gpio/gpio67/value
0
root@ts7800-v2:~# echo 1 > /sys/class/gpio/gpio66/value
root@ts7800-v2:~# cat /sys/class/gpio/gpio67/value
1

Note: The GPIO functionality of any pin will be overridden by other drivers, such as the userspace SPI and I2C drivers. If a GPIO is not responding as expected, check the device tree to see if another driver already has that pin taken. Normally when this is the case, an attempt to modify the GPIO through sysfs will generate a "busy" error in the OS.