Today I rewired the carousel stepper driver to the MESA hardware stepgen nr4, which was a 5min job.
Consecutively, I spent 4 hours trying to get it running again.
The stepgen in velocity mode is controlled mainly by "velocity-cmd" which takes a float value.
Positive for CW and negative for CCW.
Main problem was setting the float value with the two digital outputs ( motion.digital-out-03 & motion.digital-out-04) that are triggered for CW and CCW carousel rotation.
But in the end I solved it using MUX4:
linuxcnc.org/docs/2.4/html/man/man9/mux4.9.html
# --- (Carousel CCW / REV)
net ATC_Motor_CCW mux4.0.sel0 <= motion.digital-out-03
net ATC_Motor_CW mux4.0.sel1 <= motion.digital-out-04
net ATC_Motor_DIR_VEL hm2_7i96s.0.stepgen.04.velocity-cmd mux4.0.out
net ATC_Motor_CCW_SPD mux4.0.in1
sets ATC_Motor_CCW_SPD 5000
net ATC_Motor_CW_SPD mux4.0.in2
sets ATC_Motor_CW_SPD -5000
net ATC_Motor_OFF_SPD mux4.0.in0
sets ATC_Motor_OFF_SPD 0
net ATC_Motor_OFF2_SPD mux4.0.in3
sets ATC_Motor_OFF2_SPD 0
#*******************# ATC Stepgen#*******************
# Step Gen signals/setup
setp hm2_7i96s.0.stepgen.04.steplen 20000 # Step length (nanoseconds) 20 usec
setp hm2_7i96s.0.stepgen.04.stepspace 20000 # Step space (nanoseconds) 20 usec
setp hm2_7i96s.0.stepgen.04.maxaccel 50000 # Maximum acceleration (steps/second^2) so 1/10 second to full speed
setp hm2_7i96s.0.stepgen.04.maxvel 5000 # Maximum velocity (steps/second)
setp hm2_7i96s.0.stepgen.04.step_type 0 # Regular step type
setp hm2_7i96s.0.stepgen.04.dirsetup 50000 # Direction setup time (nanoseconds) 50 usec
setp hm2_7i96s.0.stepgen.04.dirhold 50000 # Direction hold time (nanoseconds) 00 usec
setp hm2_7i96s.0.stepgen.04.control-type 1 # Control type (1 for velocity control)
setp hm2_7i96s.0.stepgen.04.enable True # Enable the step generator initially
No more delayed response!!!