- Hardware & Machines
- CNC Machines
- Turning
- Using Mesa Stepgen as spindle but M4 / reverse / ccw does nothing
Using Mesa Stepgen as spindle but M4 / reverse / ccw does nothing
29 Mar 2023 01:40 #267754
by snakeoil
I'm not 100% sure what I'm doing with HAL so I apologize! This is probably a simple problem but I'm not sure I understand the plumbing of it.
The UI button for "spindle on" (and MDI M3) works as expected.
M4 however (and the reverse button in the UI) does nothing. Code keeps running but spindle is paused, doesn't move. The manual "reverse spindle" button sort of just makes the UI flash/glitch for a second. And sometimes after some GCode execution the reverse button will be grayed out / disabled altogether.
Here's the relevant part where the spindle is set up. It's driving a simple NEMA 23 open loop stepper.
The UI button for "spindle on" (and MDI M3) works as expected.
M4 however (and the reverse button in the UI) does nothing. Code keeps running but spindle is paused, doesn't move. The manual "reverse spindle" button sort of just makes the UI flash/glitch for a second. And sometimes after some GCode execution the reverse button will be grayed out / disabled altogether.
Here's the relevant part where the spindle is set up. It's driving a simple NEMA 23 open loop stepper.
#*******************
# SPINDLE - STEPGEN 04 ROTARY AXIS
#*******************
setp hm2_7i76e.0.stepgen.04.dirsetup [SPINDLE_0]DIRSETUP
setp hm2_7i76e.0.stepgen.04.dirhold [SPINDLE_0]DIRHOLD
setp hm2_7i76e.0.stepgen.04.steplen [SPINDLE_0]STEPLEN
setp hm2_7i76e.0.stepgen.04.stepspace [SPINDLE_0]STEPSPACE
setp hm2_7i76e.0.stepgen.04.position-scale [SPINDLE_0]STEP_SCALE
setp hm2_7i76e.0.stepgen.04.step_type 0
setp hm2_7i76e.0.stepgen.04.control-type 1
setp hm2_7i76e.0.stepgen.04.maxaccel [SPINDLE_0]MAX_ACCELERATION
setp hm2_7i76e.0.stepgen.04.maxvel [SPINDLE_0]MAX_VELOCITY
net spindle-enable => hm2_7i76e.0.stepgen.04.enable
net spindle-vel-cmd-rpm => hm2_7i76e.0.stepgen.04.velocity-cmd
net spindle-vel-fb-rpm <= hm2_7i76e.0.stepgen.04.velocity-fb
net spindle-enable => spindle.0.on
# ---setup spindle control signals---
net spindle-vel-cmd-rps <= spindle.0.speed-out-rps
net spindle-vel-cmd-rps-abs <= spindle.0.speed-out-rps-abs
net spindle-vel-cmd-rpm <= spindle.0.speed-out
net spindle-vel-cmd-rpm-abs <= spindle.0.speed-out-abs
net spindle-enable <= spindle.0.on
net spindle-cw <= spindle.0.forward
net spindle-ccw <= spindle.0.reverse
net spindle-brake <= spindle.0.brake
net spindle-revs => spindle.0.revs
net spindle-at-speed => spindle.0.at-speed
net spindle-vel-fb-rps => spindle.0.speed-in
net spindle-index-enable <=> spindle.0.index-enable
# ---Setup spindle at speed signals---
sets spindle-at-speed true
Please Log in or Create an account to join the conversation.
29 Mar 2023 02:04 - 29 Mar 2023 02:07 #267756
by snakeoil
Replied by snakeoil on topic Using Mesa Stepgen as spindle but M4 / reverse / ccw does nothing
My first thought after posting this and re-reading the man pages is it's going to be a simple net like this...
So that the "forward" output bit from the "spindle" "component" is sent to the "dir" bit of the relevant stepgen "component" – is that language right maybe?
But that could be off-by-one... maybe it should be sending the "reverse" bit instead. I'm away from the machine until tomorrow.
Edit: But... then if it's really that simple, wouldn't M4 still be running the spindle, just in the wrong direction? Currently M4 is stopping it entirely.
net spindle-ccw => stepgen.04.dir
So that the "forward" output bit from the "spindle" "component" is sent to the "dir" bit of the relevant stepgen "component" – is that language right maybe?
But that could be off-by-one... maybe it should be sending the "reverse" bit instead. I'm away from the machine until tomorrow.
Edit: But... then if it's really that simple, wouldn't M4 still be running the spindle, just in the wrong direction? Currently M4 is stopping it entirely.
Last edit: 29 Mar 2023 02:07 by snakeoil.
Please Log in or Create an account to join the conversation.
29 Mar 2023 08:23 #267782
by andypugh
Replied by andypugh on topic Using Mesa Stepgen as spindle but M4 / reverse / ccw does nothing
Is the dir output of the mesa card wired to the dir output of the stepper?
If you use halmeter or halshow to look at the pin values you should see hm2_7i76e.0.stepgen.04.velocity-cmd go negative for reverse rotation.
If it does, then the hardware dir pin should change state.
If you use halmeter or halshow to look at the pin values you should see hm2_7i76e.0.stepgen.04.velocity-cmd go negative for reverse rotation.
If it does, then the hardware dir pin should change state.
Please Log in or Create an account to join the conversation.
29 Mar 2023 12:50 #267803
by snakeoil
Replied by snakeoil on topic Using Mesa Stepgen as spindle but M4 / reverse / ccw does nothing
That's a good question and where I'm confused. I cannot find any dir output (or input) pins in the docs. There are only these velocity floats which seem to go negative:
From linuxcnc.org/docs/2.9/html/man/man9/spindle.9.html
And then as for output from the MESA stepper this:
From linuxcnc.org/docs/2.9/html/man/man9/hostmot2.9.html
What I've been using up to now is essentially just copypasta from old forums posts, which I am trying to reverse engineer. The params that have been working so far aren't in the docs so I'm basically just guessing what to net to what.
Also for anyone reading this the little arrows => don't mean anything and the most of the syntax examples are like `net signal source destination destination` but then the config file generators seem to use the syntax `net signal [optional arrow] [autodetected-in-or-out]`
spindle.0.spindle-rpm (float out)
From linuxcnc.org/docs/2.9/html/man/man9/spindle.9.html
And then as for output from the MESA stepper this:
hm2_7i76e.0.stepgen.04.velocity-fb (float output)
From linuxcnc.org/docs/2.9/html/man/man9/hostmot2.9.html
What I've been using up to now is essentially just copypasta from old forums posts, which I am trying to reverse engineer. The params that have been working so far aren't in the docs so I'm basically just guessing what to net to what.
Also for anyone reading this the little arrows => don't mean anything and the most of the syntax examples are like `net signal source destination destination` but then the config file generators seem to use the syntax `net signal [optional arrow] [autodetected-in-or-out]`
Please Log in or Create an account to join the conversation.
29 Mar 2023 13:03 #267805
by snakeoil
Replied by snakeoil on topic Using Mesa Stepgen as spindle but M4 / reverse / ccw does nothing
So using that original config Halshow says:
M3
M4
The full .hal file is attached to original post. That does work but only M3/forward.
M3
positive value for stepgen.04.velocity-cmd
true for spindle-cw
false for spindle-ccw
true for spindle-enable
M4
0 for stepgen.04.velocity-cmd
false for spindle-cw
false for spindle-ccw
false for spindle-enable
The full .hal file is attached to original post. That does work but only M3/forward.
Please Log in or Create an account to join the conversation.
29 Mar 2023 13:06 #267806
by andypugh
Replied by andypugh on topic Using Mesa Stepgen as spindle but M4 / reverse / ccw does nothing
Which LinuxCNC version?
Does your INI have a spindle section with a minimum spindle speed in it?
linuxcnc.org/docs/2.9/html/config/ini-co...:ini:sec:spindle-num
(This section has no effect in versions 2.8 and earlier)
Does your INI have a spindle section with a minimum spindle speed in it?
linuxcnc.org/docs/2.9/html/config/ini-co...:ini:sec:spindle-num
(This section has no effect in versions 2.8 and earlier)
Please Log in or Create an account to join the conversation.
29 Mar 2023 13:07 #267807
by andypugh
Replied by andypugh on topic Using Mesa Stepgen as spindle but M4 / reverse / ccw does nothing
And are you using M4 S1000 (or whatever) rather than just a plain M4?
Please Log in or Create an account to join the conversation.
- robertspark
- Offline
- Platinum Member
Less
More
- Posts: 915
- Thank you received: 216
29 Mar 2023 14:18 #267812
by robertspark
Replied by robertspark on topic Using Mesa Stepgen as spindle but M4 / reverse / ccw does nothing
like Andy mentioned, what's in your ini file for reverse speeds
linuxcnc.org/docs/2.9/html/config/ini-co...:ini:sec:spindle-num
linuxcnc.org/docs/2.9/html/config/ini-co...:ini:sec:spindle-num
Please Log in or Create an account to join the conversation.
- Mike Connelly
- Offline
- New Member
Less
More
- Posts: 16
- Thank you received: 2
04 Apr 2023 01:52 #268224
by Mike Connelly
Replied by Mike Connelly on topic Using Mesa Stepgen as spindle but M4 / reverse / ccw does nothing
I've just recently run into the same thing and have a thread going here -
forum.linuxcnc.org/49-basic-configuratio...t-no-reverse?start=0
No answers yet, but PCW said he thinks it's something to do with the halui because he's not having M4 problems on a setup that doesn't have halui.
Have you made any progress?
forum.linuxcnc.org/49-basic-configuratio...t-no-reverse?start=0
No answers yet, but PCW said he thinks it's something to do with the halui because he's not having M4 problems on a setup that doesn't have halui.
Have you made any progress?
Please Log in or Create an account to join the conversation.
- Mike Connelly
- Offline
- New Member
Less
More
- Posts: 16
- Thank you received: 2
04 Apr 2023 02:58 #268230
by Mike Connelly
Replied by Mike Connelly on topic Using Mesa Stepgen as spindle but M4 / reverse / ccw does nothing
The docs state that if MAX_REVERSE_VELOCITY and MIN_REVERSE_VELOCITY aren't defined they will default to MAX_VELOCITY and MIN_VELOCITY respectively. This doesn't appear to be true, because after I defined those _REVERSE_ values my M4 came to life. The spindle is still turning the wrong direction, but at least it's responding!
Thanks!
Thanks!
Please Log in or Create an account to join the conversation.
Moderators: piasdom
- Hardware & Machines
- CNC Machines
- Turning
- Using Mesa Stepgen as spindle but M4 / reverse / ccw does nothing
Time to create page: 0.137 seconds