Advertisement
Guest User

Untitled

a guest
Jun 10th, 2012
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.44 KB | None | 0 0
  1. # #######################################
  2. #
  3. # HAL file for HostMot2 with 3 steppers
  4. #
  5. # Derived from Ted Hyde's original hm2-servo config
  6. #
  7. # Based up work and discussion with Seb & Peter & Jeff
  8. # GNU license references - insert here. www.linuxcnc.org
  9. #
  10. #
  11. # ########################################
  12. # Firmware files are in /lib/firmware/hm2/7i43/
  13. # Must symlink the hostmot2 firmware directory of sanbox to
  14. # /lib/firmware before running EMC2...
  15. # sudo ln -s $HOME/emc2-sandbox/src/hal/drivers/mesa-hostmot2/firmware /lib/firmware/hm2
  16. #
  17. # See also:
  18. # <http://www.linuxcnc.org/docs/devel/html/man/man9/hostmot2.9.html#config%20modparam>
  19. # and http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?HostMot2
  20. #
  21. # #####################################################################
  22.  
  23.  
  24. # ###################################
  25. # Core EMC/HAL Loads
  26. # ###################################
  27.  
  28. # kinematics
  29. loadrt trivkins
  30.  
  31. # motion controller, get name and thread periods from ini file
  32. loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
  33.  
  34. # only the 7i43 needs this, but it doesnt hurt the others
  35. # loadrt probe_parport
  36.  
  37. # hostmot2 driver
  38. loadrt hostmot2
  39.  
  40. # load low-level driver
  41. loadrt [HOSTMOT2](DRIVER) config=[HOSTMOT2](CONFIG)
  42.  
  43. setp hm2_[HOSTMOT2](BOARD).0.watchdog.timeout_ns 10000000
  44.  
  45.  
  46. # ################################################
  47. # THREADS
  48. # ################################################
  49.  
  50. addf hm2_[HOSTMOT2](BOARD).0.read servo-thread
  51. addf motion-command-handler servo-thread
  52. addf motion-controller servo-thread
  53. addf hm2_[HOSTMOT2](BOARD).0.write servo-thread
  54. addf hm2_[HOSTMOT2](BOARD).0.pet_watchdog servo-thread
  55.  
  56.  
  57. # ######################################################
  58. # Axis-of-motion Specific Configs (not the GUI)
  59. # ######################################################
  60.  
  61.  
  62. # ################
  63. # X [0] Axis
  64. # ################
  65.  
  66. # axis enable chain
  67. newsig emcmot.00.enable bit
  68. sets emcmot.00.enable FALSE
  69.  
  70. net emcmot.00.enable <= axis.0.amp-enable-out
  71. net emcmot.00.enable => hm2_[HOSTMOT2](BOARD).0.stepgen.00.enable
  72.  
  73.  
  74. # position command and feedback
  75. net emcmot.00.pos-cmd <= axis.0.motor-pos-cmd
  76. net emcmot.00.pos-cmd => hm2_[HOSTMOT2](BOARD).0.stepgen.00.position-cmd
  77.  
  78. net motor.00.pos-fb <= hm2_[HOSTMOT2](BOARD).0.stepgen.00.position-fb
  79. net motor.00.pos-fb => axis.0.motor-pos-fb
  80.  
  81.  
  82. # timing parameters
  83. setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.dirsetup [AXIS_0]DIRSETUP
  84. setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.dirhold [AXIS_0]DIRHOLD
  85.  
  86. setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.steplen [AXIS_0]STEPLEN
  87. setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.stepspace [AXIS_0]STEPSPACE
  88.  
  89. setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.position-scale [AXIS_0]SCALE
  90.  
  91. setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.maxvel [AXIS_0]STEPGEN_MAX_VEL
  92. setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.maxaccel [AXIS_0]STEPGEN_MAX_ACC
  93.  
  94. setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.step_type 0
  95.  
  96.  
  97. # ################
  98. # Y [1] Axis
  99. # ################
  100.  
  101. # axis enable chain
  102. newsig emcmot.01.enable bit
  103. sets emcmot.01.enable FALSE
  104.  
  105. net emcmot.01.enable <= axis.1.amp-enable-out
  106. net emcmot.01.enable => hm2_[HOSTMOT2](BOARD).0.stepgen.01.enable
  107.  
  108.  
  109. # position command and feedback
  110. net emcmot.01.pos-cmd <= axis.1.motor-pos-cmd
  111. net emcmot.01.pos-cmd => hm2_[HOSTMOT2](BOARD).0.stepgen.01.position-cmd
  112.  
  113. net motor.01.pos-fb <= hm2_[HOSTMOT2](BOARD).0.stepgen.01.position-fb
  114. net motor.01.pos-fb => axis.1.motor-pos-fb
  115.  
  116.  
  117. # timing parameters
  118. setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.dirsetup [AXIS_1]DIRSETUP
  119. setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.dirhold [AXIS_1]DIRHOLD
  120.  
  121. setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.steplen [AXIS_1]STEPLEN
  122. setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.stepspace [AXIS_1]STEPSPACE
  123.  
  124. setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.position-scale [AXIS_1]SCALE
  125.  
  126. setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.maxvel [AXIS_1]STEPGEN_MAX_VEL
  127. setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.maxaccel [AXIS_1]STEPGEN_MAX_ACC
  128.  
  129. setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.step_type 0
  130.  
  131.  
  132. # ################
  133. # Z [2] Axis
  134. # ################
  135.  
  136. # axis enable chain
  137. newsig emcmot.02.enable bit
  138. sets emcmot.02.enable FALSE
  139.  
  140. net emcmot.02.enable <= axis.2.amp-enable-out
  141. net emcmot.02.enable => hm2_[HOSTMOT2](BOARD).0.stepgen.02.enable
  142.  
  143.  
  144. # position command and feedback
  145. net emcmot.02.pos-cmd <= axis.2.motor-pos-cmd
  146. net emcmot.02.pos-cmd => hm2_[HOSTMOT2](BOARD).0.stepgen.02.position-cmd
  147.  
  148. net motor.02.pos-fb <= hm2_[HOSTMOT2](BOARD).0.stepgen.02.position-fb
  149. net motor.02.pos-fb => axis.2.motor-pos-fb
  150.  
  151.  
  152. # timing parameters
  153. setp hm2_[HOSTMOT2](BOARD).0.stepgen.02.dirsetup [AXIS_2]DIRSETUP
  154. setp hm2_[HOSTMOT2](BOARD).0.stepgen.02.dirhold [AXIS_2]DIRHOLD
  155.  
  156. setp hm2_[HOSTMOT2](BOARD).0.stepgen.02.steplen [AXIS_2]STEPLEN
  157. setp hm2_[HOSTMOT2](BOARD).0.stepgen.02.stepspace [AXIS_2]STEPSPACE
  158.  
  159. setp hm2_[HOSTMOT2](BOARD).0.stepgen.02.position-scale [AXIS_2]SCALE
  160.  
  161. setp hm2_[HOSTMOT2](BOARD).0.stepgen.02.maxvel [AXIS_2]STEPGEN_MAX_VEL
  162. setp hm2_[HOSTMOT2](BOARD).0.stepgen.02.maxaccel [AXIS_2]STEPGEN_MAX_ACC
  163.  
  164. setp hm2_[HOSTMOT2](BOARD).0.stepgen.02.step_type 0
  165.  
  166.  
  167.  
  168.  
  169. #
  170. # The Mesa AnyIO output pins can be in open-drain mode (drive low, float
  171. # high) or push/pull mode (drive low, drive high).
  172. #
  173. # When a logical output is 1 in open-drain mode, the FPGA lets the pin
  174. # float and it gets pulled high to +5V via a 10K resistor.
  175. #
  176. # When a logical output is 1 in push/pull mode, the FPGA pushes the pin
  177. # high but only to +3.3V. This is problematic on some kinds of inputs.
  178. #
  179.  
  180. #setp hm2_[HOSTMOT2](BOARD).0.gpio.048.is_opendrain 1
  181. #setp hm2_[HOSTMOT2](BOARD).0.gpio.049.is_opendrain 1
  182.  
  183. #setp hm2_[HOSTMOT2](BOARD).0.gpio.054.is_opendrain 1
  184. #setp hm2_[HOSTMOT2](BOARD).0.gpio.055.is_opendrain 1
  185.  
  186. #setp hm2_[HOSTMOT2](BOARD).0.gpio.060.is_opendrain 1
  187. #setp hm2_[HOSTMOT2](BOARD).0.gpio.061.is_opendrain 1
  188.  
  189.  
  190.  
  191.  
  192. # ##################################################
  193. # Standard I/O Block - EStop, Etc
  194. # ##################################################
  195.  
  196. # create a signal for the estop loopback
  197. net estop-loop iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in
  198.  
  199. # create signals for tool loading loopback
  200. net tool-prep-loop iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
  201. net tool-change-loop iocontrol.0.tool-change => iocontrol.0.tool-changed
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement