|
| 1 | +# Firmware files are in /lib/firmware/hm2/7i43/ |
| 2 | +# Must symlink the hostmot2 firmware directory of sanbox to |
| 3 | +# /lib/firmware before running EMC2... |
| 4 | +# sudo ln -s $HOME/emc2-sandbox/src/hal/drivers/mesa-hostmot2/firmware /lib/firmware/hm2 |
| 5 | +# |
| 6 | +# See also: |
| 7 | +# <http://www.linuxcnc.org/docs/devel/html/man/man9/hostmot2.9.html#config%20modparam> |
| 8 | +# and http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?HostMot2 |
| 9 | +# |
| 10 | +# ##################################################################### |
| 11 | + |
| 12 | + |
| 13 | +# ****************** |
| 14 | +# Core EMC/HAL Loads |
| 15 | + |
| 16 | +# kinematics |
| 17 | +loadrt trivkins |
| 18 | + |
| 19 | +# motion controller, get name and thread periods from ini file |
| 20 | +loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES |
| 21 | + |
| 22 | +# only the 7i43 needs this, but it doesnt hurt the others |
| 23 | +# loadrt probe_parport |
| 24 | + |
| 25 | +loadrt hal_parport cfg=0x378 |
| 26 | + |
| 27 | +# hostmot2 driver |
| 28 | +loadrt hostmot2 |
| 29 | + |
| 30 | +# load low-level driver |
| 31 | +loadrt [HOSTMOT2](DRIVER) config=[HOSTMOT2](CONFIG) |
| 32 | +setp hm2_[HOSTMOT2](BOARD).0.watchdog.timeout_ns 10000000 |
| 33 | + |
| 34 | + |
| 35 | +# Torch Height Control |
| 36 | +loadrt thc |
| 37 | +addf thc servo-thread |
| 38 | + |
| 39 | +# THREADS |
| 40 | +addf hm2_[HOSTMOT2](BOARD).0.read servo-thread |
| 41 | +addf motion-command-handler servo-thread |
| 42 | +addf motion-controller servo-thread |
| 43 | +addf hm2_[HOSTMOT2](BOARD).0.write servo-thread |
| 44 | +addf hm2_[HOSTMOT2](BOARD).0.pet_watchdog servo-thread |
| 45 | +addf parport.0.read servo-thread |
| 46 | +addf parport.0.write servo-thread |
| 47 | + |
| 48 | +# ############################################# |
| 49 | +# Axis-of-motion Specific Configs (not the GUI) |
| 50 | + |
| 51 | +# ********** |
| 52 | +# X [0] Axis |
| 53 | + |
| 54 | +# axis enable chain |
| 55 | +newsig emcmot.00.enable bit |
| 56 | +sets emcmot.00.enable FALSE |
| 57 | + |
| 58 | +net emcmot.00.enable <= axis.0.amp-enable-out |
| 59 | +net emcmot.00.enable => hm2_[HOSTMOT2](BOARD).0.stepgen.00.enable |
| 60 | + |
| 61 | + |
| 62 | +# position command and feedback |
| 63 | +net emcmot.00.pos-cmd <= axis.0.motor-pos-cmd |
| 64 | +net emcmot.00.pos-cmd => hm2_[HOSTMOT2](BOARD).0.stepgen.00.position-cmd |
| 65 | + |
| 66 | +net motor.00.pos-fb <= hm2_[HOSTMOT2](BOARD).0.stepgen.00.position-fb |
| 67 | +net motor.00.pos-fb => axis.0.motor-pos-fb |
| 68 | + |
| 69 | + |
| 70 | +# timing parameters |
| 71 | +setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.dirsetup [AXIS_0]DIRSETUP |
| 72 | +setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.dirhold [AXIS_0]DIRHOLD |
| 73 | + |
| 74 | +setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.steplen [AXIS_0]STEPLEN |
| 75 | +setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.stepspace [AXIS_0]STEPSPACE |
| 76 | + |
| 77 | +setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.position-scale [AXIS_0]SCALE |
| 78 | + |
| 79 | +setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.maxvel 0 |
| 80 | +setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.maxaccel [AXIS_0]STEPGEN_MAXACCEL |
| 81 | + |
| 82 | +setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.step_type 0 |
| 83 | + |
| 84 | +net both-home-x <= parport.0.pin-10-in-not |
| 85 | +net both-home-x => axis.0.home-sw-in |
| 86 | +net both-home-x => axis.0.neg-lim-sw-in |
| 87 | +net both-home-x => axis.0.pos-lim-sw-in |
| 88 | + |
| 89 | +# ################ |
| 90 | +# Y [1] Axis |
| 91 | +# ################ |
| 92 | + |
| 93 | +# axis enable chain |
| 94 | +newsig emcmot.01.enable bit |
| 95 | +sets emcmot.01.enable FALSE |
| 96 | + |
| 97 | +net emcmot.01.enable <= axis.1.amp-enable-out |
| 98 | +net emcmot.01.enable => hm2_[HOSTMOT2](BOARD).0.stepgen.01.enable |
| 99 | + |
| 100 | + |
| 101 | +# position command and feedback |
| 102 | +net emcmot.01.pos-cmd <= axis.1.motor-pos-cmd |
| 103 | +net emcmot.01.pos-cmd => hm2_[HOSTMOT2](BOARD).0.stepgen.01.position-cmd |
| 104 | + |
| 105 | +net motor.01.pos-fb <= hm2_[HOSTMOT2](BOARD).0.stepgen.01.position-fb |
| 106 | +net motor.01.pos-fb => axis.1.motor-pos-fb |
| 107 | + |
| 108 | + |
| 109 | +# timing parameters |
| 110 | +setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.dirsetup [AXIS_1]DIRSETUP |
| 111 | +setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.dirhold [AXIS_1]DIRHOLD |
| 112 | + |
| 113 | +setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.steplen [AXIS_1]STEPLEN |
| 114 | +setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.stepspace [AXIS_1]STEPSPACE |
| 115 | + |
| 116 | +setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.position-scale [AXIS_1]SCALE |
| 117 | + |
| 118 | +setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.maxvel 0 |
| 119 | +setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.maxaccel [AXIS_1]STEPGEN_MAXACCEL |
| 120 | + |
| 121 | +setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.step_type 0 |
| 122 | + |
| 123 | +net both-home-y <= parport.0.pin-11-in-not |
| 124 | +net both-home-y => axis.1.home-sw-in |
| 125 | +net both-home-y => axis.1.neg-lim-sw-in |
| 126 | +net both-home-y => axis.1.pos-lim-sw-in |
| 127 | + |
| 128 | +# ################ |
| 129 | +# Z [2] Axis |
| 130 | +# ################ |
| 131 | + |
| 132 | +# axis enable chain |
| 133 | +newsig emcmot.02.enable bit |
| 134 | +sets emcmot.02.enable FALSE |
| 135 | + |
| 136 | +net emcmot.02.enable <= axis.2.amp-enable-out |
| 137 | +net emcmot.02.enable => hm2_[HOSTMOT2](BOARD).0.stepgen.02.enable |
| 138 | + |
| 139 | + |
| 140 | +# position command and feedback |
| 141 | +# hijack position command and feed through thc |
| 142 | +net emcmot.02.pos-cmd thc.z-pos-in <= axis.2.motor-pos-cmd |
| 143 | +net thc-pos-cmd thc.z-pos-out => hm2_[HOSTMOT2](BOARD).0.stepgen.02.position-cmd |
| 144 | +net motor.02.pos-fb axis.2.motor-pos-fb <= thc.z-fb-out |
| 145 | + |
| 146 | +net both-home-z => axis.2.home-sw-in |
| 147 | +net both-home-z => axis.2.neg-lim-sw-in |
| 148 | +net both-home-z => axis.2.pos-lim-sw-in |
| 149 | + |
| 150 | +# timing parameters |
| 151 | +setp hm2_[HOSTMOT2](BOARD).0.stepgen.02.dirsetup [AXIS_2]DIRSETUP |
| 152 | +setp hm2_[HOSTMOT2](BOARD).0.stepgen.02.dirhold [AXIS_2]DIRHOLD |
| 153 | + |
| 154 | +setp hm2_[HOSTMOT2](BOARD).0.stepgen.02.steplen [AXIS_2]STEPLEN |
| 155 | +setp hm2_[HOSTMOT2](BOARD).0.stepgen.02.stepspace [AXIS_2]STEPSPACE |
| 156 | + |
| 157 | +setp hm2_[HOSTMOT2](BOARD).0.stepgen.02.position-scale [AXIS_2]SCALE |
| 158 | + |
| 159 | +setp hm2_[HOSTMOT2](BOARD).0.stepgen.02.maxvel 0 |
| 160 | +setp hm2_[HOSTMOT2](BOARD).0.stepgen.02.maxaccel [AXIS_2]STEPGEN_MAXACCEL |
| 161 | + |
| 162 | +setp hm2_[HOSTMOT2](BOARD).0.stepgen.02.step_type 0 |
| 163 | + |
| 164 | +net both-home-z <= parport.0.pin-12-in-not |
| 165 | +net both-home-z => axis.2.home-sw-in |
| 166 | +net both-home-z => axis.2.neg-lim-sw-in |
| 167 | +net both-home-z => axis.2.pos-lim-sw-in |
| 168 | + |
| 169 | +####################### |
| 170 | +# Standard I/O Block - EStop, Etc |
| 171 | +# ############################### |
| 172 | + |
| 173 | +# create a signal for the estop loopback |
| 174 | +net estop-loop iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in |
| 175 | + |
| 176 | +# create signals for tool loading loopback |
| 177 | +net tool-prep-loop iocontrol.0.tool-prepare => iocontrol.0.tool-prepared |
| 178 | +net tool-change-loop iocontrol.0.tool-change => iocontrol.0.tool-changed |
| 179 | + |
| 180 | +# Touch Off |
| 181 | +net torch-probe motion.probe-input <= parport.0.pin-13-in-not |
| 182 | + |
| 183 | +# Set up the Encoder for the THC |
| 184 | +setp hm2_5i20.0.encoder.00.counter-mode 1 |
| 185 | +net thc-vel-in hm2_5i20.0.encoder.00.velocity => thc.encoder-vel |
| 186 | +setp thc.scale-offset 119000 |
| 187 | +setp thc.vel-scale 0.00037866834 |
| 188 | + |
| 189 | +# this might need to be increased |
| 190 | +setp thc.correction-vel 0.0001 |
| 191 | + |
| 192 | +# spindle on starts the arc |
| 193 | +net spindle-on motion.spindle-on => parport.0.pin-16-out |
| 194 | + |
| 195 | +net spindle-on thc.torch-on |
| 196 | + |
| 197 | +# starts the motion when the plasma arc has transfered to the work |
| 198 | +net start-motion-input thc.arc-ok <= motion.digital-in-00 <= parport.0.pin-15-in |
| 199 | + |
| 200 | +# ****** |
| 201 | +# For Joypad, the rest are in postgui.hal |
| 202 | +loadusr hal_input -W -KRAL Dual |
| 203 | + |
| 204 | + |
0 commit comments