Page 1 of 1

export GPIO

Posted: Tue Mar 06, 2018 3:58 pm
by carlonifabio
VoCore2 has more than 40 GPIO.
I need 3 output pins and 1 input pin.

ls /sys/class/gpio
export gpio0 gpiochip0 gpiochip32 gpiochip64

Where are the GPIO pins? How can I configure the GPIO pins?

Re: export GPIO

Posted: Wed Mar 07, 2018 9:59 am
by Vonger
GPIO0~32 are using one register address, and GPIO 32~64 are using another register.
If you want to understand how it works, please read datasheet mt7628an.pdf GPIO register part and also check openwrt gpio and pinmux source code.

Normally first you must set VOCORE2.dts(device tree setting file in source code of openwrt) to set the pins you are using to GPIO mode(most pins are used to I2C, I2S, UART, SPI etc... so you must set it to GPIO mode to use it as GPIO)

After set pinmux(need to recompile the firmware or you have to use my hack tool "mem" directly modify its register, write a simple client side pinmux driver), you will able to directly use GPIO from /sys/....

If any problem you meet, please keep public under this ticket, I will follow. :)
And any process, please share with us.

Re: export GPIO

Posted: Wed Mar 14, 2018 11:15 am
by kermit
Hi,
You can also give a try using python and library which i posted here:
https://github.com/krzysztofkrzeslak/vocore_gpio
Leave star on git if it do it`s work, or write if something went wrong
Greetings ;)

Re: export GPIO

Posted: Wed Jun 30, 2021 4:46 am
by BryanBarbosa
kermit wrote:Hi,
You can also give a try using python and library which i posted here:
https://github.com/krzysztofkrzeslak/vocore_gpio
Leave star on git if it do it`s work, or write if something went wrong
Greetings ;)


Hi, could you give some instructions of how to install your library in Vocore 2? I've been trying that for one week and I still was not able to use it.

Re: export GPIO

Posted: Tue Aug 17, 2021 3:50 pm
by Vonger
BryanBarbosa wrote:
kermit wrote:Hi,
You can also give a try using python and library which i posted here:
https://github.com/krzysztofkrzeslak/vocore_gpio
Leave star on git if it do it`s work, or write if something went wrong
Greetings ;)


Hi, could you give some instructions of how to install your library in Vocore 2? I've been trying that for one week and I still was not able to use it.


If python can directly operate files, that will be simple, just write gpio number to /sys/bus/gpio/export, then it will map a new gpio folder, you can control it by write to file in that folder. detail you can check linux readme, a lot of tutorial online too.