On Tuesday 27 December 2016 06:57:50 andy pugh wrote:

> On 27 December 2016 at 10:32, Gene Heskett <[email protected]> 
wrote:
> > HAL: ERROR: function 'estop_latch.0' not found
>
> addf estop-latch.0 servo-thread

Its there, Andy, but you snipped it. But apparently hal didn't do the 
loadrt above it. The question is why didn't it squawk on the loadrt if 
there was something wrong with it? The whole file is attached. This file 
also has a bad configuration that I inherited from the sample I 
imported, as pressing the machine enable is not resetting the 
watchdog.has_bit state. So once its fired, the only recovery is an lcnc 
restart.

But I've got to find and fix the source of the noise thats putzing with 
the spi bus, throwing data errors at me, in a time cycle of about 3 
seconds per burst of noise.

This file is horribly incomplete because I've had so many other problems 
getting the pi properly configured. I finally got x running on it 
yesterday, but the glx acceleration is still bailing out.

Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>
# #######################################
# hm2-7i90-stepper.hal  12.27.2016 05:05:38
# HAL file for HostMot2 with 2 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/7i90/
# 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
# But there is not a emc2-sandbox in my hoime directory, so all this is bullshit
# 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 [KINS]KINEMATICS

# motion controller, get name and thread periods from ini file
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD 
num_joints=[KINS]JOINTS

# hostmot2 driver
loadrt hostmot2

# load low-level driver
loadrt  [HOSTMOT2](DRIVER) config=[HOSTMOT2](CONFIG)

# load estop latch component
loadrt  estop_latch count=2
loadrt  limit3  names=spindle-accel-ramp
loadrt  abs names=spindle-abs
# ################################################
# THREADS
# ################################################

addf    hm2_[HOSTMOT2](BOARD).0.read                    servo-thread
addf    motion-command-handler                          servo-thread
addf    spindle-abs                                                             
servo-thread
addf    spindle-accel-ramp                                              
servo-thread
addf    motion-controller                               servo-thread
addf    estop_latch.0                                   servo-thread

# revel in the free time here from not having to run PID's 
# every bit of the processing MUST BE DONE
# between the above read, and the below write.

addf hm2_[HOSTMOT2](BOARD).0.write                      servo-thread

# ######################################################
# Axis-of-motion Specific Configs (not the GUI)
# ######################################################


# ################
# X [0] Axis
# ################

# axis enable chain
newsig emcmot.00.enable bit
sets emcmot.00.enable FALSE

net emcmot.00.enable <= joint.0.amp-enable-out 
net emcmot.00.enable => hm2_[HOSTMOT2](BOARD).0.stepgen.00.enable


# position command and feedback
net emcmot.00.pos-cmd <= joint.0.motor-pos-cmd
net emcmot.00.pos-cmd => hm2_[HOSTMOT2](BOARD).0.stepgen.00.position-cmd

net motor.00.pos-fb <= hm2_[HOSTMOT2](BOARD).0.stepgen.00.position-fb
net motor.00.pos-fb => joint.0.motor-pos-fb


# timing parameters
setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.dirsetup        [JOINT_0]DIRSETUP
setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.dirhold         [JOINT_0]DIRHOLD

setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.steplen         [JOINT_0]STEPLEN
setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.stepspace       [JOINT_0]STEPSPACE

setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.position-scale  [JOINT_0]SCALE

setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.maxvel          [JOINT_0]STEPGEN_MAX_VEL
setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.maxaccel        [JOINT_0]STEPGEN_MAX_ACC

setp hm2_[HOSTMOT2](BOARD).0.stepgen.00.step_type       0


# ################
# Z [1] Axis
# ################

# axis enable chain
newsig emcmot.01.enable bit
sets emcmot.01.enable FALSE

net emcmot.01.enable <= joint.1.amp-enable-out 
net emcmot.01.enable => hm2_[HOSTMOT2](BOARD).0.stepgen.01.enable


