HAL Driver for Raspberry PI GPIOs

More
6 years 5 months ago #166670 by juscious
Thanks again !

Wouldnt managed myself to do so much. You are a savior :). Changed to hal_pi_gpio. Seems like everything works, getting some weird end stop errors, but from this point everything is manageable.

Anyways, i will analyze, and actually i have a task of doing SCARA robot control using LinuxCNC via RPI GPIO. Now feeling quite comfortable.

Please Log in to join the conversation.

  • twoflowers
  • New Member
  • New Member
More
6 years 5 months ago #166677 by twoflowers
Replied by twoflowers on topic HAL Driver for Raspberry PI GPIOs
Oh, I had erratic endstop triggering, too. I used software debouncing and they were gone. Here is the hal-file with debouncing - sorry, the last config was an old backup. Please test:

Attachment not found

Please Log in to join the conversation.

More
6 years 3 months ago #175120 by Markyd
Apologies for what will be a really basic question; how do I run LinuxCNC with / load the hal_pi_gpio hal file? I've installed linucCNC to my rpi4 but I'm now stuck. I want to try gpio before forking out for a mesa board such as the 7i96.

Please Log in to join the conversation.

  • twoflowers
  • New Member
  • New Member
More
6 years 3 months ago #175125 by twoflowers
Replied by twoflowers on topic HAL Driver for Raspberry PI GPIOs
Feel free to start with my forum.linuxcnc.org/media/kunena/attachme...17065/rpi3b-mill.tgz - it's just the configs, so it'll work on RPI4, too. But you will need to build the kernel + linuxcnc from git (there's a section in the wiki on how to do that - if you don't find tit, drop me a line).

Please Log in to join the conversation.

More
6 years 3 months ago #175126 by tommylight
Do not know for kernel, but you do not have to build Linuxcnc from GIT on the RPI, there are ready made debs for ARMF here
buildbot.linuxcnc.or/dists

Please Log in to join the conversation.

More
6 years 3 months ago #175128 by Markyd
Thanks for the the files. The bit I'm stuck with is what to do with the files, where do i put them and how do i tell linuxCNC to use them. I'm an absolute beginner to LinuxCNC and all the tutorials I've looked at seem to start with Stepconf which I assume i can't use if i want to use the GPIO port?

Can I work from the version of linuxcnc I have already installed (I used this tutorial gnipsel.com/linuxcnc/uspace/rpi4-rt.html ) ?

Please Log in to join the conversation.

More
6 years 3 months ago #175131 by tommylight
Download the attachment, extract it, open the folder, right click on the file with the .ini extension, choose "open with", on the list of apps near the bottom enter linuxcnc.

Please Log in to join the conversation.

More
5 years 10 months ago #192526 by Markyd
I eventually got this up and running, thanks to everyone's assistance.

I'm having problems trying to invert the enable pin and can't for the life of me work out what I'm doing wrong. I have the following
Code:
net xenable => hal_pi_gpio.pin-29-out setp hal_pi_gpio.pin-29-out.invert_output TRUE net xstep stepgen.0.step => hal_pi_gpio.pin-32-out net ystep stepgen.1.step => hal_pi_gpio.pin-23-out net zstep stepgen.2.step => hal_pi_gpio.pin-36-out net xdir stepgen.0.dir => hal_pi_gpio.pin-24-out net ydir stepgen.1.dir => hal_pi_gpio.pin-19-out net zdir stepgen.2.dir => hal_pi_gpio.pin-40-out

but get a 'parameter or pin not found' error when loading the HAL file. What am i doing wrong?

Please Log in to join the conversation.

More
5 years 10 months ago #192530 by tommylight
Try
setp hal_pi_gpio.pin-29.invert_output TRUE
And show us the error, otherwise we can just guess.

Please Log in to join the conversation.

More
5 years 10 months ago #192532 by Markyd
This is the error. I assume the relevant bit is "parameter or pin 'hal_pi_gpio.pin-29.invert_output' not found". I've tried lots of variations and no luck
Code:
Error report created by /usr/lib/tcltk/linuxcnc/show_errors.tcl: Print file information: RUN_IN_PLACE=no LINUXCNC_DIR= LINUXCNC_BIN_DIR=/usr/bin LINUXCNC_TCL_DIR=/usr/lib/tcltk/linuxcnc LINUXCNC_SCRIPT_DIR= LINUXCNC_RTLIB_DIR=/usr/lib/linuxcnc/modules LINUXCNC_CONFIG_DIR= LINUXCNC_LANG_DIR=/usr/lib/tcltk/linuxcnc/msgs INIVAR=inivar HALCMD=halcmd LINUXCNC_EMCSH=/usr/bin/wish8.6 LINUXCNC - 2.8.0 Machine configuration directory is '/home/pi/linuxcnc/configs/Harrison_Vert_Mill' Machine configuration file is 'Harrison_Vert_Mill.ini' INIFILE=/home/pi/linuxcnc/configs/Harrison_Vert_Mill/Harrison_Vert_Mill.ini VERSION=1.1 PARAMETER_FILE=linuxcnc.var TASK=milltask HALUI=halui DISPLAY=axis COORDINATES=X Y Z KINEMATICS=trivkins Starting LinuxCNC... Starting LinuxCNC server program: linuxcncsvr Loading Real Time OS, RTAPI, and HAL_LIB modules Starting LinuxCNC IO program: io Starting HAL User Interface program: halui twopass:invoked with <> options twopass:found ./Harrison_Vert_Mill.hal twopass:found ./custom.hal twopass:pass0: loadusr -W hal_manualtoolchange twopass: Error in file ./Harrison_Vert_Mill.hal: setting parameter 'hal_pi_gpio.pin-29.invert_output' to 'TRUE' parameter or pin 'hal_pi_gpio.pin-29.invert_output' not found Shutting down and cleaning up LinuxCNC... Removing HAL_LIB, RTAPI, and Real Time OS modules Removing NML shared memory segments Debug file information: Note: Using POSIX realtime 3852 Stopping realtime threads Unloading hal components Note: Using POSIX realtime


And this is how it appears in the HAL file
Code:
setp hal_pi_gpio.pin-29.invert_output TRUE net xenable => hal_pi_gpio.pin-29-out net xstep stepgen.0.step => hal_pi_gpio.pin-32-out net ystep stepgen.1.step => hal_pi_gpio.pin-23-out net zstep stepgen.2.step => hal_pi_gpio.pin-36-out # i use GPIO 14,15,18 for xdir ydir zdir, thats rpin net xdir stepgen.0.dir => hal_pi_gpio.pin-24-out net ydir stepgen.1.dir => hal_pi_gpio.pin-19-out net zdir stepgen.2.dir => hal_pi_gpio.pin-40-out

Please Log in to join the conversation.

Time to create page: 0.064 seconds
Powered by Kunena Forum