export GPIO

carlonifabio
 
Posts: 1
Joined: Tue Mar 06, 2018 3:43 pm

export GPIO

Tue Mar 06, 2018 3:58 pm

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?

Vonger
 
Posts: 896
Joined: Sun Oct 19, 2014 6:00 am

Re: export GPIO

Wed Mar 07, 2018 9:59 am

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.

kermit
 
Posts: 6
Joined: Sat Sep 23, 2017 10:54 pm

Re: export GPIO

Wed Mar 14, 2018 11:15 am

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 ;)

BryanBarbosa
 
Posts: 12
Joined: Fri May 14, 2021 2:40 am

Re: export GPIO

Wed Jun 30, 2021 4:46 am

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.

Vonger
 
Posts: 896
Joined: Sun Oct 19, 2014 6:00 am

Re: export GPIO

Tue Aug 17, 2021 3:50 pm

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.

Return to VoCore2/Lite/Ultimate

Who is online

Users browsing this forum: No registered users and 49 guests