HAL Driver for Raspberry PI GPIOs

More
7 years 2 days ago #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

Please Log in to join the conversation.

More
7 years 1 day ago #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 to join the conversation.

More
7 years 1 day ago #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 to join the conversation.

More
7 years 1 day ago #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 to join the conversation.

More
6 years 11 months ago #149355 by andypugh

joao404 wrote: 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.

Please Log in to join the conversation.

  • twoflowers
  • New Member
  • New Member
More
6 years 8 months ago #157180 by twoflowers
Replied by twoflowers on topic HAL Driver for Raspberry PI GPIOs
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 :)

Attachment not found

Please Log in to join the conversation.

More
6 years 5 months ago #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 to join the conversation.

  • twoflowers
  • New Member
  • New Member
More
6 years 5 months ago #166648 by twoflowers
Replied by twoflowers on topic HAL Driver for Raspberry PI GPIOs
This is from my wooden mill ... enjoy :)

Attachment not found

Please Log in to join the conversation.

More
6 years 5 months ago #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?

Please Log in to join the conversation.

  • twoflowers
  • New Member
  • New Member
More
6 years 5 months ago #166662 by twoflowers
Replied by twoflowers on topic HAL Driver for Raspberry PI GPIOs
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.

Please Log in to join the conversation.

Time to create page: 0.075 seconds
Powered by Kunena Forum