New GPIO driver for OPI5

More
05 May 2023 07:02 #270704 by Guglielmi
Hi,
I'm trying to create a new gpio driver for Orange PI5 due to the fact ARISC driver is not updated and no other existing driver found.
I'm not so sure I'm able to win on this task.. but, let's try.
I have a basic issue and searching on the web I did not found a solution.
I created a kind of empty C driver starting from  HAL skeleton.

I built it with HALCOMPILE and I got the file.so I called hal_op5_io.so. (I found the name should have max len..)
I placed the file into folder "usr/lib/linuxcnc/modules/".
When I call with "loadrt" my module:
loadrt hal_op5_io
addf hal_op5_io.write base-thread

I get an error that module is not found.
I thought it was an error caused by internal code somewhere, so I did another test:
copied all code from hal_parport and just changed file name and the init call, passing my name (hal_op5_io)
but I got the same error.
Found file(REL): ./cnc3040.hal
hal_op5_io: dlopen: /usr/lib/linuxcnc/modules/hal_op5_io.so: cannot open shared object file: No such file or directory
./cnc3040.hal:2: waitpid failed /usr/bin/rtapi_app hal_op5_io
./cnc3040.hal:2: /usr/bin/rtapi_app exited without becoming ready
./cnc3040.hal:2: insmod for hal_op5_io failed, returned -1
Shutting down and cleaning up LinuxCNC...
Note: Using POSIX realtime
LinuxCNC terminated with an error.  You can find more information in the log:
    /home/andrea/linuxcnc_debug.txt
and
    /home/andrea/linuxcnc_print.txt
as well as in the output of the shell command 'dmesg' and in the terminal

I can get the same identical error calling a non existing module, like calling "hal_mod_fake".
But the file .so exists in the folder!
Should I install somehow or add this module name somewhere else?

Thanks
Andrea

Please Log in or Create an account to join the conversation.

More
05 May 2023 20:44 #270751 by Guglielmi
Replied by Guglielmi on topic New GPIO driver for OPI5
I found the issue!
I was building the driver on a VM with Ubuntu and copying the .so file generated to OPI5.
Now I tried to clone the dev repo inside the OPI5 and build the driver on it and it worked.
I mean.. launching the application now I get errors from the code not written yet, but at least
the system can see and use it.
Good starting point!

Please Log in or Create an account to join the conversation.

More
10 May 2023 08:08 #271090 by mwidlok
Replied by mwidlok on topic New GPIO driver for OPI5
Guglielmi,
Have You checked latency on the OPI5?
I really would like to compare it with old H3, that I've used before. It was not great if I remember correctly.

Please Log in or Create an account to join the conversation.

More
11 May 2023 16:08 #271165 by Guglielmi
Replied by Guglielmi on topic New GPIO driver for OPI5
I will post a screen-shot as soon as I back at home.
I remember it was around 3us running for more than 2000 seconds, with 6 gears running
How much you can reach with H3?

Please Log in or Create an account to join the conversation.

More
12 May 2023 21:29 #271253 by Guglielmi
Replied by Guglielmi on topic New GPIO driver for OPI5
Attached a Latency test with Wifi active and 6 Gixgears 
Attachments:
The following user(s) said Thank You: rodw

Please Log in or Create an account to join the conversation.

More
12 May 2023 22:42 #271262 by rodw
Replied by rodw on topic New GPIO driver for OPI5
Amazing!

Please Log in or Create an account to join the conversation.

More
14 May 2023 17:09 #271352 by mwidlok
Replied by mwidlok on topic New GPIO driver for OPI5
The results are really good. If I remember correctly it was more then ~30us with H3. Now on normal T530 laptop I'm getting ~15us with hard load (firefox, kicad, solvespace), but we all know that notebooks are poor choice for real time.

Are You using any special tweaks for the OPI5 (like isolcpus or something)?

Please Log in or Create an account to join the conversation.

Time to create page: 0.092 seconds
Powered by Kunena Forum