How to know gpio pin number

Hello,

How can I know the PL8 gpio number to do an export? Where can I find this info?

For example, to export PL8, what gpio_number may I use?

cabezpl8

I have read that this formula can be used:

[pL8]

L is the letter number 12 in alphabet, so ((12-1)*32)+8= 360

I tried in the Shell and look that exporting this gpio_number doen’t working: Captura

I tryed with different values to try switching on/off a led connected to PL8 : (I tested with echo 1 >… gpio_sw…/data and led is switching on/off ok, but i need to set the gpio as an input).

I saw that PL8 is B21 of U1H: Captura2

I tryed the same with gpio53 [B21= ((1*32)+21)], also tried without the formula with 40, 21 and so on, but I can’t find how get the correct value. Captura1

Gpio40 doesn’t mach with PL8, the led is not ON.

What is the right way to know the gpio numbers?

Thanks

edit: Still can’t export and I’M SURE that the gpio pin number is calculated by: (Bank - 1) * 32 + pin_number

For example, to export PL8 you should type: echo 360 > /sys/class/gpio/export … BUT doesn’t appear the …/gpio/gpio360 folder :roll_eyes: :sweat:

Captura

If I type cat /sys/kernel/debug/gpio , I can see the GPIO360 as output and with low state

To be sure that PL8 = gpio360, I put in the shell:

echo 1 > sys/class/gpio_sw/PL8/data

cat /sys/kernel/debug/gpio

and tachan!!, I can see the gpio360 with output=1

I have read that gpio folder is controlled directly by kernel and gpio_sw folder is controlled by sys_class.fex file, I am right? :thinking:

Why I can’t export PL8 (gpio360) from sys/class/gpio folder but I can control it from sys/class/gpio_sw/PL8/data???
I should change something from the Kernel configuration? Or I should disable the gpio_sw folder? How to???
I think that because PL8 exits in gpio_sw can’t be do the export in gpio folder. Could be?

Thanks

Please check the attachment for all m64 gpio numberm64_gpio_number (19.4 KB)

gpio_sw is created by gpio-sunxi module, 40pin gpios are requested if this driver loaded, and you can’t request them again by gpio export way. So rmmod gpio-sunxi module before using gpio sysfs control.

1 Like

i can help you send your mail id