GPIO access in GPIOD

Post Reply
User avatar
maddog2201
Posts: 50
Joined: Tue Jan 21, 2014 9:44 pm
languages_spoken: english
ODROIDs: U3
Has thanked: 0
Been thanked: 1 time
Contact:

GPIO access in GPIOD

Post by maddog2201 »

I'm wanting to use my U3 to learn GPIO access from C code using gpiod library and libgpiod-dev. I've installed gpiod and when I run the gpiodetect command it lists 41 different gpiochips, with between 2-8 lines each, none of which are labeled, aside from the ones that are used for hardware it seems (Blue LED heartbeat, power button, etc).

Does anyone know how I can relate the 3 available GPIO exposed on the plug with a gpiochip and line number? I'm tempted to just probe them and see, but I feel like I could possibly break something doing that, and there's a lot of pins to probe like that, it would take a long time.

Here I found some pin descriptors but I'm not sure how to relate this to the output of gpiodetect and gpioinfo.
https://wiki.odroid.com/old_product/odr ... 3_hardware


Output from gpiodetect commands and one gpioinfo command, I went through all of them and nothing that I think is available is listed.

Code: Select all

root@changeme:/# gpiodetect
gpiochip0 [gpa0] (8 lines)
gpiochip1 [gpa1] (6 lines)
gpiochip10 [gpf3] (6 lines)
gpiochip11 [gpj0] (8 lines)
gpiochip12 [gpj1] (5 lines)
gpiochip13 [gpk0] (7 lines)
gpiochip14 [gpk1] (7 lines)
gpiochip15 [gpk2] (7 lines)
gpiochip16 [gpk3] (7 lines)
gpiochip17 [gpl0] (7 lines)
gpiochip18 [gpl1] (2 lines)
gpiochip19 [gpl2] (8 lines)
gpiochip2 [gpb] (8 lines)
gpiochip20 [gpm0] (8 lines)
gpiochip21 [gpm1] (7 lines)
gpiochip22 [gpm2] (5 lines)
gpiochip23 [gpm3] (8 lines)
gpiochip24 [gpm4] (8 lines)
gpiochip25 [gpy0] (6 lines)
gpiochip26 [gpy1] (4 lines)
gpiochip27 [gpy2] (6 lines)
gpiochip28 [gpy3] (8 lines)
gpiochip29 [gpy4] (8 lines)
gpiochip3 [gpc0] (5 lines)
gpiochip30 [gpy5] (8 lines)
gpiochip31 [gpy6] (8 lines)
gpiochip32 [gpx0] (8 lines)
gpiochip33 [gpx1] (8 lines)
gpiochip34 [gpx2] (8 lines)
gpiochip35 [gpx3] (8 lines)
gpiochip36 [gpz] (7 lines)
gpiochip37 [gpv0] (8 lines)
gpiochip38 [gpv1] (8 lines)
gpiochip39 [gpv2] (8 lines)
gpiochip4 [gpc1] (5 lines)
gpiochip40 [gpv3] (8 lines)
gpiochip41 [gpv4] (2 lines)
gpiochip5 [gpd0] (4 lines)
gpiochip6 [gpd1] (4 lines)
gpiochip7 [gpf0] (8 lines)
gpiochip8 [gpf1] (8 lines)
gpiochip9 [gpf2] (8 lines)
root@changeme:/# gpioinfo gpiochip0
gpiochip0 - 8 lines:
        line   0:      unnamed       unused   input  active-high
        line   1:      unnamed       unused   input  active-high
        line   2:      unnamed       unused   input  active-high
        line   3:      unnamed       unused   input  active-high
        line   4:      unnamed       unused   input  active-high
        line   5:      unnamed       unused   input  active-high
        line   6:      unnamed       unused   input  active-high
        line   7:      unnamed       unused   input  active-high
Hopefully someone can help me here. Cheers.
"Some days it don't pay to get out of bed"
~Floghorn Leghorn.

User avatar
maddog2201
Posts: 50
Joined: Tue Jan 21, 2014 9:44 pm
languages_spoken: english
ODROIDs: U3
Has thanked: 0
Been thanked: 1 time
Contact:

Re: GPIO access in GPIOD

Post by maddog2201 »

Ok, well, as soon as I posted this I figured it out. So here's the info for others that I've worked out so far.

gpiochip33 is the device.

As can be seen in that weblink, the GPX number is the important part.

gpiochip33 has [gpx1] next to it, so our pins are as follows.

(GPX1.0)GPIO #199 = gpiochip 33, line 0
(GPX1.1)GPIO #200 = gpiochip 33, line 1
(GPX1.5)GPIO #204 = gpiochip 33, line 5

Sorry if I wasted anyones time with this, but here it is so others can figure it out if they need to.
These users thanked the author maddog2201 for the post:
odroid (Tue Feb 13, 2024 11:25 am)
"Some days it don't pay to get out of bed"
~Floghorn Leghorn.

Post Reply

Return to “Ubuntu”

Who is online

Users browsing this forum: No registered users and 2 guests