Documents for setup Linux x86 platform
DA-820C-KL
DA-682C-KL
DA-681C-KL
MC-1220-KL
V2406C-KL
V2403C-KL
CentOS-7.9
Ubuntu-20.04
Ubuntu-20.04-HWE
Debian-9 (stretch)
Debian-10 (buster)
Debian-11 (bullseye)
-
Check drivers are loaded
- Ensure
gpio_it87
driver is loaded on Linux OS - Ensure
it87_serial
driver is loaded on Linux OS
- Ensure
-
Convert GPIO pin index to gpio sysfs:
- Check IT87 gpio chip index
# cat /sys/class/gpio/gpiochip448/label gpio_it87 # it means IT87 gpio chip base index is started from 448
- Convert GPIO pin index to gpio-sysfs index
GP[n][m] = base + (n - 1) * 8 + m
- e.g.
- GP35 on IT87 gpio chip base 448:
gpio-sysfs index = 448 + (3 - 1) * 8 + 5 =
469
- GP35 on IT87 gpio chip base 448:
gpio-sysfs index = 448 + (3 - 1) * 8 + 5 =
- Export gpio-sysfs index 469
echo 469 > /sys/class/gpio/export
- Set GPIO value (high/low)
# Set High value echo "high" > /sys/class/gpio/gpio469/direction # Set Low value echo "low" > /sys/class/gpio/gpio469/direction
- Get GPIO value
cat /sys/class/gpio/gpio469/value # if return 0 = low # if return 1 = high
-
An example code for Set/Get gpio-sysfs value from GPIO pin
- Set GP14 value as 0: `mx-gpio-ctl set 14 0`
- Get GP14 value: `mx-gpio-ctl get 14`