jqz 0 Posted June 7, 2021 Hi, Does anyone uses libgpiod library on TBoard-s? The command gpioinfo displays the gpiochips and lines that the library can access and there's a lot of them. In reality there's only a few gpio lines on each gpiochips that are usable if their respective alternate functions are not already set in the devicetree. It would be super nice if those usable lines are labeled that correspond to that fancy colour coded pinout in the board. But for now I would like to know which of the lines I could actually use as gpios. Any pointer or directions where to look for more help would be greatly appreciated. Share this post Link to post Share on other sites
jqz 0 Posted June 7, 2021 so I managed to add some names to the device tree, but I'm not quite sure if it's correct? There are 32 lines in gpiochip5 and I'm not sure if GP5B0 is actually at line0. Surely, If I was able to do something like this, this should be easily done by the experts. I added this to .dts file &gpio5 { gpio-line-names = "GP5B0", "GP5B1", "GP5B2", "GP5B3", "GP5B4", "GP5B5", "GP5B6", "GP5B7", "GP5C0", "", /* GPIO5C1 */ "", /* GPIO5C2 */ "GPIO5C3"; }; This is on a slackwarearm kernel 5.10. and the result is this: Share this post Link to post Share on other sites
diozero 0 Posted June 11, 2021 I'm the author of the diozero Java library that is portable across many SBCs and have written a number of utility applications, one of which allows you to display information about the connected board: > java -cp diozero-sampleapps-1.3.0.jar com.diozero.sampleapps.SystemInformation Local System Info Operating System: ubuntu 20.04.2 LTS (Focal Fossa) I2C buses: [2, 0, 5] CPU Temperature: 37.27 Native Device Factory: DefaultDeviceFactory Board: Asus Tinker Board (RAM: 2,048,000 bytes, O/S: ubuntu 20.04.2 LTS (Focal Fossa)) Header: DEFAULT +-----+----------+--------+----------+--------+----------+-----+ + GP# + Name + gpiod + Physical + gpiod + Name + GP# + +-----+----------+--------+----------+--------+----------+-----+ | | 3v3 | | 1 || 2 | | 5v | | | 252 | GPIO8_A4 | 8:4 | 3 || 4 | | 5v | | | 253 | GPIO8_A5 | 8:5 | 5 || 6 | | GND | | | 17 | GPIO0_C1 | 0:17 | 7 || 8 | 5:9 | GPIO5_B1 | 161 | | | GND | | 9 || 10 | 5:8 | GPIO5_B0 | 160 | | 164 | GPIO5_B4 | 5:12 | 11 || 12 | 6:0 | GPIO6_A0 | 184 | | 166 | GPIO5_B6 | 5:14 | 13 || 14 | | GND | | | 167 | GPIO5_B7 | 5:15 | 15 || 16 | 5:10 | GPIO5_B2 | 162 | | | 3v3 | | 17 || 18 | 5:11 | GPIO5_B3 | 163 | | 257 | GPIO8_B1 | 8:9 | 19 || 20 | | GND | | | 256 | GPIO8_B0 | 8:8 | 21 || 22 | 5:19 | GPIO5_C3 | 171 | | 254 | GPIO8_A6 | 8:6 | 23 || 24 | 8:7 | GPIO8_A7 | 255 | | | GND | | 25 || 26 | 8:3 | GPIO8_A3 | 251 | | 233 | GPIO7_C1 | 7:17 | 27 || 28 | 7:18 | GPIO7_C2 | 234 | | 165 | GPIO5_B5 | 5:13 | 29 || 30 | | GND | | | 168 | GPIO5_C0 | 5:16 | 31 || 32 | 7:23 | GPIO7_C7 | 239 | | 238 | GPIO7_C6 | 7:22 | 33 || 34 | | GND | | | 185 | GPIO6_A1 | 6:1 | 35 || 36 | 7:7 | GPIO7_A7 | 223 | | 224 | GPIO7_B0 | 7:8 | 37 || 38 | 6:3 | GPIO6_A3 | 187 | | | GND | | 39 || 40 | 6:4 | GPIO6_A4 | 188 | +-----+----------+--------+----------+--------+----------+-----+ Plus GpioReadAll: > java -cp diozero-sampleapps-1.3.0.jar com.diozero.sampleapps.GpioReadAll Header: DEFAULT +-----+----------+------+---+--------+----------+--------+---+------+----------+-----+ + GP# + Name + Mode + V + gpiod + Physical + gpiod + V + Mode + Name + GP# + +-----+----------+------+---+--------+----------+--------+---+------+----------+-----+ | | 3v3 | | | | 1 || 2 | | | | 5v | | | 252 | GPIO8_A4 | In | 0 | 8:4 | 3 || 4 | | | | 5v | | | 253 | GPIO8_A5 | In | 0 | 8:5 | 5 || 6 | | | | GND | | | 17 | GPIO0_C1 | In | 0 | 0:17 | 7 || 8 | 5:9 | 0 | Unkn | GPIO5_B1 | 161 | | | GND | | | | 9 || 10 | 5:8 | 0 | Unkn | GPIO5_B0 | 160 | | 164 | GPIO5_B4 | In | 0 | 5:12 | 11 || 12 | 6:0 | 0 | Unkn | GPIO6_A0 | 184 | | 166 | GPIO5_B6 | Unkn | 0 | 5:14 | 13 || 14 | | | | GND | | | 167 | GPIO5_B7 | Unkn | 0 | 5:15 | 15 || 16 | 5:10 | 0 | In | GPIO5_B2 | 162 | | | 3v3 | | | | 17 || 18 | 5:11 | 0 | In | GPIO5_B3 | 163 | | 257 | GPIO8_B1 | In | 0 | 8:9 | 19 || 20 | | | | GND | | | 256 | GPIO8_B0 | In | 0 | 8:8 | 21 || 22 | 5:19 | 0 | In | GPIO5_C3 | 171 | | 254 | GPIO8_A6 | In | 0 | 8:6 | 23 || 24 | 8:7 | 0 | In | GPIO8_A7 | 255 | | | GND | | | | 25 || 26 | 8:3 | 0 | In | GPIO8_A3 | 251 | | 233 | GPIO7_C1 | In | 0 | 7:17 | 27 || 28 | 7:18 | 0 | In | GPIO7_C2 | 234 | | 165 | GPIO5_B5 | In | 0 | 5:13 | 29 || 30 | | | | GND | | | 168 | GPIO5_C0 | In | 0 | 5:16 | 31 || 32 | 7:23 | 0 | Unkn | GPIO7_C7 | 239 | | 238 | GPIO7_C6 | Unkn | 0 | 7:22 | 33 || 34 | | | | GND | | | 185 | GPIO6_A1 | Unkn | 0 | 6:1 | 35 || 36 | 7:7 | 0 | Unkn | GPIO7_A7 | 223 | | 224 | GPIO7_B0 | Unkn | 0 | 7:8 | 37 || 38 | 6:3 | 0 | Unkn | GPIO6_A3 | 187 | | | GND | | | | 39 || 40 | 6:4 | 0 | Unkn | GPIO6_A4 | 188 | +-----+----------+------+---+--------+----------+--------+---+------+----------+-----+ Share this post Link to post Share on other sites
jqz 0 Posted June 12, 2021 Wow thanks! I'm guessing the column with gpiod is all I need, assuming the numbers in that column corresponds to chipnum : line number . I'd also tinker with diozero and see if I could figure out how to use it. Thanks again. Share this post Link to post Share on other sites