Is Rock5 slower than RaspberryPi through GPIO?

Hi, there.
I am comparing the GPIO speed of Raspberry Pi and Rock5.
I found that Rock5 is much slower than Raspberry Pi.
Isn’t Rock5 suitable for high-speed GPIO access?

・Test environment
Rock5
OS :Deabian5.10.119-15-rockchip(CUI)
Python :python 3.9.2
module :OPi.GPIO

RaspberryPi
OS :RaspberryPi OS(LITE)6.1.21
Python :python 3.9.2
module :RPi.GPIO

・Test configuration
GPIO1:LOW to HIGH
GPIO2:HIGH to LOW
I measured the time between the above.

・Result
Rock5 :34μs


RaspberryPi :2μs

Regards,

Hi, I’m not sure about Python as I code in C++ but I noticed one difference. On RaspberryPi, I normally use WiringPi library that provides direct memory access to GPIO pins which is super-fast. But on Radxa boards, I am able to use either sysfs or ioctl (a lot better than sysfs) methods only which are much slower and have high latency.

What @kolsi said is correct. Currently we only support libgpiod-based GPIO API by default, since this one is the standard Linux API for GPIO access. As such, it comes with the overhead of going through multiple subsystems before reaching the hardware.

It is possible to achieve low latency GPIO access via direct register access (for example on ROCK 4). However, it is more complex to code, and requires root permission (with gpiod we currently allow unprivileged user to access GPIO), so it is put on hold for now.

@RadxaYuntian
Thank you for your reply. I understood it well.
I would like to ask two additional questions.
・Do you have any plans to develop direct access GPIO with Rock5?
・How much faster is Rock4’s GPIO compared to the current Rock5?

regards,

We have done the port for ROCK 5, but they need to be reviewed and up streamed. If you can tell me which exact model (5A or 5B) you are using we can prioritize on that one first.

We will test our implementation on ROCK 5A right now.

@RadxaYuntian
We are using Rock 5B (V1.42 2022.08.29) now.