gpio-line-name for gpiochip0 and gpiochip1

Post Reply
ywtom3
Posts: 8
Joined: Mon Nov 25, 2019 7:03 pm
languages_spoken: english
Has thanked: 2 times
Been thanked: 0
Contact:

gpio-line-name for gpiochip0 and gpiochip1

Post by ywtom3 »

I have a question about the gpio line names when using libgpiod.
Since the GPIO access using sysfs has been deprecated since version 4.8 of the Linux kernel (and I am using 4.9), I decided to use the libgpiod method to manipulate the GPIO for my project.
After installing the libgpiod on debian buster, I ran the gpiodetect and gpioinfo to check the gpiochip that were used. When running gpioinfo, the gpio-line-name displayed are all unnamed so I cannot see which gpio line is mapped to which pin on the 40 pin header. Is there any documentation I can refer to so I can distinguish which line is map to pin?
Thanks!

joshua.yang
Posts: 476
Joined: Fri Sep 22, 2017 5:54 pm
languages_spoken: Korean, English
ODROIDs: XU4, XU4Q + Cloudshell2, H2, N2
Has thanked: 32 times
Been thanked: 130 times
Contact:

Re: gpio-line-name for gpiochip0 and gpiochip1

Post by joshua.yang »

Hi.

I'm sorry but we're not providing a table map for gpiochip0/1 pins corresponding to 40 pin header.

All the pins of the header are registered in gpiochip0, and the first pin number of the gpiochip0 is 427.

Code: Select all

root@odroidn2:~# cat /sys/kernel/debug/gpio
gpiochip1: GPIOs 412-426, parent: platform/ff800000.sys-ctrl:pinctrl@14, aobus-banks:
 gpio-420 (                    |regulator-tflash_vdd) out hi
 gpio-421 (                    |TF_IO               ) out lo
 gpio-423 (                    |?                   ) out lo

gpiochip0: GPIOs 427-511, parent: platform/ff634400.bus:pinctrl@40, periphs-banks:
 gpio-442 (                    |PHY reset           ) out hi ACTIVE LOW
 gpio-447 (                    |usb-hub-reset       ) in  hi
 gpio-448 (                    |regulator-hub_5v    ) out hi
 gpio-449 (                    |regulator-usb_pwr_en) out lo
 gpio-464 (                    |reset               ) out hi ACTIVE LOW
 gpio-474 (                    |cd                  ) in  hi ACTIVE LOW
 
So, you can write a code referring to this link: https://wiki.odroid.com/odroid-n2/hardw ... _2x20_pins
These users thanked the author joshua.yang for the post:
ywtom3 (Tue Jan 14, 2020 9:43 am)

User avatar
Faradn
Posts: 51
Joined: Sun Feb 10, 2019 2:19 am
languages_spoken: english
ODROIDs: XU4 N2 C4
Has thanked: 0
Been thanked: 3 times
Contact:

Re: gpio-line-name for gpiochip0 and gpiochip1

Post by Faradn »

See the attachment.
Upper right top side.
All (19) GPIOX_0 ... GPIOX_19 to libgpiod
gpiochip1 virtual pins.

/Faradn
Attachments
odroid_n2_gpio_01_082719.jpeg
odroid_n2_gpio_01_082719.jpeg (275.46 KiB) Viewed 1952 times
These users thanked the author Faradn for the post (total 2):
odroid (Wed Feb 26, 2020 10:59 am) • joshua.yang (Wed Feb 26, 2020 1:37 pm)

joshua.yang
Posts: 476
Joined: Fri Sep 22, 2017 5:54 pm
languages_spoken: Korean, English
ODROIDs: XU4, XU4Q + Cloudshell2, H2, N2
Has thanked: 32 times
Been thanked: 130 times
Contact:

Re: gpio-line-name for gpiochip0 and gpiochip1

Post by joshua.yang »

Faradn wrote:
Wed Feb 26, 2020 6:50 am
See the attachment.
Upper right top side.
All (19) GPIOX_0 ... GPIOX_19 to libgpiod
gpiochip1 virtual pins.

/Faradn
Great. Thanks for this useful information. :)

User avatar
Faradn
Posts: 51
Joined: Sun Feb 10, 2019 2:19 am
languages_spoken: english
ODROIDs: XU4 N2 C4
Has thanked: 0
Been thanked: 3 times
Contact:

Re: gpio-line-name for gpiochip0 and gpiochip1

Post by Faradn »

You are quite welcome Joshua.

Hope all is well with you and yours.
And also with the HardKernel families and friends.

The one issue i have with the libgpiod library is a method in the high level API.
gpiod_ctxless_event_monitor_multiple().

I cannot ad more than (4) virtual GPIO pins to an array for monitoring rising/falling
edge detects. (5) or more virtual GPIO pins and the program does not execute.
I was in contact with the author/maintainer bu he states that since no one else has
reported this issue, it is not considered to be a problem.

Attached is a copy of the program i am using.

/Faradn
Attachments
main.c
(7.31 KiB) Downloaded 76 times
main.h
(3.69 KiB) Downloaded 46 times

Post Reply

Return to “Hardware and peripherals”

Who is online

Users browsing this forum: No registered users and 3 guests