I just rewrote the hal leaving out the gear change to bring it back to basics still a no go here's what I have now.
#****************
# Spindle Control
#****************
setp hm2_5i20.0.pwmgen.04.output-type 2
setp hm2_5i20.0.pwmgen.04.scale 3530 # Set the spindle’s top speed in RPM
#****************************
# Spindle Synchronized Motion
#****************************
# add the encoder
setp hm2_5i20.0.encoder.04.counter-mode 0
setp hm2_5i20.0.encoder.04.filter 0
setp hm2_5i20.0.encoder.04.index-invert 0
setp hm2_5i20.0.encoder.04.index-mask 0
setp hm2_5i20.0.encoder.04.scale 8000
net spindle-position hm2_5i20.0.encoder.04.position => motion.spindle-revs
net spindle-velocity hm2_5i20.0.encoder.04.velocity => motion.spindle-speed-in
net spindle-index-enable hm2_5i20.0.encoder.04.index-enable <=> motion.spindle-index-enable
net spindle-cw <= motion.spindle-forward
net spindle-ccw <= motion.spindle-reverse
net spindle-enable hm2_5i20.0.gpio.071.out <= motion.spindle-on hm2_5i20.0.gpio.045.out
net spindle-enable => hm2_5i20.0.pwmgen.04.enable
#*****************
# Spindle At Speed
#*****************
addf near.0 servo-thread
setp near.0.scale 1.01
net spindle-cmd => near.0.in1
net spindle-velocity => near.0.in2
net spindle-at-speed motion.spindle-at-speed <= near.0.out
#*********
#RPM Scale
#*********
setp rpm-scale scale.0.gain 60
net spindle-rps scale.0.in hm2_5i20.0.encoder.04.velocity