Confused by Tormach 1100-3 Original Spindle Setup in Hal (Converting to LCNC)

More
11 Aug 2020 01:19 #177854 by TheBigLebowski
I am working on changing over my series 3 tormach from pathpilot to linux cnc 2.8

I have the all three axis up and running but am confused but the way tormach setup their spindle drive.

The machine still has the standard tormach BOB and Emerson commander vfd for the spindle, I plan to keep both for the time being.

It looks like the Emerson Commander Sk accepts 0-10v input for speed control, so I would think it should be driven using pwm.
########################################################################
# 5i25
# Configuration pin-out:
#
#                    IO Connections for P3
#    Mill Function   Pin#    I/O     Pri. func    Sec. func    Chan      Pin func        Pin Dir
#
#    Spindle Speed    1        0     IOPort       StepGen       4        Step/Table1     (Out)
#    Coolant         14        1     IOPort       None                                   (Out)
#    X Direction      2        2     IOPort       StepGen       0        Dir/Table2      (Out)
#    Estop Reset     15        3     IOPort       None                                   (In)
#    X Step           3        4     IOPort       StepGen       0        Step/Table1     (Out)
#    Spindle Dir     16        5     IOPort       None                                   (Out)
#    Y Direction      4        6     IOPort       StepGen       1        Dir/Table2      (Out)
#    Charge Pump     17        7     IOPort       PWM           0        PWM             (Out)
#    Y Step           5        8     IOPort       StepGen       1        Step/Table1     (Out)
#    Z Direction      6        9     IOPort       StepGen       2        Dir/Table2      (Out)
#    Z Step           7       10     IOPort       StepGen       2        Step/Table1     (Out)
#    A Direction      8       11     IOPort       StepGen       3        Dir/Table2      (Out)
#    A Step           9       12     IOPort       StepGen       3        Step/Table1     (Out)
#    X Limit         10       13     IOPort       None                                   (In)
#    Y Limit         11       14     IOPort       None                                   (In)
#    Z Limit         12       15     IOPort       None                                   (In)
#    Probe In        13       16     IOPort       None                                   (In)
#

########################################################################
# DPLL configuration
setp hm2_[HOSTMOT2](BOARD).0.dpll.01.timer-us [HOSTMOT2](DPLL_TIMER_US)

# default is -1 which means don't use the DPLL timer and simply sample on read()
# set to 1 for Ethernet boards to use DPLL timer 1 and sample 100 micro seconds
# before the nominal servo thread read() time
setp hm2_[HOSTMOT2](BOARD).0.stepgen.timer-number  [HOSTMOT2](DPLL_TIMER_NUMBER)


# the mills have no encoders enabled in
# [HOSTMOT2] DRIVER_PARAMS="config= num_encoders=0 num_pwmgens=1 num_3pwmgens=0 num_stepgens=5 "
# -- this is a reminder for if they get added
# if there are no encoders the encoder.timer-number pin does not exist and this line will be a fatal srartup error

#setp hm2_[HOSTMOT2](BOARD).0.encoder.timer-number  [HOSTMOT2](DPLL_TIMER_NUMBER)

#
# no-connect for 5i25 - needed by postgui/UI
newsig z-axis-brake-release bit

########################################################################
# Spindle speed control
#
# stepgen outputs the frequency it is told by tormachspindle comp
#

# type 1 velocity control mode
setp hm2_[HOSTMOT2](BOARD).0.stepgen.04.control-type 1

# step/dir
# type 2 quadrature output for 50% duty cycle
setp hm2_[HOSTMOT2](BOARD).0.stepgen.04.step_type 2

# no scaling 1:1
setp hm2_[HOSTMOT2](BOARD).0.stepgen.04.position-scale 1.0

# handle spindle at speed via separate component
setp hm2_[HOSTMOT2](BOARD).0.stepgen.04.maxaccel 0

# stepspace in nanoseconds
setp hm2_[HOSTMOT2](BOARD).0.stepgen.04.stepspace 0

# steplen in nanoseconds (10 microseconds)
setp hm2_[HOSTMOT2](BOARD).0.stepgen.04.steplen 10000

# assume standard spindle until UI sets it
setp tormachspindle.spindle-type 0

# hispeed spindle min/max
setp tormachspindle.hispeed-min 1000
setp tormachspindle.hispeed-max 24000

