Does the library OPi.GPIO work on radxa 5b? Especially GPIO.add_event_detect and the callback. I didn’t see any mention of radxa 5b board in the docs only zero board.
Can gpiomon in gpiod trigger a callback script? I don’t see it mentioned.
I need to run a callback script off of the edge. I want to count the number of button pushes.
I am confused, on this page: https://wiki.radxa.com/Rock5/hardware/5b/gpio aren’t the gpio numbers on the far left and right of the top connector display at the top of the page? I don’t see any pin showing GPIO4_D5.
I looked at rock5b.py about the pins. It shows
16: 154,
18: 156,
so they don’t appear to match from the wiki page.
Let me explain something to you about the pins.
There may be multiple “Pin numbers” for a single GPIO. This is due to the way in which controllers (SOM: System on a chip) are integrated into a SBC (Single board computer):
You start with a single pinout at the controller (You may assume this is like the central processor),
Later, when you put this chip (processor) onto a PCB with some other peripherals and convert the SOM onto an SBC, the pin numbers change from the original ones (as numbered in the SOM chip) to those in the new SBC connectors.
When by software you program the mode to board: GPIO.setmode(radxa.rock5b.BOARD)
You are referring to the BOARD pins circled in red (ordered from 1 to 40)
Otherwise when by software you program the mode to BCM: GPIO.setmode(radxa.rock5b.BCM)
You are referring to the SOM pin numbers circled on blue (I think that the rock 5B SBC uses the Rockchip RK3588 SOM)
Hope you must be curious about why is called BCM
Final thought: To refer to a specific GPIO you must finally use the SOM numbering.
The dictionary in rock5b.py must work as a match dictionary to find the right number of the SOM.
GPIO4_D5 is not present at the 40-pin connector cause there are just 40 pins for GPIO and other stuff and the designer just doesn’t use it in the board, but may exists at the SOM.
so the rock5b.py may be wrong (It happened to me with another board model). Just update it with the right match and you have it!
I just download the library by means of pip. And locally copy and paste the “Radxa” folder from here:
Ok, will work thru this new stuff, knew about BCM–been using raspberry for a long time.
I understand now to use rm-hull opi and will copy the radxa folder to it and then make the necessary corrections to it.
If I understand right, radxa really uses the BCM numbers.
Do both of these work the same, GPIO.setmode(radxa.rock5b.BOARD) using pin 16 and GPIO.setmode(radxa.rock5b.BCM) using pin 100?
I really appreciate all your help. I am sure I am not the only one who has had trouble with this.
I do have another fairly important problem. I am running Debian 11 and have 3 radxa’s. On new the mouse works ok, on another one I lose the mouse pointer almost all the time, mouse works just can’t see the pointer. I posted a query about this and got no reply. I get the pointer back when I reboot, but that is a real pain.
I will work on gpio more, btw, I understand when the pin is HIGH, the voltage is supposed to be around 3v and mine is never near 3.
You definitely will need to edit the rock5b.py file.
Linux understands the pin numbering as the ones at the SOM.
In fact, the dictionary called BOARD must be a match between the pin at the BOARD and the pin at the SOM (But now we know that this file is wrong)
Edit the file and test.
Continue using GPIO.setmode(radxa.rock5b.BOARD) using pin 16 after that correction.