Usage of GPIO pins in openwrt22.03

mernst
 
Posts: 2
Joined: Wed Dec 23, 2020 8:38 pm

Usage of GPIO pins in openwrt22.03

Thu Feb 23, 2023 9:27 am

In openwrt19.07 it worked to go into /sys/class/gpio and say 'echo “42” >export' to make the respective I/O pin available as a new directory gpio42.
Upgraded now to openwrt22.03. The above does not work anymore.
Still there is export and unexport file handles available, and three directories gpiochip416, 448 and 480.
I added the lines for pinctrl into the vocore2.dts file, no improvement.
I applied the old 0882-pinctrl-fix-gpio-name.patch, no improvement.
I selected in kernel_menuconfig the respective GPIO Support section and there the /sys/class/gpio interface as well as the MT7621 GPIO support in the memory mapped driver area. Still not working.

Any idea what to do?
thank you

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

Re: Usage of GPIO pins in openwrt22.03

Wed Mar 08, 2023 12:23 pm

I guess somebody modified the gpio driver source code.
So the problem must be in linux kernel(maybe has a reason)

Toy.Box
 
Posts: 1
Joined: Sun Apr 14, 2024 11:54 pm

Re: Usage of GPIO pins in openwrt22.03

Mon Apr 15, 2024 11:24 pm

Hi, I'm using the version of OpenWRT that my unit came with out of the box (23.05.2) and GPIO still doesn't seem to be working the way it's described in other posts and on your blog. Do I just have to downgrade to an older version to get GPIO functioning again or is there a new process that I'm missing? I've searched through the forum and the blog but I couldn't find anything.

If I do have to downgrade, which version should I downgrade to if I want the SD slot, audio, GPIO to function? Those are the main things I need right now.

Thanks!

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

Re: Usage of GPIO pins in openwrt22.03

Sat May 11, 2024 5:34 am

Toy.Box wrote:Hi, I'm using the version of OpenWRT that my unit came with out of the box (23.05.2) and GPIO still doesn't seem to be working the way it's described in other posts and on your blog. Do I just have to downgrade to an older version to get GPIO functioning again or is there a new process that I'm missing? I've searched through the forum and the blog but I couldn't find anything.

If I do have to downgrade, which version should I downgrade to if I want the SD slot, audio, GPIO to function? Those are the main things I need right now.

Thanks!

For 23.05.02 it should be directly work, but because OpenWrt upgrade its dts, the GPIO number is not same, like GPIO0 now it another number, GPIO416, and GPIO32 it is GPIO448 and GPIO64 it is 480. No idea why the number changed, but you just export gpio0 to export gpio416 it works.

Code: Select all
root@OpenWrt:/sys/class/gpio# ls                                               
export       gpiochip416  gpiochip448  gpiochip480  unexport 
root@OpenWrt:/sys/class/gpio# echo 416 > export                                 
root@OpenWrt:/sys/class/gpio# ls -lt                                           
lrwxrwxrwx    1 root     root             0 Mar 22 22:15 gpio416 -> ../../devic6
--w-------    1 root     root          4096 Mar 22 22:15 export                 
lrwxrwxrwx    1 root     root             0 Jan  1  1970 gpiochip416 -> ../../d6
lrwxrwxrwx    1 root     root             0 Jan  1  1970 gpiochip448 -> ../../d8
lrwxrwxrwx    1 root     root             0 Jan  1  1970 gpiochip480 -> ../../d0
--w-------    1 root     root          4096 Jan  1  1970 unexport               
root@OpenWrt:/sys/class/gpio# cd gpio416/                                       
root@OpenWrt:/sys/class/gpio/gpio416# ls                                       
active_low  direction   subsystem   value                                       
device      edge        uevent

Return to VoCore2/Lite/Ultimate

Who is online

Users browsing this forum: No registered users and 3 guests