Enabeling GPIO control
To get access to an GPIO pin, first write the GPIO number to /sys/class/gpio/export
echo 40 [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/gpio40/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/gpio40/value
cat /sys/class/gpio/gpio40/value
The list of GPIO numbers can be found below.
Verno 3/Verno4/Cadun
There are 8 GPIOs on J12 with a signal level of 3.3V and 14 more on J16 via an GPIO expander.
Connector | Pin | Signal | Signal on MX53 | Bank and pin | GPIO Number |
---|---|---|---|---|---|
J12 | 4 | GPIO_0 | GPIO_A | 2-8 | 40 |
J12 | 6 | GPIO_1 | GPIO_B | 2-9 | 41 |
J12 | 8 | GPIO_2 | GPIO_C | 2-10 | 42 |
J12 | 10 | GPIO_3 | GPIO_D | 2-11 | 43 |
J12 | 12 | GPIO_4 | GPIO_E | 2-12 | 44 |
J12 | 14 | GPIO_5 | GPIO_F | 2-13 | 45 |
J12 | 16 | GPIO_6 | GPIO_G | 2-14 | 46 |
J12 | 18 | GPIO_7 | GPIO_H | 2-15 | 47 |
J16 | 3 | GPIO_I2C_0 | 224 | ||
J16 | 4 | GPIO_I2C_8 | 232 | ||
J16 | 5 | GPIO_I2C_1 | 225 | ||
J16 | 6 | GPIO_I2C_9 | 233 | ||
J16 | 7 | GPIO_I2C_2 | 226 | ||
J16 | 8 | GPIO_I2C_10 | 234 | ||
J16 | 9 | GPIO_I2C_3 | 227 | ||
J16 | 10 | GPIO_I2C_11 | 235 | ||
J16 | 11 | GPIO_I2C_4 | 228 | ||
J16 | 12 | GPIO_I2C_12 | 236 | ||
J16 | 13 | GPIO_I2C_5 | 229 | ||
J16 | 14 | GPIO_I2C_13 | 237 | ||
J16 | 15 | GPIO_I2C_6 | 230 | ||
J16 | 17 | GPIO_I2C_7 | 231 |
Lothron 3
The Lothron 3 has 8 accessible GPIO pins on J25.
Connector | Pin | Signal | Signal on MX53 | Bank and pin | GPIO Number |
---|---|---|---|---|---|
J25 | 11 | GPIO_0 | GPIO_A | 2-8 | 40 |
J25 | 12 | GPIO_1 | GPIO_B | 2-9 | 41 |
J25 | 13 | GPIO_2 | GPIO_C | 2-10 | 42 |
J25 | 14 | GPIO_3 | GPIO_D | 2-11 | 43 |
J25 | 15 | GPIO_4 | GPIO_E | 2-12 | 44 |
J25 | 16 | GPIO_5 | GPIO_F | 2-13 | 45 |
J25 | 17 | GPIO_6 | GPIO_G | 2-14 | 46 |
J25 | 18 | GPIO_7 | GPIO_H | 2-15 | 47 |