duskglow Posted May 12, 2022 Share Posted May 12, 2022 (edited) Not sure if this is beginner or advanced, so I guess I'll start here. I have a "le potato" I recently bought. Getting it working has been a nightmare, but I'm almost there. Right now my project is to get a 32x64 RGB matrix working using an adafruit hat. I got Armbian 22.02.1 Focal running on it, and I'm using the gpiod library. I've had to write my own access library, but I've almost got it working, translating the pin labels ("7J1 Header Pin15") to the appropriate GPIO/offset values for use with gpiod. Except for exactly one. I try to use request_line on GPIO 22 (chip 0, offset 10) and it gives me an invalid argument. Doesn't do this for any other GPIO and I'm at my wit's end. I see in the docs that this is a "TEST_N" pin with a double asterisk notation that it needs a recent kernel to set output, but mine is plenty recent enough. I've also verified triply that I'm trying to access gpiochip0, offset 10. Some info that might be valuable. Spoiler Linux lepotato 5.10.102-meson64 #22.02.1 SMP PREEMPT Sun Feb 27 09:09:25 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux lepotato:~/rpi-rgb-led-matrix$ sudo gpioinfo gpiochip0 - 11 lines: line 0: "UART TX" unused input active-high line 1: "UART RX" unused input active-high line 2: "Blue LED" "librecomputer:blue" output active-high [used] line 3: "SDCard Voltage Switch" "VCC_CARD" output active-high [used] line 4: "7J1 Header Pin5" unused input active-high line 5: "7J1 Header Pin3" unused input active-high line 6: "7J1 Header Pin12" unused input active-high line 7: "IR In" unused input active-high line 8: "9J3 Switch HDMI CEC/7J1 Header " unused input active-high line 9: "7J1 Header Pin13" unused input active-high line 10: "7J1 Header Pin15" unused input active-high gpiochip1 - 100 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 line 8: unnamed unused input active-high line 9: unnamed unused input active-high line 10: unnamed unused input active-high line 11: unnamed unused input active-high line 12: unnamed unused input active-high line 13: unnamed unused input active-high line 14: "Eth Link LED" unused input active-high line 15: "Eth Activity LED" unused input active-high line 16: "HDMI HPD" unused input active-high line 17: "HDMI SDA" unused input active-high line 18: "HDMI SCL" unused input active-high line 19: "HDMI_5V_EN" "regulator-hdmi-5v" output active-high [used] line 20: "9J1 Header Pin2" unused input active-high line 21: "Analog Audio Mute" "enable" output active-high [used] line 22: "2J3 Header Pin6" unused input active-high line 23: "2J3 Header Pin5" unused input active-high line 24: "2J3 Header Pin4" unused input active-high line 25: "2J3 Header Pin3" unused input active-high line 26: "eMMC D0" unused input active-high line 27: "eMMC D1" unused input active-high line 28: "eMMC D2" unused input active-high line 29: "eMMC D3" unused input active-high line 30: "eMMC D4" unused input active-high line 31: "eMMC D5" unused input active-high line 32: "eMMC D6" unused input active-high line 33: "eMMC D7" unused input active-high line 34: "eMMC Clk" unused input active-high line 35: "eMMC Reset" "reset" output active-low [used] line 36: "eMMC CMD" unused input active-high line 37: "ALT BOOT MODE" unused input active-high line 38: unnamed unused input active-high line 39: unnamed unused input active-high line 40: unnamed unused input active-high line 41: "eMMC Data Strobe" unused input active-high line 42: "SDCard D1" unused input active-high line 43: "SDCard D0" unused input active-high line 44: "SDCard CLK" unused input active-high line 45: "SDCard CMD" unused input active-high line 46: "SDCard D3" unused input active-high line 47: "SDCard D2" unused input active-high line 48: "SDCard Det" "cd" input active-low [used] line 49: unnamed unused input active-high line 50: unnamed unused input active-high line 51: unnamed unused input active-high line 52: unnamed unused input active-high line 53: unnamed unused input active-high line 54: unnamed unused input active-high line 55: unnamed unused input active-high line 56: unnamed unused input active-high line 57: unnamed unused input active-high line 58: unnamed unused input active-high line 59: unnamed unused input active-high line 60: unnamed unused input active-high line 61: unnamed unused input active-high line 62: unnamed unused input active-high line 63: unnamed unused input active-high line 64: unnamed unused input active-high line 65: unnamed unused input active-high line 66: unnamed unused input active-high line 67: unnamed unused input active-high line 68: unnamed unused input active-high line 69: unnamed unused input active-high line 70: unnamed unused input active-high line 71: unnamed unused input active-high line 72: unnamed unused input active-high line 73: "Green LED" "librecomputer:system-status" output active-high [used] line 74: "VCCK Enable" unused input active-high line 75: "7J1 Header Pin27" unused input active-high line 76: "7J1 Header Pin28" unused input active-high line 77: "VCCK Regulator" unused input active-high line 78: "VDDEE Regulator" unused input active-high line 79: "7J1 Header Pin22" unused input active-high line 80: "7J1 Header Pin26" unused input active-high line 81: "7J1 Header Pin36" unused input active-high line 82: "7J1 Header Pin38" unused input active-high line 83: "7J1 Header Pin40" unused input active-high line 84: "7J1 Header Pin37" unused input active-high line 85: "7J1 Header Pin33" unused input active-high line 86: "7J1 Header Pin35" unused input active-high line 87: "7J1 Header Pin19" unused input active-high line 88: "7J1 Header Pin21" unused input active-high line 89: "7J1 Header Pin24" unused input active-high line 90: "7J1 Header Pin23" unused input active-high line 91: "7J1 Header Pin8" unused input active-high line 92: "7J1 Header Pin10" unused input active-high line 93: "7J1 Header Pin16" unused input active-high line 94: "7J1 Header Pin18" unused input active-high line 95: "7J1 Header Pin32" unused input active-high line 96: "7J1 Header Pin29" unused input active-high line 97: "7J1 Header Pin31" unused input active-high line 98: "7J1 Header Pin7" unused input active-high line 99: unnamed unused input active-high --- ADDING LINE --- Adding pin 22: offset 10, label 7J1 Header Pin15 requesting... terminate called after throwing an instance of 'std::system_error' what(): error requesting GPIO lines: Invalid argument Aborted Virtual cookies if you can help. Thanks., Edited May 16, 2022 by TRS-80 put long output inside spoiler 0 Quote Link to comment Share on other sites More sharing options...
TonyMac32 Posted May 12, 2022 Share Posted May 12, 2022 I have this hat and a couple potato's, if you can provide the scripts I could take a look. I am just getting my lab/office set back up, so it might take a bit longer to review than hoped for. 0 Quote Link to comment Share on other sites More sharing options...
duskglow Posted May 13, 2022 Author Share Posted May 13, 2022 Hi Tony, thanks. I can make a small program that will trigger this issue this weekend, I had to cannibalize the card for the rpi 3 because the project must go on, but new cards are arriving this weekend. I will say that I discovered more, though. It's a gpxx potato, apparently there are a few different kinds. I also managed to track the fault across kernel boundaries and right into kernel space. The EINVAL is coming from the GPIO_V2_GET_LINE_IOCTL ioctl, and while I don't understand exactly how it works, the problem *seems* to be that the GPIO22 (chip 0, offset 10, header pin 15) line is also the TEST_N line, and for some reason this line is in a different bank than the kernel pinctrl code is expecting. I think this is true *only* for this particular line, and while it won't get in the way of most people, the adafruit hat uses this line, so it's kind of impossible to make that work properly at the moment (I actually made some really good progress at getting the rpi-rgb-led-matrix software to work using gpiod, but this is not surmountable at the present time.) If this is not enough info, check back Sat. or Sun., I will post a small proof of concept program that will just exercise that line. Thanks for getting back. 0 Quote Link to comment Share on other sites More sharing options...
Da Xue Posted May 21, 2022 Share Posted May 21, 2022 If my memory is correct, the TEST_N line is output only and would reset the board if it was set to input. I vaguely remember something like this: https://lore.kernel.org/lkml/1533117623-27856-1-git-send-email-narmstrong@baylibre.com/T/ 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.