Page 1 of 1
GPIO configuration
Posted: Sat Jan 10, 2015 11:23 am
by pma61
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-supportHowever I don't understand how to fix this problem!
Re: GPIO configuration
Posted: Sun Jan 11, 2015 2:39 pm
by Greenwire-Elektronik
Did you exported the GPIO?
Re: GPIO configuration
Posted: Mon Jan 12, 2015 10:07 am
by pma61
Greenwire-Elektronik wrote:Did you exported the GPIO?
I have problem exporting GPIO!
Re: GPIO configuration
Posted: Mon Jan 12, 2015 10:23 am
by Greenwire-Elektronik
I think this is reasoned by VoCores DTS file:
https://github.com/openwrt-mirror/openw ... VOCORE.dtsStarting 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.
Re: GPIO configuration
Posted: Tue Jan 13, 2015 8:56 pm
by pma61
Greenwire-Elektronik wrote:I think this is reasoned by VoCores DTS file:
https://github.com/openwrt-mirror/openw ... VOCORE.dtsStarting 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>;
};
Re: GPIO configuration
Posted: Wed Jan 14, 2015 1:02 am
by Greenwire-Elektronik
Same problem with export?
Did you compiled a new image and put it onto your VoCore?
Re: GPIO configuration
Posted: Wed Jan 14, 2015 7:18 am
by Pyrofer
GPIO2 is used by the i2C bus. You have to remove/disable that first.
Re: GPIO configuration
Posted: Wed Jan 14, 2015 4:31 pm
by pma61
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=0EDIT: I know that I've exported only gpio19 in VOCORE.dts, it's just for test