Spindle Control HAL code error

More
28 Feb 2016 03:12 #70741 by kineng64
Good Evening,

After many years of using MACH I have decided to convert my lathe over to LinuxCNC do to my falling in love with how well PathPilot controls my mill.

I have almost everything working except the spindle. I have a BOB connected to a CNC4PC C6 spindle control board. This board uses a step pulse to output a 0-10V signal to my VFD. I also have a single pulse index on the spindle that I would like to read from and eventually run a PID loop to adjust for load on the spindle.

I have added the code found on CNC4PC's website, although I think it should still work I believe it was originally written for EMC2 and maybe that is the problem.
#
#   5th stepgen for controlling the spindle.
#   Type must be set to velocity
#
loadrt stepgen step_type=0,0,0,0,0 ctrl_type=p,p,p,p,v #
#   Use a scale module for offset and scaling of the stepgen
#   Offset and scale are determined by first calculating and testing
#
setp scale.0.in 0
setp scale.0.gain 0.36
setp scale.0.offset 60.0
addf scale.0 servo-thread
#
#   Initialise the stepgen for the spindle
#
setp stepgen.4.position-scale 1
setp stepgen.4.maxvel 1300
setp stepgen.4.steplen 1
setp stepgen.4.stepspace 0
setp stepgen.4.dirhold 20000
setp stepgen.4.dirsetup 20000
setp stepgen.4.maxaccel 200
#
#   Enable
#
net spindle-enable <= motion.spindle-on => stepgen.4.enable #
#   Connect spindle speed to scaler
#
net spindle-cmd motion.spindle-speed-out => scale.0.in #
#   Connect scaler output to stepgen velocity
#
net spindle-freq <= scale.0.out => stepgen.4.velocity-cmd #
#   Connect output to the pin for the analog voltage of cnc4pc board
#
net spindle-out <= stepgen.4.step => parport.0.pin-14-out #
#   Control of spindle on/off (I1/I2 of KBIC speed controller over the
#   relay instead of triac
#
net spindle-cw => parport.0.pin-16-out

When trying to run this I get an error in line 78 which is "loadrt stepgen step_type=0,0,0,0,0 ctrl_type=p,p,p,p,v"

could not insert the module ...stepgen.ko File exists

Any help would be appreciated! And if this is in the incorrect location please feel free to move post.

Thanks in advance!

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

More
28 Feb 2016 07:08 #70745 by cmorley
If you look in the original hal file you will see it already loads the stepgen component.
It fails because it looks like you are asking it to load again which you cannot do.

You would need to edit the original stepgen load like to add the velocity mode step generator.
Probably exchanging the line that you posted for what is in the original HAL file.
then erase the one at line 78

Chris M

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

Time to create page: 0.086 seconds
Powered by Kunena Forum