# position command and feedback
net emcmot.01.pos-cmd <= joint.1.motor-pos-cmd
net emcmot.01.pos-cmd => hm2_[HOSTMOT2](BOARD).0.stepgen.01.position-cmd

net motor.01.pos-fb <= hm2_[HOSTMOT2](BOARD).0.stepgen.01.position-fb
net motor.01.pos-fb => joint.1.motor-pos-fb


# timing parameters
setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.dirsetup        [JOINT_1]DIRSETUP
setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.dirhold         [JOINT_1]DIRHOLD

setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.steplen         [JOINT_1]STEPLEN
setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.stepspace       [JOINT_1]STEPSPACE

setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.position-scale  [JOINT_1]SCALE

setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.maxvel          [JOINT_1]STEPGEN_MAX_VEL
setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.maxaccel        [JOINT_1]STEPGEN_MAX_ACC

setp hm2_[HOSTMOT2](BOARD).0.stepgen.01.step_type       0
 

#################################################################################
# Setup vfd drive enable yadda yadda, building down from top down forward first 
#
# The SpinX1 only needs pwm and dir I think, but might need an ena(ble)
#################################################################################
# start with SpinX1's dir
setp hm2_[HOSTMOT2](BOARD).0.gpio.071.is_output 1
setp hm2_[HOSTMOT2](BOARD).0.gpio.071.invert_output 1
setp hm2_[HOSTMOT2](BOARD).0.gpio.071.is_opendrain 1
# is now dir on P3-47 Not used, move jumpers as its all done in the SpinX1
net reverse_vfd <= motion.spindle-reverse => 
hm2_[HOSTMOT2](BOARD).0.gpio.071.out

##################################
# and the spinX1 needs an enable #
##################################
setp hm2_[HOSTMOT2](BOARD).0.gpio.070.is_output 1
setp hm2_[HOSTMOT2](BOARD).0.gpio.070.invert_output 1
setp hm2_[HOSTMOT2](BOARD).0.gpio.070.is_opendrain 1
# net line moved to combined with enable_vfd below

#######################################
# Hook pwmgen.00 to the spindle speed #
#######################################
setp   hm2_[HOSTMOT2](BOARD).0.pwmgen.00.scale      [SPINDLE_9]PWMGEN_S_SCALE
# no scale loaded atm setp   scale.s_scale.gain     [SPINDLE_9]PWMGEN_S_SCALE
# This is P1-41 and I need a scale module here I expect
setp   hm2_[HOSTMOT2](BOARD).0.pwmgen.pwm_frequency [SPINDLE_9]PWMGEN_S_FREQ

###########################################################
# make vfd pwm drive unidirectional, fwd/rev handles that #
###########################################################
setp spindle-accel-ramp.maxv    [SPINDLE_9]MAXV
setp spindle-accel-ramp.maxa    [SPINDLE_9]MAXA
net spindle-vel-cmd-rps        <=  motion.spindle-speed-out-rps => 
spindle-accel-ramp.in
net spindle-accell <= spindle-accel-ramp.out => spindle-abs.in 
net spindle-unispeed <= spindle-abs.out =>      
hm2_[HOSTMOT2](BOARD).0.pwmgen.00.value

# needed, dunno
# P3-45 now, move connection
net enable_vfd  <= motion.spindle-on => 
hm2_[HOSTMOT2](BOARD).0.pwmgen.00.enable hm2_[HOSTMOT2](BOARD).0.gpio.070.out


# ##################################################
# Standard I/O Block - EStop, Etc
# ##################################################
setp estop_latch.0.ok-in true
# A basic estop loop that only includes the hostmot watchdog.
net user-enable         <=      iocontrol.0.user-request-enable         =>      
estop-latch.0.reset
net enable-latch        <=      estop-latch.0.ok-out                            
=>      iocontrol.0.emc-enable-in
net watchdog            <=      hm2_[HOSTMOT2](BOARD).0.watchdog.has_bit =>     
estop-latch.0.fault-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

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to