# 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
net spindle-hispeed-max      tormachspindle.hispeed-max

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

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

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

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

# frequencies sent to stepgen to achieve low belt speeds
#   500 Hz ->   6 Hz at VFD ->   175 RPM at spindle (770)
# 10900 Hz -> 120 Hz at VFD ->  3250 RPM at spindle (770)
#   500 Hz ->   6 Hz at VFD ->   100 RPM at spindle (1100-2-3)
# 10900 Hz -> 120 Hz at VFD ->  2000 RPM at spindle (1100-2-3)
#  1600 Hz ->                    300 RPM at spindle (1100-1)
# 10900 Hz ->                   1750 RPM at spindle (1100-1)
setp tormachspindle.lowbelt-min-mcb-freq [SPINDLE]MIN_MCB_FREQUENCY
setp tormachspindle.lowbelt-max-mcb-freq [SPINDLE]MAX_MCB_FREQUENCY

# frequencies sent to stepgen to achieve high belt speeds
#   500 Hz ->   6 Hz at VFD ->   525 RPM at spindle (770)
# 10900 Hz -> 120 Hz at VFD -> 10200 RPM at spindle (770)
#   500 Hz ->   6 Hz at VFD ->   250 RPM at spindle (1100-2-3)
# 10900 Hz -> 120 Hz at VFD ->  5140 RPM at spindle (1100-2-3)
#  1600 Hz ->                    800 RPM at spindle (1100-1)
# 10900 Hz ->                   4500 RPM at spindle (1100-1)
setp tormachspindle.highbelt-min-mcb-freq [SPINDLE]MIN_MCB_FREQUENCY
setp tormachspindle.highbelt-max-mcb-freq [SPINDLE]MAX_MCB_FREQUENCY

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

# connect motion speed-out to input of spindle comp
net spindle-speed-raw        motion.spindle-speed-out    tormachspindle.speed-in

# connect output of spindle comp to stepgen
net spindle-speed            tormachspindle.mcb-freq-out hm2_[HOSTMOT2](BOARD).0.stepgen.04.velocity-cmd

# 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

# motion.spindle-speed-in is necessary for G95 f/rev
net spindle-rps  tormachspindle.speed-out-rps  motion.spindle-speed-in

# connect motion spindle enable to stepgen enable and spindle comp
net spindle-on        motion.spindle-on        hm2_[HOSTMOT2](BOARD).0.stepgen.04.enable    tormachspindle.spindle-on

# spindle direction
# P3 pin 16 gpio 005
setp hm2_[HOSTMOT2](BOARD).0.gpio.005.is_output 1
net spindle-cw motion.spindle-forward => hm2_[HOSTMOT2](BOARD).0.gpio.005.out

# UI access to stop spindle while in feedhold / INTERP_PAUSED
net spindle-disable tormachspindle.disable

# max RPM when enclosure door open
net enc-door-open-max-rpm tormachspindle.enc-door-open-max-rpm

########################################################################

However, per the original hal file, they drive the spindle spindle using a stepgen. From what I can tell, they feed the desired rpm into tormachspindle.so, it calculates the correct steplen and stepspace for an even on/off time at the given khz requirement, and that number is fed back into stepgen to drive the spindle. (I think this is the same calc chargepump does?)

I am not 100% sure, but It looks like they might use this as a bandaid to cover an issue with their bob. (notice the frequency to rpm is non linear)

I guess I really have two questions.

Can I replicate this spindle drive method using existing hal components? (I don't want to used any of the pathpilot stuff)

If only running one spindle on the machine, is there any good reason not to just use pwm? slight loss of rpm is not the end of the world (if max pwm is 10khz instead of 10.9)
Attachments:

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

More
11 Aug 2020 22:32 #177952 by TheBigLebowski
I think I am going to take a crack at writing a hal component that excepts desired frequency as an argument and outputs the correct steplen and stepspace. It looks like I should be able to use the sincos component as a reference to build from.

That may also be useful for other reasons, say if you wanted additional pwm at varied frequencies.

If I can get that to work I will go a little more complicated, maybe input just rpm and calculate the correct frequency accounting for any scaling errors.

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

More
11 Aug 2020 22:39 #177953 by PCW
Tormach uses a VFD that takes a frequency input to set the speed
The stepgen duty cycle is fixed at 50% by using the quadrature output
mode

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

Time to create page: 0.071 seconds
Powered by Kunena Forum