Spindle direction signal when stopped

More
08 Apr 2021 04:25 #205306 by rafferty
Just about completed a hardware project that gives PathPilot (V1) control of spindle RPM and direction of a SiegSX3 mill.

A limitation of the mill internal software is that the spindle direction can only be changed when the spindle is rotating. What this means is that when the spindle starts it always runs in the direction it was previously then changes direction if required. Not much of a limitation in practice as I can't remember ever running the spindle in reverse.

Not much of a limitation apart from one thing...

Under PathPilot control when the spindle is running forward and is then stopped, the direction line, a gpio out of a 5i25 card, goes from high to low which is a change from forward to reverse, Next press of the PathPilot FWD button sets the line high, forward again.

My hardware faithfully follows the direction line, the spindle starts forward, switches to reverse for a few rotations then back to forward and runs up to speed. I can probably fix my software to eliminate this with a few lines of C but setting direction line to reverse when stopped seems a bit odd.

I can't see where this is happening in PathPilot (I may have missed it) so is it happening LinuxCNC and if it is is it by design?

Is there anyone with a more knowledge of PathPilot and LinuxCNC than I have (which is not much) shed any light on the direction line behaviour?

Ken.

Please Log in or Create an account to join the conversation.

More
09 Apr 2021 10:02 #205412 by andypugh
I would generally anticipate DIR = 1 to be reverse. I suspect that this might be an assumption somewhere in the code. ie spindle-on S=0 has dir = 0.

Can you attach the HAL?

Please Log in or Create an account to join the conversation.

More
09 Apr 2021 13:43 #205431 by Vmax549
I can test that for you if you can tell me what you want to know. I am still in test mode with PP. I can run Halmeter while running PP.

(;-) TP

Please Log in or Create an account to join the conversation.

More
09 Apr 2021 13:47 #205432 by rafferty

I would generally anticipate DIR = 1 to be reverse. I suspect that this might be an assumption somewhere in the code. ie spindle-on S=0 has dir = 0.

I understand that as a logical assumption.

One thing has just occurred to me, my assumption that the inactive state of motion.spindle-forward implies reverse is wrong. It means spindle is not running forward, motion.spindle-reverse being active is spindle reverse. Either can be active or both can be inactive.

Can you attach the HAL?

The HAL I use is standard PathPilot V1.9.3 unchanged, I won't attach it all given I think I now understand whats going on. The only relevant part is two lines:
# spindle direction
# P3 pin 16 gpio 005
setp hm2_5i25.0.gpio.005.is_output 1
net spindle-cw motion.spindle-forward => hm2_5i25.0.gpio.005.out
I'll have a poke around and look at both motion.spindle-forward and reverse and if I find the above to true it's a easy HAL fix.

Thanks, Ken.

Please Log in or Create an account to join the conversation.

More
09 Apr 2021 13:58 #205434 by rafferty

I can test that for you if you can tell me what you want to know. I am still in test mode with PP. I can run Halmeter while running PP.
(;-) TP


That's very kind of you.

If you can look at the states of motion.spindle-forward and motion.spindle-reverse in the three spindle states, stopped, running forward and running reverse it may confirm the way it works..

I can run the hal monitoring tools myself but by the time I rediscover how to use them again you will most likely have it done.

Thanks for the offer of assistance,

Ken.

Please Log in or Create an account to join the conversation.

More
09 Apr 2021 15:03 #205439 by Vmax549
stop - For = false Rev = false
forward - For = true Rev = false
reverse - For = false Rev = true

Direction pin

stop = false
forward = true
reverse = false

Transition from forward to stop changes Dirpin = false
Transition from Reverse to stop changes Dirpin = false

Hope that helps, (;-) TP

Please Log in or Create an account to join the conversation.

More
10 Apr 2021 22:55 #205586 by rafferty
Thanks for that TP.

Early this morning (its not 9AM yet) I fired up halshow in a terminal with PP running on another screen and got the same results. I was expecting some 'opposition' from the hal tools but I must have setup this install already.

My plan is to use a set/reset flipflop to latch the motion.spindle-forward and reverse signals and use the f/f output to drive the direction line, that way the direction out will only change when a different motion.spindle signal comes active to what was last active.

Of course PP1 doesn't have the flipflop component so thats next.

Thanks all, Ken.

Please Log in or Create an account to join the conversation.

More
12 Apr 2021 10:19 #205713 by rafferty
Completed my spindle mod and fixed the problem.

# spindle direction
# P3 pin 16 gpio 005
setp hm2_5i25.0.gpio.005.is_output 1
# net spindle-cw motion.spindle-forward => hm2_5i25.0.gpio.005.out
net spindle-cw  motion.spindle-forward => last-spindle-direction-latch.reset
net spindle-ccw motion.spindle-reverse => last-spindle-direction-latch.set
net spindle-dir-latched last-spindle-direction-latch.out => last-spindle-direction-invert.in
net spindle-motion-dir last-spindle-direction-invert.out => hm2_5i25.0.gpio.005.out

I had to reverse the forward and reverse signals setting and resetting the flipflop, as the f/f comes up reset it would have defaulted to reverse. This needs an inversion to get the direction correct, be nice if the ff had an inverted out.

I notice the flipflop output is an 'io' pin not an 'out', does this mean I could preset the output with something like
setp last-spindle-direction-latch.out 1
and go back to plan A without the inversion? Or does this permanently set the ff out to 1, never to change again?

Ken

Please Log in or Create an account to join the conversation.

More
12 Apr 2021 18:41 #205728 by andypugh

I notice the flipflop output is an 'io' pin not an 'out', does this mean I could preset the output with something like
setp last-spindle-direction-latch.out 1


That might explain why it is an IO pin.
It will hold the setp value until the first clock pulse.
(tested)

Note that flipflop does now have an inverted output pin. You wouldn't see that until the next release, but if you want to use the new version early, save the attached file and install with "sudo halcompile --install flipflop.comp"
Attachments:

Please Log in or Create an account to join the conversation.

More
12 Apr 2021 20:22 #205734 by rafferty

Note that flipflop does now have an inverted output pin.

Good, I was going to start a campaign.

It will hold the setp value until the first clock pulse.

Looks like the inverted out will also respect the set/reset ins if not clocked.

The new inverted pin is also 'io'. Does this mean the outputs can be set to an illegal state which will persist until there is clock or set/reset activity?

Ken

Please Log in or Create an account to join the conversation.

Moderators: cncbasher
Time to create page: 0.157 seconds
Powered by Kunena Forum