Loss of spindle reverse with Lincurve and PathPilot 2.14

More
23 Dec 2018 00:06 #122764 by jcrossley
Hello there,
I am having a problem when trying to use lincurve to correct spindle speed on my PP installation. I have compiled the rtlibs, and when enabled in the HAL it absolutely works and gets me within ~8-10RPM of commanded RPM. The problem I am having is that spindle reverse no longer functions, either as part of g-code (such as a tapping cycle) or when manually commanded through the MDI or on screen buttons. No errors appear, and PP seems to think it's in reverse because the green indicator on the radio button is lit. This is my first time working with LinuxCNC, but I can get around Linux in general pretty well. Can someone take a peek at my hal and see if I am missing anything obvious?

Here is the section from the HAL (also attached the HAL and INI to the post).
########################################################################
# Spindle speed control
#
# PWM ouputs the duty cycle it is told by tormachspindle comp
#

loadrt lincurve personality=8
addf lincurve.0 servo-thread

#y = commanded x = observed personality = number of points

setp lincurve.0.x-val-00 0
setp lincurve.0.y-val-00 0
setp lincurve.0.x-val-01 408
setp lincurve.0.y-val-01 500
setp lincurve.0.x-val-02 1144
setp lincurve.0.y-val-02 1000
setp lincurve.0.x-val-03 2457
setp lincurve.0.y-val-03 2000
setp lincurve.0.x-val-04 3481
setp lincurve.0.y-val-04 3000
setp lincurve.0.x-val-05 4764
setp lincurve.0.y-val-05 4000
setp lincurve.0.x-val-06 5680
setp lincurve.0.y-val-06 5000
setp lincurve.0.x-val-07 8650
setp lincurve.0.y-val-07 6000

net spindle-raw motion.spindle-speed-out => lincurve.0.in
net spindle-corrected lincurve.0.out => hm2_5i25.0.pwmgen.00.value

#added 7/12/18 line directly below inverts spindle direction for novakon board
setp hm2_5i25.0.gpio.001.invert_output 1
setp hm2_5i25.0.gpio.005.invert_output 1
setp hm2_5i25.0.pwmgen.00.output-type 1

# hispeed spindle min/max
setp tormachspindle.hispeed-min [SPINDLE]HI_RANGE_MIN
setp tormachspindle.hispeed-max [SPINDLE]HI_RANGE_MAX

# allow UI to access min/max for high speed spindle
# do not net these until the UI code is changed to set them explicitly
# or the setp command above will not stick and they will be set to 0
#net spindle-hispeed-min tormachspindle.hispeed-min # SAG
#net spindle-hispeed-max tormachspindle.hispeed-max # SAG

# these let the UI read the min/max maintained by the comp based on spindle type
#net spindle-min-speed tormachspindle.min-speed # SAG
#net spindle-max-speed tormachspindle.max-speed # SAG

# the UI sets the spindle type
#net spindle-type tormachspindle.spindle-type # SAG

# assume high range until UI sets it
setp tormachspindle.belt-position 1
# net spindle-range tormachspindle.belt-position # SAG
# net spindle-range-alarm tormachspindle.speed-alarm # SAG

setp tormachspindle.lowbelt-min-rpm [SPINDLE]LO_RANGE_MIN
setp tormachspindle.lowbelt-max-rpm [SPINDLE]LO_RANGE_MAX

setp tormachspindle.highbelt-min-rpm [SPINDLE]HI_RANGE_MIN
setp tormachspindle.highbelt-max-rpm [SPINDLE]HI_RANGE_MAX

# speed-out is displayed by UI when program running
# net spindle-speed-fb-rpm tormachspindle.speed-out # SAG

# spindle at speed parameters for tormachspindle component
setp tormachspindle.startup-delay [SPINDLE]STARTUP_DELAY

# time to reach max speed from stopped
setp tormachspindle.seconds-to-max-rpm [SPINDLE]SECONDS_TO_MAX_RPM

# connect spindle comp at-speed output to motion
net spindle-at-speed tormachspindle.at-speed motion.spindle-at-speed

#make spindle pos

# net spindle-speed-cmd motion.spindle-speed-out => hm2_5i25.0.pwmgen.00.value
setp hm2_5i25.0.pwmgen.pwm_frequency [SPINDLE]PWM_FREQUENCY
setp hm2_5i25.0.pwmgen.00.scale [SPINDLE]HI_RANGE_MAX

