X221D & X221D-AI TECHNICAL REFERENCE MANUAL
VERSION: 0.3
Page 28 of 40
SECTION 11
Appendix B [GPIO]
This Appendix covers the basics of GPIO usage and provides a reference sheet for the socket pin to
GPIOnumber correlation. This section only focuses on the GPIO capable pins. Pins that are not able to
be used as GPIOs are not listed in the reference sheet. (They are most likely CSI, I2C or PCIe lanes)
11.1
GPIO control
This example shows how to set and read out GPIO 414.
For different GPIO numbers replace the number (414) accordingly.
11.1.1
Export GPIO
nvidia@nvidia-desktop:~$ echo 414 > /sys/class/gpio/export
nvidia@nvidia-desktop:~$
11.1.2
Change direction to in
nvidia@nvidia-desktop:~$ echo in > /sys/class/gpio/gpio414/direction
nvidia@nvidia-desktop:~$
11.1.3
Change direction to out
nvidia@nvidia-desktop:~$ echo out > /sys/class/gpio/gpio414/direction
nvidia@nvidia-desktop:~$
11.1.4
Set GPIO low
nvidia@nvidia-desktop:~$ echo 0 > /sys/class/gpio/gpio414/value
nvidia@nvidia-desktop:~$
11.1.5
Set GPIO high
nvidia@nvidia-desktop:~$ echo 1 > /sys/class/gpio/gpio414/value
nvidia@nvidia-desktop:~$
11.1.6
Readout GPIO value
nvidia@nvidia-desktop:~$ cat /sys/class/gpio/gpio414/value
0
nvidia@nvidia-desktop:~$ cat /sys/class/gpio/gpio414/value
1