GPIO number offset calc GPIO header

Which Khadas SBC do you use?

VIM3 / VIM3 Pro

Which system do you use? Android, Ubuntu, OOWOW or others?

Ubuntu 20.04

Which version of system do you use? Khadas official images, self built images, or others?

khadas official fenix server
k4.9 / k5.12

Please describe your issue below:

With the reference to the VIM3 GPIO Header here -
https://docs.khadas.com/products/sbc/vim3/applications/gpio/40pin-header
eg Pin33 : PIN.A4 - GPIO Num : 464
relates to amlogic A311D Ball.G16 //
Khadas sch : GPIOA_4(TDMB_D1//TDMB_DIN1) / I2SB_SDI

What is the correct calculation/formula to arrive at : 464

I require this info in order for me make use / expose GPIO’s for my use-case

With refer to this doc -

the range start adr is diff
0: aobus-banks GPIOS [496 - 511]
Thus PIN.A4 will be 496+4 = 500 NOT 464 as per the gpio header

What is the correct optics here?

Is the khadas doc stale?

Can one log a kadas support ticket

when I do this – the range values are diff as in the gpio link above (VIM3PRO K4.9)

khadas@Khadas:~$ sudo cat /sys/kernel/debug/pinctrl/pinctrl@ff800014/gpio-ranges
GPIO ranges handled:
0: aobus-banks GPIOS [496 - 511] PINS [0 - 15]
khadas@Khadas:~$
khadas@Khadas:~$ sudo cat /sys/kernel/debug/pinctrl/pinctrl@ff634480/gpio-ranges
GPIO ranges handled:
0: periphs-banks GPIOS [410 - 495] PINS [0 - 85]
khadas@Khadas:~$

Post a console log of your issue below:

khadas@Khadas:~$ uname -a
Linux Khadas 4.9.241 #4 SMP PREEMPT Wed Mar 22 22:59:44 PDT 2023 aarch64 aarch64 aarch64 GNU/Linux

Hello @gerhardjl

You can use command gpio readall to get the GPIO numbers.

Hi
Thanks for reply –

I noted that your reply implied that the following c/py utils are installed

I have done so and can access the recommend util.

I still want to understanding how to manually calc the gpio pin num offset,
since the khadas doc which I thus far reviewed on the VIM3,
are in conflict with eachother - As per my previous explanation.

So please respond on this -
How does the khadas teams calc that PIN.A4 = 464 ? VIM3 / k4.9

Thank you.

You can check this doc.