cancel
Showing results for 
Search instead for 
Did you mean: 

LibGPIO Chip/Line mapping to physical CN8 pins

pittengermdp
Associate

I have a stm32mp135F-DK and I am attempting to do some GPIO control.  My question is where can I find the mapping of libgpiod chip/line mapping to physical pin.  I am particularly interested in the mapping to the CN8 pins as I will be wanting to read/write signals coming from external sources. I have looked at the toggle_led.sh script and see that LD7 (green LED, PA14) is mapped to gpiochip0 line 14.  One note is when I attempt to run this I get a Device/Resource is busy and when I run gpioinfo

gpiochip0 - 16 lines:
line   0:      unnamed       unused   input  active-high
line   1:      unnamed       kernel   input  active-high [used]
line   2:      unnamed       kernel   input  active-high [used]
line   3:      unnamed       kernel   input  active-high [used]
line   4:      unnamed       unused   input  active-high
line   5:      unnamed       unused   input  active-high
line   6:      unnamed       kernel   input  active-high [used]
line   7:      unnamed       unused   input  active-high
line   8:      unnamed       unused   input  active-high
line   9:      unnamed       kernel   input  active-high [used]
line  10:      unnamed       unused   input  active-high
line  11:      unnamed       unused   input  active-high
line  12:      unnamed       kernel   input  active-high [used]
line  13:      unnamed  "User-PA13"   input   active-low [used pull-up]
line  14:      unnamed "blue:heartbeat" output active-low [used]
line  15:      unnamed       kernel   input  active-high [used]
gpiochip1 - 16 lines:
line   0:      unnamed       unused   input  active-high
line   1:      unnamed       unused   input  active-high
line   2:      unnamed       kernel   input  active-high [used]
line   3:      unnamed       kernel   input  active-high [used]
line   4:      unnamed       kernel   input  active-high [used]
line   5:      unnamed       unused   input  active-high
line   6:      unnamed       kernel   input  active-high [used]
line   7:      unnamed       kernel   input  active-high [used]
line   8:      unnamed       kernel   input  active-high [used]
line   9:      unnamed       kernel   input  active-high [used]
line  10:      unnamed       unused   input  active-high
line  11:      unnamed       kernel   input  active-high [used]
line  12:      unnamed       kernel   input  active-high [used]
line  13:      unnamed       unused   input  active-high
line  14:      unnamed       kernel   input  active-high [used]
line  15:      unnamed       kernel   input  active-high [used]
gpiochip2 - 16 lines:
line   0:      unnamed       unused   input  active-high
line   1:      unnamed       kernel   input  active-high [used]
line   2:      unnamed       unused   input  active-high
line   3:      unnamed       unused   input  active-high
line   4:      unnamed       kernel   input  active-high [used]
line   5:      unnamed       kernel   input  active-high [used]
line   6:      unnamed       kernel   input  active-high [used]
line   7:      unnamed       kernel   input  active-high [used]
line   8:      unnamed       kernel   input  active-high [used]
line   9:      unnamed       kernel   input  active-high [used]
line  10:      unnamed       kernel   input  active-high [used]
line  11:      unnamed       kernel   input  active-high [used]
line  12:      unnamed       kernel   input  active-high [used]
line  13:      unnamed       unused   input  active-high
line  14:      unnamed       unused   input  active-high
line  15:      unnamed       unused   input  active-high
gpiochip3 - 16 lines:
line   0:      unnamed       kernel   input  active-high [used]
line   1:      unnamed       kernel   input  active-high [used]
line   2:      unnamed       kernel   input  active-high [used]
line   3:      unnamed       kernel   input  active-high [used]
line   4:      unnamed       kernel   input  active-high [used]
line   5:      unnamed       kernel   input  active-high [used]
line   6:      unnamed       kernel   input  active-high [used]
line   7:      unnamed       kernel   input  active-high [used]
line   8:      unnamed       kernel   input  active-high [used]
line   9:      unnamed       kernel   input  active-high [used]
line  10:      unnamed       kernel   input  active-high [used]
line  11:      unnamed       kernel   input  active-high [used]
line  12:      unnamed       kernel   input  active-high [used]
line  13:      unnamed       unused   input  active-high
line  14:      unnamed       kernel   input  active-high [used]
line  15:      unnamed       kernel   input  active-high [used]
gpiochip4 - 16 lines:
line   0:      unnamed       kernel   input  active-high [used]
line   1:      unnamed       unused   input  active-high
line   2:      unnamed       kernel   input  active-high [used]
line   3:      unnamed       kernel   input  active-high [used]
line   4:      unnamed       kernel   input  active-high [used]
line   5:      unnamed       unused   input  active-high
line   6:      unnamed       unused   input  active-high
line   7:      unnamed       kernel   input  active-high [used]
line   8:      unnamed       kernel   input  active-high [used]
line   9:      unnamed       kernel   input  active-high [used]
line  10:      unnamed       unused   input  active-high
line  11:      unnamed       kernel   input  active-high [used]
line  12:      unnamed "panel-backlight" output active-high [used]
line  13:      unnamed       kernel   input  active-high [used]
line  14:      unnamed       kernel   input  active-high [used]
line  15:      unnamed       kernel   input  active-high [used]
gpiochip5 - 16 lines:
line   0:      unnamed       unused   input  active-high
line   1:      unnamed       kernel   input  active-high [used]
line   2:      unnamed       kernel   input  active-high [used]
line   3:      unnamed       kernel   input  active-high [used]
line   4:      unnamed       kernel   input  active-high [used]
line   5:      unnamed  "interrupt"   input  active-high [used]
line   6:      unnamed       kernel   input  active-high [used]
line   7:      unnamed       kernel   input  active-high [used]
line   8:      unnamed       kernel   input  active-high [used]
line   9:      unnamed       unused   input  active-high
line  10:      unnamed       unused   input  active-high
line  11:      unnamed       unused   input  active-high
line  12:      unnamed       kernel   input  active-high [used]
line  13:      unnamed       unused   input  active-high
line  14:      unnamed       unused   input  active-high
line  15:      unnamed       unused   input  active-high
gpiochip6 - 16 lines:
line   0:      unnamed       kernel   input  active-high [used]
line   1:      unnamed       unused   input  active-high
line   2:      unnamed       kernel   input  active-high [used]
line   3:      unnamed       unused   input  active-high
line   4:      unnamed       kernel   input  active-high [used]
line   5:      unnamed       kernel   input  active-high [used]
line   6:      unnamed       kernel   input  active-high [used]
line   7:      unnamed       kernel   input  active-high [used]
line   8:      unnamed       kernel   input  active-high [used]
line   9:      unnamed       kernel   input  active-high [used]
line  10:      unnamed       kernel   input  active-high [used]
line  11:      unnamed       kernel   input  active-high [used]
line  12:      unnamed  "interrupt"   input  active-high [used]
line  13:      unnamed       kernel   input  active-high [used]
line  14:      unnamed       kernel   input  active-high [used]
line  15:      unnamed       unused   input  active-high
gpiochip7 - 15 lines:
line   0:      unnamed       unused   input  active-high
line   1:      unnamed       unused   input  active-high
line   2:      unnamed      "reset"  output   active-low [used]
line   3:      unnamed       unused   input  active-high
line   4:      unnamed         "cd"   input   active-low [used pull-up]
line   5:      unnamed       unused   input  active-high
line   6:      unnamed       kernel   input  active-high [used]
line   7:      unnamed       unused   input  active-high
line   8:      unnamed       kernel   input  active-high [used]
line   9:      unnamed       kernel   input  active-high [used]
line  10:      unnamed       unused   input  active-high
line  11:      unnamed       unused   input  active-high
line  12:      unnamed       kernel   input  active-high [used]
line  13:      unnamed       kernel   input  active-high [used]
line  14:      unnamed       kernel   input  active-high [used]
gpiochip8 - 8 lines:
line   0:      unnamed       unused   input  active-high
line   1:      unnamed       kernel   input  active-high [used]
line   2:      unnamed  "interrupt"   input  active-high [used]
line   3:      unnamed       kernel   input  active-high [used]
line   4:      unnamed       unused   input  active-high
line   5:      unnamed       unused   input  active-high
line   6:      unnamed       unused   input  active-high
line   7:      unnamed     "enable"  output  active-high [used]
gpiochip9 - 16 lines:
line   0:      unnamed       unused   input  active-high
line   1:      unnamed       unused   input  active-high
line   2:      unnamed      "reset"  output   active-low [used]
line   3:      unnamed  "powerdown"  output   active-low [used]
line   4:      unnamed      "reset"  output   active-low [used]
line   5:      unnamed       unused   input  active-high
line   6:      unnamed       unused   input  active-high
line   7:      unnamed       unused   input  active-high
line   8:      unnamed       unused   input  active-high
line   9:      unnamed  "PHY reset"  output   active-low [used]
line  10:      unnamed  "PHY reset"  output   active-low [used]
line  11:      unnamed      "reset"  output   active-low [used]
line  12:      unnamed       unused   input  active-high
line  13:      unnamed   "shutdown"  output  active-high [used]
line  14:      unnamed       unused   input  active-high
line  15:      unnamed       unused   input  active-high

I don't know if this is due to the sample application running or not, see the attached picture.

Ultimately what I am looking for is when I read in the User manual that GPIO2 is pin 3, PH6, what gpiochip and line is this for example?  
I imagine this will also clear up the other question of how do I know if I can access that pin or if for some reason another application or the kernel has the pin under control or if I can peek/poke it through gpioget and gpioset.  Thanks in advance for your time.

1 REPLY 1
pittengermdp
Associate

So I've been doing some more reading and I see that H bank is GPIOCHIP 7 and so 6 would be line 6. But it is used by the kernel, how can I set the pin to be usable to the userspace?  As I see that PH6 is GPIO2 and is pin3 on the cn8 connector.