GPIO configuration

pma61
 
Posts: 12
Joined: Fri Nov 21, 2014 6:19 pm

GPIO configuration

Sat Jan 10, 2015 11:23 am

Hi!
I've just compiled openwrt from git (latest trunk), but gpio environment is broken:
After boot, I have this in /sys/class/gpio/ :
Code: Select all
root@OpenWrt:/sys/class/gpio# ls
export      gpio13      gpio18      gpio21      gpio24      gpio7       gpiochip0
gpio0       gpio14      gpio19      gpio22      gpio25      gpio8       gpiochip22
gpio12      gpio17      gpio20      gpio23      gpio26      gpio9       unexport


When I try to use gpio pin #2, I have this:
Code: Select all
root@OpenWrt:/sys/class/gpio# echo 2 > /sys/class/gpio/export
[ 1294.500000] rt2880-pinmux pinctrl.1: pin 2 is not set to gpio mux
[ 1294.500000] rt2880-pinmux pinctrl.1: request() failed for pin 2
[ 1294.500000] rt2880-pinmux pinctrl.1: pin-2 (pio:2) status -22
ash: write error: Invalid argument


I found this topic -> http://vonger.cn/?topic=rfc-openwrt-support
However I don't understand how to fix this problem!

Greenwire-Elektronik
 
Posts: 101
Joined: Thu Dec 04, 2014 6:31 am

Re: GPIO configuration

Sun Jan 11, 2015 2:39 pm

Did you exported the GPIO?
Buy now - breakout board for VoCore to easy adapting your idea!

Follow us on Twitter or facebook!

pma61
 
Posts: 12
Joined: Fri Nov 21, 2014 6:19 pm

Re: GPIO configuration

Mon Jan 12, 2015 10:07 am

Greenwire-Elektronik wrote:Did you exported the GPIO?
I have problem exporting GPIO!

Greenwire-Elektronik
 
Posts: 101
Joined: Thu Dec 04, 2014 6:31 am

Re: GPIO configuration

Mon Jan 12, 2015 10:23 am

I think this is reasoned by VoCores DTS file:

https://github.com/openwrt-mirror/openw ... VOCORE.dts

Starting with row 90 you see all GPIOs which can be exported - GPIO2 is not in this list. I think you can consider changing the dts file and generate a new image - the pin is not used for any onboard devices as far as i have seen.
Buy now - breakout board for VoCore to easy adapting your idea!

Follow us on Twitter or facebook!

pma61
 
Posts: 12
Joined: Fri Nov 21, 2014 6:19 pm

Re: GPIO configuration

Tue Jan 13, 2015 8:56 pm

Greenwire-Elektronik wrote:I think this is reasoned by VoCores DTS file:

https://github.com/openwrt-mirror/openw ... VOCORE.dts

Starting with row 90 you see all GPIOs which can be exported - GPIO2 is not in this list. I think you can consider changing the dts file and generate a new image - the pin is not used for any onboard devices as far as i have seen.

Not working again if I put this in target/linux/ramips/dts/VOCORE.dts:
Code: Select all
          gpio2 {
                        gpio-export,name = "gpio2";
                        gpio-export,direction_may_change = <1>;
                        gpios = <&gpio0 2 0>;
                };

Greenwire-Elektronik
 
Posts: 101
Joined: Thu Dec 04, 2014 6:31 am

Re: GPIO configuration

Wed Jan 14, 2015 1:02 am

Same problem with export?

Did you compiled a new image and put it onto your VoCore?
Buy now - breakout board for VoCore to easy adapting your idea!

Follow us on Twitter or facebook!

Pyrofer
 
Posts: 61
Joined: Tue Oct 21, 2014 11:35 am

Re: GPIO configuration

Wed Jan 14, 2015 7:18 am

GPIO2 is used by the i2C bus. You have to remove/disable that first.

pma61
 
Posts: 12
Joined: Fri Nov 21, 2014 6:19 pm

Re: GPIO configuration

Wed Jan 14, 2015 4:31 pm

Pyrofer wrote:GPIO2 is used by the i2C bus. You have to remove/disable that first.

I tried disabling jtag pins editing this in VOCORE.dts:
Code: Select all
pinctrl {
      state_default: pinctrl0 {
         gpio {
            #ralink,group = "jtag", "uartf", "led";
            ralink,group = "uartf", "led";
            ralink,function = "gpio";
         };
      };
   };

Now in /sys/class/gpio there aren't anymore gpio17-gpio21, they are anyway exported in VOCORE.dts (by default), but when I do
Code: Select all
root@OpenWrt:/sys/class/gpio# ls
export      gpio13      gpio23      gpio26      gpio9       unexport
gpio0       gpio14      gpio24      gpio7       gpiochip0
gpio12      gpio22      gpio25      gpio8       gpiochip22

root@OpenWrt:/sys/class/gpio# echo 19 > export
[  596.920000] rt2880-pinmux pinctrl.1: pin 19 is not set to gpio mux
[  596.940000] rt2880-pinmux pinctrl.1: request() failed for pin 19
[  596.940000] rt2880-pinmux pinctrl.1: pin-19 (pio:19) status -22
ash: write error: Invalid argument


My VOCORE.dts file:
https://drive.google.com/open?id=0B2OueCnLCdbxbUtsTUxzUl9HLTQ&authuser=0

EDIT: I know that I've exported only gpio19 in VOCORE.dts, it's just for test

Return to VoCore & VoCore+Dock

Who is online

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