Please see the following table for the translation from baseboard pin to CPU pin:
Under Linux you can use sysfs to access gpios.
To get access to an GPIO pin, first write the GPIO number to /sys/class/gpio/export
echo 34 [gt] /sys/class/gpio/export
Now you should find a directory in /sys/class/gpio to access your GPIO pin. Write in or out to direction to change the direction of the pin:
echo out [gt] /sys/class/gpio/gpio34/direction
The value (0 for off, 1 for on) of the pin is in the value file. To read or change it, read the file or write to it.
echo 1 [gt] /sys/class/gpio/gpio34/value
cat /sys/class/gpio/gpio34/value
The list of GPIO numbers can be found below.
Avari
There are 8 GPIOs on J27 with a signal level of 3.3V.
Connector | Pin | Signal | Signal on MX6 | Bank and pin | GPIO Number |
---|---|---|---|---|---|
J27 | 8 | GPIO_1 | GPIO_1 | 2-0 | 32 |
J27 | 10 | GPIO_2 | GPIO_2 | 2-1 | 33 |
J27 | 12 | GPIO_3 | GPIO_3 | 2-2 | 34 |
J27 | 14 | GPIO_4 | GPIO_4 | 2-3 | 35 |
J27 | 16 | GPIO_5 | GPIO_5 | 2-4 | 36 |
J27 | 18 | GPIO_6 | GPIO_6 | 2-5 | 37 |
J27 | 20 | GPIO_7 | GPIO_7 | 2-6 | 38 |
J27 | 22 | GPIO_8 | GPIO_8 | 2-7 | 39 |
Bvari
There are 8 GPIOs on J14 with a signal level of 3.3V.
Connector | Pin | Signal | Signal on MX6 | Bank and pin | GPIO Number |
---|---|---|---|---|---|
J14 | 8 | GPIO_1 | GPIO_1 | 2-0 | 32 |
J14 | 10 | GPIO_2 | GPIO_2 | 2-1 | 33 |
J14 | 12 | GPIO_3 | GPIO_3 | 2-2 | 34 |
J14 | 14 | GPIO_4 | GPIO_4 | 2-3 | 35 |
J14 | 16 | GPIO_5 | GPIO_5 | 2-4 | 36 |
J14 | 18 | GPIO_6 | GPIO_6 | 2-5 | 37 |
J14 | 20 | GPIO_7 | GPIO_7 | 2-6 | 38 |
J14 | 22 | GPIO_8 | GPIO_8 | 2-7 | 39 |