I'm trying to get bldc init to run off machine on
rather than just once when I start axis and
reset estop the first time.  My current hal
configuration ties bldc.0.init to iocontrol.0.user-enable-out
and bldc.0.init-done to iocontrol.0.emc-enable-in,
which may have been what pncconf suggested.
I would also like to have hm2_7i43.0.3pwmgen.03.enable
be enabled and disabled from machine on/off.

I've tried, without success, connecting bldc.0.init to
halui.machine.is-on.  Any other suggestions?

Thanks,
-- Ralph

Complete hal file is below:

loadrt trivkins
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD 
num_joints=[TRAJ]AXES
loadrt probe_parport
loadrt hostmot2
loadrt hm2_7i43 config="firmware=hm2/7i43-4/TPEN4_5.BIT num_encoders=2 
num_pwmgens=0 num_3pwmgens=4 num_stepgens=0"
setp     hm2_7i43.0.3pwmgen.frequency   20000
setp     hm2_7i43.0.watchdog.timeout_ns 10000000

loadrt pid names=pid.0
loadrt bldc cfg=q

addf hm2_7i43.0.read            servo-thread
addf motion-command-handler     servo-thread
addf motion-controller          servo-thread
addf pid.0.do-pid-calcs         servo-thread
addf bldc.0                     servo-thread
addf hm2_7i43.0.write           servo-thread
addf hm2_7i43.0.pet_watchdog    servo-thread

#*******************
#  AXIS X
#*******************

# -- BLDC setup --
setp   bldc.0.drive-offset      0
setp   bldc.0.rev               0
# scale is (3.0in / 2poles) x 25.4mm/in x 512cnt/mm = 19507
setp   bldc.0.scale             19507
setp   bldc.0.poles             2
setp   bldc.0.initvalue         5
net 0-a-value       bldc.0.A-value => hm2_7i43.0.3pwmgen.03.A-value
net 0-b-value       bldc.0.B-value => hm2_7i43.0.3pwmgen.03.B-value
net 0-c-value       bldc.0.C-value => hm2_7i43.0.3pwmgen.03.C-value

# ---Encoder feedback signals/setup---
setp    hm2_7i43.0.encoder.00.counter-mode 0
setp    hm2_7i43.0.encoder.00.filter 1
setp    hm2_7i43.0.encoder.00.index-invert 0
setp    hm2_7i43.0.encoder.00.index-mask 0
setp    hm2_7i43.0.encoder.00.index-mask-invert 0
setp    hm2_7i43.0.encoder.00.scale  [AXIS_0]ENCODER_SCALE
setp    hm2_7i43.0.gpio.030.is_output 1

setp   pid.0.Pgain     [AXIS_0]P
setp   pid.0.Igain     [AXIS_0]I
setp   pid.0.Dgain     [AXIS_0]D
setp   pid.0.bias      [AXIS_0]BIAS
setp   pid.0.FF0       [AXIS_0]FF0
setp   pid.0.FF1       [AXIS_0]FF1
setp   pid.0.FF2       [AXIS_0]FF2
setp   pid.0.deadband  [AXIS_0]DEADBAND
setp   pid.0.maxoutput [AXIS_0]MAX_OUTPUT

net 0-output  pid.0.output          => bldc.0.value
net 0-pos-cmd axis.0.motor-pos-cmd  => pid.0.command
net 0-vel-fb  hm2_7i43.0.encoder.00.velocity  => pid.0.feedback-deriv
net 0-pos-fb  hm2_7i43.0.encoder.00.position  => axis.0.motor-pos-fb 
pid.0.feedback
net 0-pos-rawcounts hm2_7i43.0.encoder.00.rawcounts => bldc.0.rawcounts

# ---3PWM Generator signals/setup---
setp hm2_7i43.0.3pwmgen.03.scale 10
setp hm2_7i43.0.3pwmgen.03.fault-invert 0
setp hm2_7i43.0.3pwmgen.03.deadtime 200
setp hm2_7i43.0.gpio.046.invert_output 1 # invert enable signal

#******************************
# connect miscellaneous signals
#******************************
#  ---HALUI signals---

net machine-is-on         halui.machine.is-on pid.0.enable

#  ---motion control signals---

net in-position               <=  motion.in-position
net machine-is-enabled        <=  motion.motion-enabled

#  ---estop signals---

net estop-out  iocontrol.0.user-enable-out bldc.0.init 
hm2_7i43.0.3pwmgen.03.enable
net all-are-init  bldc.0.init-done => iocontrol.0.emc-enable-in 

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to