I can't open .rar files, but the earlier HAL file has a number of issues.
There are some duplicated lines. This probably won't cause an error, but isn't right either.
The "near" component is connected to the "spindle-cmd" signal, but I don't see another "end" to that signal and the near.0.out doesn't go anywhere.
That section of the HAL probably needs to be
Code:
loadrt near
addf near.0 servo-thread
net spindle-cmd-rps => near.0.in1
net spindle-velocity-feedback-rps => near.0.in2
net spindle-at-speed near.0.out motion.spindle-at-speed
I see no sign of any attempt to allow forward/reverse control of the spindle.
Note that pwmgen type 0 will give no output for negative inputs, so you should be connecting the absolute version of the spindle command.
Code:
net net spindle-cmd-rpm-abs => pwmgen.0.value
Or, better, use pwmgen type 2, and connect the pwmgen.dir pin to an output pin to control the direction (and then you must _not_ use the absolute seed command)
Which IO pin is connected to the SPIN1x direction pin?