Olimex Support Forum

OLinuXino Android / Linux boards and System On Modules => A20 => Topic started by: george on February 27, 2025, 09:02:04 PM

Title: B14 usage
Post by: george on February 27, 2025, 09:02:04 PM
Здравейте,
Искам да използувам GPIO-3 порт сигнал B14 ( PB3 ) .
Моля дайте му съответствето към софтуерното използуване на GPIO-3 B14 ( PB3 ).

Translate:

Hello,

I'd like to use GPIO-3 port signal B14 ( PB3 ).

Please provide software example for the usage of GPIO3 B14 ( PB3 ).
Title: Re: B14 usage
Post by: LubOlimex on February 28, 2025, 08:42:07 AM
Обяснили как се ползват GPIO пиновете в този документ в глава "8.6. How to toggle a GPIO pin via sysfs":

https://github.com/OLIMEX/OLINUXINO/blob/master/DOCUMENTS/OLIMAGE/Olimage-guide.pdf

За PB3 от A20 платките сметката кой пин на кое GPIO съотвества в Линукса е:

(2-1)x32 + 3 = 35

През sysfs ей така се прави на изход и се включва и изключва:

# sudo su
# echo 35 > /sys/class/gpio/export
# ls /sys/class/gpio
# echo out > /sys/class/gpio/gpio271/direction
# echo 1 > /sys/class/gpio/gpio271/value
# echo 0 > /sys/class/gpio/gpio271/value

Translate:

We've explained how to work with the GPIO pins in this document in chapter "8.6. How to toggle a GPIO pin via sysfs":

https://github.com/OLIMEX/OLINUXINO/blob/master/DOCUMENTS/OLIMAGE/Olimage-guide.pdf

For PB3 of A20 boards this is how you calculate which Linux GPIO corresponds to PB3:

(2-1)x32 + 3 = 35

Through the sysfs this is how you then make the exported pin as output and then set it high and set it low:

# sudo su
# echo 35 > /sys/class/gpio/export
# ls /sys/class/gpio
# echo out > /sys/class/gpio/gpio271/direction
# echo 1 > /sys/class/gpio/gpio271/value
# echo 0 > /sys/class/gpio/gpio271/value