GPIO's are listed under /sys/class/gpio
Linux GPIO Number = <GPIO_bank – 1> × 32 + <GPIO Port number>
Linux GPIO Number = <GPIO_bank x 32> + <GPIO Port number>
root@MBaXXX:~ echo <gpionr> >/sys/class/gpio/export // export GPIO pin root@MBaXXX:~ echo out > /sys/class/gpio/gpio<gpionr>/direction // set GPIO direction root@MBaXXX:~ echo 1 > /sys/class/gpio/gpio<gpionr>/value // toggle GPIO to high root@MBaXXX:~ echo 0 > /sys/class/gpio/gpio<gpionr>/value // toggle GPIO to low
root@MBaXXX:~ echo „<gpionr>" >/sys/class/gpio/export // export GPIO pin root@MBaXXX:~ echo in > /sys/class/gpio/gpio<gpionr>/direction // set GPIO direction root@MBaXXX:~ cat /sys/class/gpio/gpio<gpionr>/value // read GPIO value
Tested with TQMa28
It is possible to toggle the GPIO's in U-Boot with the gpio command. To use gpio command the desired gpio pin number has to be given as parameter to the command. The following bitmask applies to GPIO pin number in U-Boot:
[PPPP P_BBB] P = pin, B = bank
For example we toggle GPIO0_24 on MBa28
GPIO0_24 = GPIO Bank 0, Pin 24, GPIO0_24 = 11000