HAL Driver for Raspberry PI GPIOs

More
29 Oct 2019 00:03 #149022 by joao404
Hello,

I am using LinuxCNC directly on a Raspberry Pi 3B+ to control a little robotarm MK2. Because I wasn't able to find a proper driver for the gpios of the Pi, i used this Arduino based solution(github.com/dewy721/EMC-2-Arduino) to control the stepper motors and servos. But this shows as expected only poor results.
I am currently writting a HAL driver for the gpios of Pi based on the hal_parport.c and the libgpiod. Is libgpiod in this case a good solution or are there faster ways to write and read pins and of better use in case of realtime?

I put the code for free use at github.com/joao404/HAL2PI. At the moment the reset function and inverted datasignals are not finished.

If someone knows a better existing solution or has some notes about my coding it would be nice to get some feedback.

Greetings
Marcel
The following user(s) said Thank You: Mike_Eitel

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

More
29 Oct 2019 14:50 #149052 by pl7i92
there are lots of projekts alredy running so you may not need a Haldriver
look on the search field and giv it a try
Raspberry Pi

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

More
29 Oct 2019 19:28 #149071 by Mike_Eitel
I myself would love to have something like a hal_pi_gpio in standard distro. Similar to the bb version.
Not for real machine, i'm a pure fan of Mesa, but for playing with Pi4 this would be nice.
Mike

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

More
29 Oct 2019 22:44 #149079 by joao404
Hi,

I found one project at erste.de/linuxCNC_raspberry_PI4.html (bottom part) which uses WiringPi and a file called hal_gpio.c which you can download from linuxcnc.org.

Marcel

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

More
01 Nov 2019 13:26 #149355 by andypugh

If someone knows a better existing solution


If you get version 2.8 / uspace then you should be able to use the hal_pi_gpio component that was recently added.

github.com/LinuxCNC/linuxcnc/commit/e0dc...52586d505f4b9bcda60d

Scroll to the last file on that page to see sample HAL-file usage.
The following user(s) said Thank You: Mike_Eitel, Vector

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

More
12 Feb 2020 15:03 - 12 Feb 2020 15:07 #157180 by twoflowers
I have made a small tool to calculate the "loadrt hal_pi_gpio dir=... exclude=..."-line. Hope it helps.
Example: hal_pi_gpio-calculator.sh 17:27:22 2:3:4:12:14:15:18
--> loadrt hal_pi_gpio dir=78855 exclude=32394232

Enjoy :)

File Attachment:

File Name: hal_pi_gpi...or.sh.gz
File Size:1 KB
Attachments:
Last edit: 12 Feb 2020 15:07 by twoflowers.
The following user(s) said Thank You: Mike_Eitel, andypugh, tjtr33, Vector

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

More
04 May 2020 17:26 #166644 by juscious
Hi,

I am new to this, but i badly need to make Linux cnc to work with RPI GPIO outputs. Maybe someone could share like a working example of configs?
Or maybe someone please explain step by step how to do it.

Thanks in advance.

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

More
04 May 2020 17:52 #166648 by twoflowers
This is from my wooden mill ... enjoy :)

File Attachment:

File Name: rpi-config.tgz
File Size:19 KB
Attachments:
The following user(s) said Thank You: juscious, Vector

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

More
04 May 2020 18:21 - 04 May 2020 18:28 #166653 by juscious
Thanks very much !

I get error hal_gpio: dlopen: /usr/lib/linuxcnc/modules/hal_gpio.so cannot open shared object file.

In directory there is only closest to it hal_bb_gpio.so...

Maybe i could get that file too please?
Last edit: 04 May 2020 18:28 by juscious.

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

More
04 May 2020 19:22 - 04 May 2020 19:24 #166662 by twoflowers
oh, sorry, please use "hal_pi_gpio" and you'll need linuxcnc 2.8, the gpio driver for rpi is included in linuxcnc since some months now.
Last edit: 04 May 2020 19:24 by twoflowers.

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

Moderators: PCWjmelson
Time to create page: 0.093 seconds
Powered by Kunena Forum