GPIO missing in VIM1_Ubuntu-xfce-bionic_Linux-4.9_arm64_EMMC_V20190830

Hi,
I’m afraid that GPIO channels are lost in the latest builds for VIM1.
At least with VIM1_Ubuntu-xfce-bionic_Linux-4.9_arm64_EMMC_V20190830 I could not see any of the formerly working GPIO channels. Tried channels numbers 3, 6, 32, 147 and some others.

root@Khadas:/sys/class/gpio# echo 6 > export
bash: echo: write error: Invalid argument

Pls advise - GPIO is needed for many folks, I believe…

Hello @ufneeme

I’ll check this issue…

hi, any luck with this?

Hello @ufneeme,

Sorry for the late reply.

I don’t know why Amlogic change the GPIO number again…

But you can figure out the GPIO nomber by yourself.

You can check this:

  • GPIOAO_6 - 507
  • GPIOH_5 - 422

For example GPIOAO_6:

Banks:

root@Khadas:~# cat /sys/kernel/debug/pinctrl/pinctrl@14/gpio-ranges    
GPIO ranges handled:
0: aobus-banks GPIOS [501 - 511] PINS [0 - 10]

PINs:

root@Khadas:~# cat /sys/kernel/debug/pinctrl/pinctrl@14/pins 
registered pins: 11
pin 0 (GPIOAO_0)  pinctrl@14
pin 1 (GPIOAO_1)  pinctrl@14
pin 2 (GPIOAO_2)  pinctrl@14
pin 3 (GPIOAO_3)  pinctrl@14
pin 4 (GPIOAO_4)  pinctrl@14
pin 5 (GPIOAO_5)  pinctrl@14
pin 6 (GPIOAO_6)  pinctrl@14
pin 7 (GPIOAO_7)  pinctrl@14
pin 8 (GPIOAO_8)  pinctrl@14
pin 9 (GPIOAO_9)  pinctrl@14
pin 10 (GPIO_TEST_N)  pinctrl@14

For example, get the number of GPIOAO_6 :
Number(GPIOAO_6) = bank + pin = 501 - 0 + 6 = 507

So the GPIO number of GPIOAO_6 is 507.

periphs-banks :
Banks:

root@Khadas:~# cat /sys/kernel/debug/pinctrl/pinctrl@4b0/gpio-ranges 
GPIO ranges handled:
0: periphs-banks GPIOS [401 - 500] PINS [0 - 99]

PINs:

root@Khadas:~# cat /sys/kernel/debug/pinctrl/pinctrl@4b0/pins
registered pins: 100
pin 0 (GPIOZ_0)  pinctrl@4b0
pin 1 (GPIOZ_1)  pinctrl@4b0
...
pin 96 (GPIOX_17)  pinctrl@4b0
pin 97 (GPIOX_18)  pinctrl@4b0
pin 98 (GPIOCLK_0)  pinctrl@4b0
pin 99 (GPIOCLK_1)  pinctrl@4b0

For example, get the number of GPIOH_5 :
Number(GPIOH_5) = bank + pin = 401 - 0 + 21 = 422

So the GPIO number of GPIOH_5 is 422.

1 Like

thanks. so cat /sys/kernel/debug/pinctrl/pinctrl@*/gpio-ranges must list the banks in use and cat /sys/kernel/debug/pinctrl/pinctrl@*/pins should list use all usable channels.

but I do not see all channels mentioned for 40 pin header in Khadas documentation if I do that. For example, I cannot see any channels starting with PWM or ADC. are there some aliases for those names?

have figured out that PWM_AO_A must be called GPIOAO_3 to be found.

problem resolved, thanks.

1 Like