HummingBoard Edge/Gate/CBi GPIO Pins Control
To control on the GPIO pins:
The external GPIOs are available under the /sys/class/gpio folder in Linux.
To control on the GPIO pins you need to calculate the GPIO number XX (*) and run the commands below:
# Export GPIO XX
echo XX > /sys/class/gpio/export
# Set GPIO pin Direction
echo "out" > /sys/class/gpio/gpioXX/direction
or
echo "in" > /sys/class/gpio/gpioXX/direction
# Set the value of an output pin
echo 1 > /sys/class/gpio/gpioXX/value
or
echo 0 > /sys/class/gpio/gpioXX/value
# Get the value of an input pin
cat /sys/class/gpio/gpioXX/value
# Unexport GPIO XX
echo XX > /sys/class/gpio/unexport
You can calculate the GPIO number XX:
XX = linux gpio number = (gpio_bank - 1) * 32 + gpio_bit
Example: to calculate the GPIO number of pin header J1 [pin 3]
Pad Name : DISP1_DATA0
GPIO Bank = 3
GPIO bit = 9
XX = linux gpio number = (3 - 1)*32 + 9 = 73
Attached here the headers schematics
36 pin header implemented using 4 headers
Header Pin | Pad Name | GPIO name | Linux GPIO number |
---|---|---|---|
J21 [pin 1] | 3.2V |
|
|
J21 [pin 2] | 5V |
|
|
J21 [pin 3] | DISP1_DATA00 | GPIO3_IO09 | 73 |
J21 [pin 4] | DISP1_DATA01 | GPIO3_IO08 | 72 |
J21 [pin 5] | DISP1_DATA04 | GPIO3_IO05 | 69 |
J21 [pin 6] | DISP1_DATA05 | GPIO3_IO04 | 68 |
J23 [pin 1] | DI1_D0_CS | GPIO3_IO13 | 77 |
J23 [pin 2] | DI1_D1_CS | GPIO3_IO14 | 78 |
J23 [pin 3] | DISP1_DAT08 | GPIO3_IO01 | 65 |
J23 [pin 4] | DISP1_DAT09 | GPIO3_IO00 | 64 |
J23 [pin 5] | DISP1_DAT12 | GPIO2_IO21 | 53 |
J23 [pin 6] | DISP1_DAT13 | GPIO2_IO20 | 52 |
J23 [pin 7] | DISP1_DAT16 | GPIO2_IO17 | 49 |
J23 [pin 8] | DISP1_DAT17 | GPIO2_IO16 | 48 |
J23 [pin 9] | DISP1_DAT20 | GPIO3_IO31 | 95 |
J23 [pin 10] | DISP1_DAT21 | GPIO3_IO30 | 94 |
J23 [pin 11] | GND |
|
|
J23 [pin 12] | DI1_DISP_CLK | GPIO2_IO22 | 54 |
J22 [pin 1] | DI1_PIN15 | GPIO3_IO10 | 74 |
J22 [pin 2] | DISP1_DATA03 | GPIO3_IO11 | 75 |
J22 [pin 3] | DISP1_DATA02 | GPIO3_IO07 | 71 |
J22 [pin 4] | DISP1_DATA03 | GPIO3_IO06 | 70 |
J22 [pin 5] | DISP1_DATA06 | GPIO3_IO03 | 67 |
J22 [pin 6] | DISP1_DATA07 | GPIO3_IO02 | 66 |
J24 [pin 1] | DI1_PIN01 | GPIO3_IO15 | 79 |
J24 [pin 2] | DI1_PIN03 | GPIO3_IO12 | 76 |
J24 [pin 3] | DISP1_DATA10 | GPIO2_IO29 | 61 |
J24 [pin 4] | DISP1_DATA11 | GPIO2_IO28 | 60 |
J24 [pin 5] | DISP1_DATA14 | GPIO2_IO19 | 51 |
J24 [pin 6] | DISP1_DATA15 | GPIO2_IO18 | 50 |
J24 [pin 7] | DISP1_DATA18 | GPIO6_IO06 | 166 |
J24 [pin 8] | DISP1_DATA19 | GPIO5_IO04 | 132 |
J24 [pin 9] | DISP1_DATA22 | GPIO3_IO26 | 90 |
J24 [pin 10] | DISP1_DATA23 | GPIO3_IO27 | 91 |
J24 [pin 11] | SPDIF_IN | GPIO1_IO24 | 24 |
J24 [pin 12] | SPDIF_OUT | GPIO7_IO12 | 204 |
Related pages
SolidRun Ltd.