# This file was created with the Mesa Configuration Tool on Jan 02 2025 15:29:08 # If you make changes to this file DO NOT run the configuration tool again! # This file will be replaced with a new file if you do! # kinematics loadrt [KINS](KINEMATICS) # motion controller loadrt [EMCMOT](EMCMOT) servo_period_nsec=[EMCMOT](SERVO_PERIOD) num_joints=[KINS](JOINTS) num_dio=6 num_aio=3 # hostmot2 driver loadrt hostmot2 loadrt [HM2](DRIVER) board_ip=[HM2](ADDRESS) config="num_encoders=1 num_pwmgens=1 num_stepgens=5 sserial_port_0=00000000" setp hm2_[MESA](BOARD).0.watchdog.timeout_ns 5000000 loadrt pid names=pid.x,pid.z,pid.s #For Spindle Encoder loadrt near # PID Information for Stepper Boards # Mesa hardware step generators at every servo thread invocation, the step # generator hardware is given a new velocity. Without feedback from the PID # controller the hardware position would slowly drift because of clock speed and # timing differences between LinuxCNC and the step generator hardware. # The PID controller gets feedback from the actual (fractional) step position and # corrects for these small differences. # THREADS addf hm2_[MESA](BOARD).0.read servo-thread addf motion-command-handler servo-thread addf motion-controller servo-thread addf pid.x.do-pid-calcs servo-thread addf pid.z.do-pid-calcs servo-thread addf pid.s.do-pid-calcs servo-thread addf hm2_[MESA](BOARD).0.write servo-thread # DPLL TIMER setp hm2_[MESA](BOARD).0.dpll.01.timer-us -50 setp hm2_[MESA](BOARD).0.stepgen.timer-number 1 # amp enable net motion-enable <= motion.motion-enabled # Board: 7i96s # Axis: X Joint: 0 Output: 0 # PID Setup setp pid.x.Pgain [JOINT_0](P) setp pid.x.Igain [JOINT_0](I) setp pid.x.Dgain [JOINT_0](D) setp pid.x.bias [JOINT_0](BIAS) setp pid.x.FF0 [JOINT_0](FF0) setp pid.x.FF1 [JOINT_0](FF1) setp pid.x.FF2 [JOINT_0](FF2) setp pid.x.deadband [JOINT_0](DEADBAND) setp pid.x.maxoutput [JOINT_0](MAX_OUTPUT) setp pid.x.error-previous-target True # limit stepgen velocity corrections caused by position feedback jitter setp pid.x.maxerror [JOINT_0](MAX_ERROR) # joint-0 enable chain net joint-0-index-enable <=> pid.x.index-enable net joint-0-index-enable <=> joint.0.index-enable net joint-0-enable <= joint.0.amp-enable-out net joint-0-enable => pid.x.enable net joint-0-enable => hm2_[MESA](BOARD).0.stepgen.00.enable # Joint 0 Step Generator Settings setp hm2_[MESA](BOARD).0.stepgen.00.dirsetup [JOINT_0](DIRSETUP) setp hm2_[MESA](BOARD).0.stepgen.00.dirhold [JOINT_0](DIRHOLD) setp hm2_[MESA](BOARD).0.stepgen.00.steplen [JOINT_0](STEPLEN) setp hm2_[MESA](BOARD).0.stepgen.00.stepspace [JOINT_0](STEPSPACE) setp hm2_[MESA](BOARD).0.stepgen.00.position-scale [JOINT_0](SCALE) setp hm2_[MESA](BOARD).0.stepgen.00.maxvel [JOINT_0](STEPGEN_MAX_VEL) setp hm2_[MESA](BOARD).0.stepgen.00.maxaccel [JOINT_0](STEPGEN_MAX_ACC) setp hm2_[MESA](BOARD).0.stepgen.00.step_type 0 setp hm2_[MESA](BOARD).0.stepgen.00.control-type 1 # position command and feedback net joint-0-pos-cmd <= joint.0.motor-pos-cmd net joint-0-pos-cmd => pid.x.command net joint-0-pos-fb <= hm2_[MESA](BOARD).0.stepgen.00.position-fb net joint-0-pos-fb => joint.0.motor-pos-fb net joint-0-pos-fb => pid.x.feedback # PID Output net joint.0.output <= pid.x.output net joint.0.output => hm2_[MESA](BOARD).0.stepgen.00.velocity-cmd # Axis: Z Joint: 1 Output: 1 # PID Setup setp pid.z.Pgain [JOINT_1](P) setp pid.z.Igain [JOINT_1](I) setp pid.z.Dgain [JOINT_1](D) setp pid.z.bias [JOINT_1](BIAS) setp pid.z.FF0 [JOINT_1](FF0) setp pid.z.FF1 [JOINT_1](FF1) setp pid.z.FF2 [JOINT_1](FF2) setp pid.z.deadband [JOINT_1](DEADBAND) setp pid.z.maxoutput [JOINT_1](MAX_OUTPUT) setp pid.z.error-previous-target True # limit stepgen velocity corrections caused by position feedback jitter setp pid.z.maxerror [JOINT_1](MAX_ERROR) # joint-1 enable chain net joint-1-index-enable <=> pid.z.index-enable net joint-1-index-enable <=> joint.1.index-enable net joint-1-enable <= joint.1.amp-enable-out net joint-1-enable => pid.z.enable net joint-1-enable => hm2_[MESA](BOARD).0.stepgen.01.enable # Joint 1 Step Generator Settings setp hm2_[MESA](BOARD).0.stepgen.01.dirsetup [JOINT_1](DIRSETUP) setp hm2_[MESA](BOARD).0.stepgen.01.dirhold [JOINT_1](DIRHOLD) setp hm2_[MESA](BOARD).0.stepgen.01.steplen [JOINT_1](STEPLEN) setp hm2_[MESA](BOARD).0.stepgen.01.stepspace [JOINT_1](STEPSPACE) setp hm2_[MESA](BOARD).0.stepgen.01.position-scale [JOINT_1](SCALE) setp hm2_[MESA](BOARD).0.stepgen.01.maxvel [JOINT_1](STEPGEN_MAX_VEL) setp hm2_[MESA](BOARD).0.stepgen.01.maxaccel [JOINT_1](STEPGEN_MAX_ACC) setp hm2_[MESA](BOARD).0.stepgen.01.step_type 0 setp hm2_[MESA](BOARD).0.stepgen.01.control-type 1 # position command and feedback net joint-1-pos-cmd <= joint.1.motor-pos-cmd net joint-1-pos-cmd => pid.z.command net joint-1-pos-fb <= hm2_[MESA](BOARD).0.stepgen.01.position-fb net joint-1-pos-fb => joint.1.motor-pos-fb net joint-1-pos-fb => pid.z.feedback # PID Output net joint.1.output <= pid.z.output net joint.1.output => hm2_[MESA](BOARD).0.stepgen.01.velocity-cmd # Spindle PID Setup setp pid.s.Pgain [SPINDLE_0](P) setp pid.s.Igain [SPINDLE_0](I) setp pid.s.Dgain [SPINDLE_0](D) setp pid.s.bias [SPINDLE_0](BIAS) setp pid.s.FF0 [SPINDLE_0](FF0) setp pid.s.FF1 [SPINDLE_0](FF1) setp pid.s.FF2 [SPINDLE_0](FF2) setp pid.s.deadband [SPINDLE_0](DEADBAND) setp pid.s.maxoutput [SPINDLE_0](MAX_OUTPUT) setp pid.s.error-previous-target true # Spindle PWM Setup setp hm2_[MESA](BOARD).0.pwmgen.00.output-type [SPINDLE_0](PWM_TYPE) setp hm2_[MESA](BOARD).0.pwmgen.pwm_frequency [SPINDLE_0](PWM_FREQUENCY) setp hm2_[MESA](BOARD).0.pwmgen.00.scale [SPINDLE_0]MAX_OUTPUT # Spindle Enable net spindle-on <= spindle.0.on net spindle-on => pid.s.enable net spindle-on => hm2_[MESA](BOARD).0.pwmgen.00.enable # Spindle Connections net spindle-vel-cmd <= spindle.0.speed-out-abs net spindle-vel-cmd => pid.s.command net spindle-pid-out <= pid.s.output net spindle-pid-out => hm2_[MESA](BOARD).0.pwmgen.00.value # Spindle Feedback setp spindle.0.at-speed true # ---Encoder feedback signals/setup--- setp hm2_7i96s.0.encoder.00.counter-mode 0 setp hm2_7i96s.0.encoder.00.filter 1 setp hm2_7i96s.0.encoder.00.index-invert 0 setp hm2_7i96s.0.encoder.00.index-mask 0 setp hm2_7i96s.0.encoder.00.index-mask-invert 0 setp hm2_7i96s.0.encoder.00.scale [SPINDLE_0]SCALE net spindle-revs <= hm2_7i96s.0.encoder.00.position net spindle-vel-fb-rps <= hm2_7i96s.0.encoder.00.velocity net spindle-index-enable <=> hm2_7i96s.0.encoder.00.index-enable # create signals for tool loading loopback net tool-prep-loop iocontrol.0.tool-prepare => iocontrol.0.tool-prepared net tool-change-loop iocontrol.0.tool-change => iocontrol.0.tool-changed