Skip to content

Instantly share code, notes, and snippets.

Created April 21, 2014 20:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/11155867 to your computer and use it in GitHub Desktop.
Save anonymous/11155867 to your computer and use it in GitHub Desktop.
#######################################
#
# HAL file for HostMot2 with 3 steppers
#
# Derived from Ted Hyde's original hm2-servo config
#
# Based up work and discussion with Seb & Peter & Jeff
# GNU license references - insert here. www.linuxcnc.org
#
#
# ########################################
# Firmware files are in /lib/firmware/hm2/7i43/
# Must symlink the hostmot2 firmware directory of sanbox to
# /lib/firmware before running EMC2...
# sudo ln -s $HOME/emc2-sandbox/src/hal/drivers/mesa-hostmot2/firmware /lib/firmware/hm2
#
# See also:
# <http://www.linuxcnc.org/docs/devel/html/man/man9/hostmot2.9.html#config%20modparam>
# and http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?HostMot2
#
# #####################################################################
# ###################################
# Core EMC/HAL Loads
# ###################################
# kinematics
loadrt trivkins
# motion controller, get name and thread periods from ini file
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
# only the 7i43 and 7i90 need this, but it doesnt hurt the others
loadrt probe_parport
loadrt epp
# hostmot2 driver
loadrt hostmot2
# load low-level driver
loadrt [HOSTMOT2](DRIVER) config=[HOSTMOT2](CONFIG)
# ################################################
# THREADS
# ################################################
addf hm2_[HOSTMOT2](BOARD).0.read servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
# revel in the free time here from not having to run PID
addf hm2_[HOSTMOT2](BOARD).0.write servo-thread
addf hm2_[HOSTMOT2](BOARD).0.pet_watchdog servo-thread
# ######################################################
# Axis-of-motion Specific Configs (not the GUI)
# ######################################################
#
# The Mesa AnyIO output pins can be in open-drain mode (drive low, float
# high) or push/pull mode (drive low, drive high).
#
# When a logical output is 1 in open-drain mode, the FPGA lets the pin
# float and it gets pulled high to +5V via a 10K resistor.
#
# When a logical output is 1 in push/pull mode, the FPGA pushes the pin
# high but only to +3.3V. This is problematic on some kinds of inputs.
#
setp hm2_[HOSTMOT2](BOARD).0.gpio.017.is_opendrain 1
setp hm2_[HOSTMOT2](BOARD).0.gpio.018.is_opendrain 1
setp hm2_[HOSTMOT2](BOARD).0.gpio.019.is_opendrain 1
setp hm2_[HOSTMOT2](BOARD).0.gpio.020.is_opendrain 1
setp hm2_[HOSTMOT2](BOARD).0.gpio.021.is_opendrain 1
setp hm2_[HOSTMOT2](BOARD).0.gpio.022.is_opendrain 1
setp hm2_[HOSTMOT2](BOARD).0.gpio.023.is_opendrain 1
#setp hm2_[HOSTMOT2](BOARD).0.gpio.048.is_opendrain 1
#setp hm2_[HOSTMOT2](BOARD).0.gpio.049.is_opendrain 1
#setp hm2_[HOSTMOT2](BOARD).0.gpio.054.is_opendrain 1
#setp hm2_[HOSTMOT2](BOARD).0.gpio.055.is_opendrain 1
#setp hm2_[HOSTMOT2](BOARD).0.gpio.060.is_opendrain 1
#setp hm2_[HOSTMOT2](BOARD).0.gpio.061.is_opendrain 1
net dout-01 <= motion.digital-out-01
net din-00 => motion.digital-in-00
net din-00 => hm2_[HOSTMOT2](BOARD).0.gpio.015.in
net dout-01 => hm2_[HOSTMOT2](BOARD).0.gpio.022.out
# ##################################################
# Standard I/O Block - EStop, Etc
# ##################################################
# create a signal for the estop loopback
net estop-loop iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment