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

Return to VoCore2

Who is online

Users browsing this forum: Bing [Bot] and 3 guests