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.
If the used kernel is compiled with CONFIG_DEBUG_FS you can get a list of the GPIOs with the command:
cat /sys/kernel/debug/gpio
Remark: emtrion compiles the Linux Kernel 4.x for emCON-RZ/G1x boards with CONFIG_DEBUG_FS.
emCON-RZ/G1E on Avari
There are 8 GPIOs on J27 with a signal level of 3.3V.
Connector | Pin | Signal | Signal on RZ/G1E | Bank and pin | GPIO Number |
---|---|---|---|---|---|
J27 | 8 | GPIO_1 | GPIO_1 | 0-1 | 993 |
J27 | 10 | GPIO_2 | GPIO_2 | 0-2 | 994 |
J27 | 12 | GPIO_3 | GPIO_3 | 5-4 | 846 |
J27 | 14 | GPIO_4 | GPIO_4 | 4-31 | 901 |
J27 | 16 | GPIO_5 | GPIO_5 | 4-26 | 896 |
J27 | 18 | GPIO_6 | GPIO_6 | 4-29 | 899 |
J27 | 20 | GPIO_7 | not connected | ||
J27 | 22 | GPIO_8 | not connected |
emCON-RZ/G1M on Avari
There are 8 GPIOs on J27 with a signal level of 3.3V.
Connector | Pin | Signal | Signal on RZ/G1M | Bank and pin | GPIO Number |
---|---|---|---|---|---|
J27 | 8 | GPIO_1 | GP4_13 | 4-13 | 883 |
J27 | 10 | GPIO_2 | GP4_14 | 4-14 | 884 |
J27 | 12 | GPIO_3 | GP4_15 | 4-15 | 885 |
J27 | 14 | GPIO_4 | GP4_16 | 4-16 | 886 |
J27 | 16 | GPIO_5 | GP4_17 | 4-17 | 887 |
J27 | 18 | GPIO_6 | GP4_18 | 4-18 | 888 |
J27 | 20 | GPIO_7 | GP4_19 | 4-19 | 889 |
J27 | 22 | GPIO_8 | GP4_20 | 4-20 | 890 |
emCON-RZ/G1H on Avari
There are 8 GPIOs on J27 with a signal level of 3.3V.
Connector | Pin | Signal | Signal on RZ/G1H | Bank and pin | GPIO Number |
---|---|---|---|---|---|
J27 | 8 | GPIO_1 | GP1_0 | 1-0 | 960 |
J27 | 10 | GPIO_2 | GP1_1 | 1-1 | 961 |
J27 | 12 | GPIO_3 | GP1_2 | 1-2 | 962 |
J27 | 14 | GPIO_4 | GP1_3 | 1-3 | 963 |
J27 | 16 | GPIO_5 | GP1_10 | 1-10 | 970 |
J27 | 18 | GPIO_6 | GP1_11 | 1-11 | 971 |
J27 | 20 | GPIO_7 | GP1_13 | 1-13 | 973 |
J27 | 22 | GPIO_8 | GP1_14 | 1-14 | 974 |