setp pid.4.Pgain [SPINDLE]P
setp pid.4.Igain [SPINDLE]I
setp pid.4.Dgain [SPINDLE]D
setp pid.4.bias [SPINDLE]BIAS
setp pid.4.FF0 [SPINDLE]FF0
setp pid.4.FF1 [SPINDLE]FF1
setp pid.4.FF2 [SPINDLE]FF2
setp pid.4.deadband [SPINDLE]DEADBAND
setp pid.4.maxoutput [SPINDLE]MAX_OUTPUT
setp pid.4.error-previous-target true
setp pid.4.maxerror .0005

net spindle-index-enable <=> pid.4.index-enable
net spindle-enable => pid.4.enable
net spindle-vel-cmd-rpm => pid.4.command
net spindle-vel-fb-rpm => pid.4.feedback
net spindle-output <= pid.4.output

net spindle-on motion.spindle-on hm2_5i25.0.pwmgen.00.enable tormachspindle.spindle-on


Thanks for any help!
Jason
Attachments:

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

More
23 Dec 2018 06:26 #122772 by smgvbest
I"m not familiar with your machine/spindle but it seems to me I don't see where you connect the spindle direction to an actual output to send to your spindle since
I see you setting up gpios for this in your hal file
#added 7/12/18 line directly below inverts spindle direction for novakon board
setp hm2_5i25.0.gpio.001.invert_output 1
setp hm2_5i25.0.gpio.005.invert_output 1
setp hm2_5i25.0.pwmgen.00.output-type 1

so is gpio 1 and gpio 5 your fwd/rev signals?

if so they are never connected to anything in your hal to actual command them to respond to fwd/rev

maybe adding these would help assuming gpio 1 is fwd and 5 is rev?

net spindle-cw motion.spindle-forward =>hm2_5i25.0.gpio.001.out
net spindle-ccw motion.spindle-reverse =>hm2_5i25.0.gpio.005.out

I could be way off here tough I'm still learning hal stuff and how it all connects.

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

More
23 Dec 2018 22:40 #122805 by andypugh
I think that the problem is that the lincurve can never output a negative value, so the pwm always sees a positive value, and never sets the DIR pin.
You need to provide Y values to suit negative X values in the lincurve.

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

More
24 Dec 2018 00:05 #122810 by jcrossley
Thanks for the replies. Andy, you were correct. I changed it to:
loadrt lincurve personality=15
addf lincurve.0 servo-thread

#y = commanded x = observed personality = number of points
setp lincurve.0.x-val-00 -8650
setp lincurve.0.y-val-00 -6000
setp lincurve.0.x-val-01 -5680
setp lincurve.0.y-val-01 -5000
setp lincurve.0.x-val-02 -4764
setp lincurve.0.y-val-02 -4000
setp lincurve.0.x-val-03 -3481
setp lincurve.0.y-val-03 -3000
setp lincurve.0.x-val-04 -2457
setp lincurve.0.y-val-04 -2000
setp lincurve.0.x-val-05 -1144
setp lincurve.0.y-val-05 -1000
setp lincurve.0.x-val-06 -408
setp lincurve.0.y-val-06 -500
setp lincurve.0.x-val-07 0
setp lincurve.0.y-val-07 0
setp lincurve.0.x-val-08 408
setp lincurve.0.y-val-08 500
setp lincurve.0.x-val-09 1144
setp lincurve.0.y-val-09 1000
setp lincurve.0.x-val-10 2457
setp lincurve.0.y-val-10 2000
setp lincurve.0.x-val-11 3481
setp lincurve.0.y-val-11 3000
setp lincurve.0.x-val-12 4764
setp lincurve.0.y-val-12 4000
setp lincurve.0.x-val-13 5680
setp lincurve.0.y-val-13 5000
setp lincurve.0.x-val-14 8650
setp lincurve.0.y-val-14 6000

It's perfect!!
Thanks for the push in the right direction.

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

More
24 Dec 2018 00:10 #122811 by smgvbest
Just for my curiousity, can anyone explain how this get the FWD/REV signal to the spindle? I'm obviously missing how that works

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

Moderators: cncbasher
Time to create page: 0.074 seconds
Powered by Kunena Forum