Need help making rotary axis behave like second spindle

More
17 Apr 2025 04:40 - 17 Apr 2025 04:45 #326505 by PCW
Is this just a typo when you entered test on the forum?

Pin 'spindle.1.speed-ut-rps' does not exist

 ("ut" instead of "out")

Also I think you need:loadrt [EMCMOT](EMCMOT) servo_period_nsec=[EMCMOT](SERVO_PERIOD) num_joints=[KINS](JOINTS) num_spindles=2
Last edit: 17 Apr 2025 04:45 by PCW.
The following user(s) said Thank You: spumco

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

More
17 Apr 2025 04:56 #326506 by theslawek
Found two errors (below) since I posted this and Probe Basic now loads and IT WORKS!

M3 S1000 
M3 S1000 $1


My INI and HALs uploaded for future people reading this thread.

INI
GEOMETRY = xyza

HAL
Added num_spindles
loadrt [EMCMOT](EMCMOT) servo_period_nsec=[EMCMOT](SERVO_PERIOD) num_joints=[KINS](JOINTS) num_spindles=[TRAJ](SPINDLES)

A few followup questions if I may
  1. Should I expect M5 to stop all spindles, or do I have to get used to using M5 $-1?
  2. Is it possible to get M4 to work? It doesn't do anything right now.
Attachments:

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

More
17 Apr 2025 05:00 #326507 by theslawek

Is this just a typo when you entered test on the forum?

Pin 'spindle.1.speed-ut-rps' does not exist

 ("ut" instead of "out")

Also I think you need:loadrt [EMCMOT](EMCMOT) servo_period_nsec=[EMCMOT](SERVO_PERIOD) num_joints=[KINS](JOINTS) num_spindles=2

 

Yep, it checked my console log again and it looks like I accidently cut out that character.
Appreciate your quick reply Peter. I feel quite accomplished that I managed to figure it out before noticing your message.

All this stuff like this below still makes no sense to me as to what its purpose is.
net spindle1-vel-cmd-rps        <=  spindle.1.speed-out-rps

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

More
17 Apr 2025 12:16 #326516 by spumco

  1. Should I expect M5 to stop all spindles, or do I have to get used to using M5 $-1?
    • Is it possible to get M4 to work? It doesn't do anything right now.


M5 - I recall some discussion on Github about what should be the default behavior for multi-spindle M5 commands.  I found a commit that appears to change M5 to 'stop all spindles', and any of the $ modifiers are for individual spindles.
github.com/LinuxCNC/linuxcnc/commit/01a0...d65486193ead51027c29

Probably want to do some testing yourself.

M4: I think what's going on is that step/dir spindles require an explicit reverse speed value in the INI file, despite what the manual indicates.
linuxcnc.org/docs/devel/html/config/ini-...:ini:sec:spindle-num

adding
[SPINDLE_1]
MAX_REVERSE_VELOCITY = 550

Might do the trick.

If this doesn't work, the next thing is for you to get used to using the 'halshow' feature in LCNC.  This is a simple but powerful tool for debugging since it lets you see what LCNC is doing behind the scenes.  In your case, you want to know why M4 isn't working so you should display all the HAL pins which affect the spindle - including the PID pins.

When you open halshow there's a folder tree on the left where you can click on all the pins (real physical pins, or logical pins) in LCNC.  Once you select those they will appear on the right in the 'watchlist'.  On/off (bit) pins will look sort of like red/yellow LED's, and other pin types will display the value.
What you want is to display all the pins which form the internal logic chain that starts with and M4 command and ends with the mesa stepgen outputting signals to the drive.  Figuring out all the pins and how they're logically interconnected is not always straightforward... but it also didn't cost you buckets of money.

This is where coming to terms with HAL is necessary:

All this stuff like this below still makes no sense to me as to what its purpose is.
net spindle1-vel-cmd-rps        <=  spindle.1.speed-out-rps


'spindle.1.speed-out-rps' is a logical (not physical) pin inside LCNC.  When LCNC starts up and reads the HAL file, there are a number of default functions that are automatically loaded. One of these functions is called 'motion.comp', and a description of what it does and all the related pins which are created is located here:
linuxcnc.org/docs/devel/html/man/man9/motion.9.html

If you read through that page, what you find is a list of logical pins which are created when LCNC starts.  Once those pins are created, you can do 'stuff' with them by connecting them together.  I won't go in to specifics right this minute, but any pin which is connected to spindle.1.speed-out-rps will receive a value that is equal to the commanded rotary-axis spindle speed in revolutions per second.

Hopefully this will click with you soon.

BUT

Assuming you didn't mess things up significantly during your editing, I think there may (still) be at least one bug in Mesact or PNCconf for step/dir spindles.

See where spindle.1.on is connected to hm2_7i76e.0.stepgen.04.enable through signal spindle1-enable?

This connection will result in the stepgen shutting off instantly when the spindle is turned off - no controlled deceleration.  This result in a massive BANG! when the motor drive stops dead, and can lead to over-voltage trips in the drive or broken things.

This should have been fixed in LCNC 2.9, but it appears to still be an issue:
github.com/LinuxCNC/linuxcnc/issues/2748

This bug shouldn't affect M4/reverse not working, but I bet your spindle stops HARD right now and doesn't decel gracefully.  
The following user(s) said Thank You: theslawek

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

More
18 Apr 2025 03:38 #326558 by theslawek
Adding MAX_REVERSE_VELOCITY did the trick for M4 commands. Thanks.

Yes, I do have an abrupt stop with M5 $1, completely ignoring my acceleration parameters. I wonder if there would be any benefit in disabling my stepper motor driver (cheap DM542T) just as the M5 is issued. On one hand, the freewheeling could be more harmful than the coil being energized hard to stop, but on the other hand if the workpiece is delicate, freewheeling for however short of time as it can give it a better chance of survival.

If it's still a bug and 2748 is closed, is there a newer issue open? Does someone have a patch perhaps? Is this my opportunity to dive into the code? 

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

More
18 Apr 2025 03:54 - 18 Apr 2025 03:55 #326559 by PCW
Simply replacing:

net spindle.1.on hm2_7i76e.0.stepgen.04.enable

with

net machine-is-on  hm2_7i76e.0.stepgen.04.enable

Should fix the issue.
Last edit: 18 Apr 2025 03:55 by PCW.
The following user(s) said Thank You: spumco, theslawek

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

More
18 Apr 2025 04:08 #326560 by spumco

Simply replacing:

net spindle.1.on hm2_7i76e.0.stepgen.04.enable

with

net machine-is-on  hm2_7i76e.0.stepgen.04.enable

Should fix the issue.
 

PCW - I didn't see the halui signal machine-is-on in his HAL file; maybe I missed it.

OP - if that signal is already in your half file, do what PCW posted.

If it's not already there, you can tweak it to this:

net machine-is-on <= halui.machine.is-on
net machine-is-on => hm2_7i76e.0.stepgen.04.enable

I can confirm this fixed my stepgen spindle after PCW suggested it to me last year.
The following user(s) said Thank You: theslawek

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

More
18 Apr 2025 04:16 #326561 by theslawek
After my last post I was trying "machine-is-on" in the lines WITHOUT hm2. I tried your replacement and the result is M3 and M4 no longer do anything. No error.

#net spindle1-enable => hm2_7i76e.0.stepgen.04.enable
net machine-is-on hm2_7i76e.0.stepgen.04.enable

Even tried with the same "=>" and still same behaviour.

Do I have to do something with my regular spindle hal entries for it to play nice?
net spindle-enable => hm2_7i76e.0.7i76.0.0.spinena

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

More
18 Apr 2025 04:21 #326562 by theslawek
BINGO, adding the halui line did the trick. Thank you PCW and spumco, you guys are amazing (and lighting fast responders).
The following user(s) said Thank You: tommylight

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

More
18 Apr 2025 12:52 #326599 by spumco

BINGO, adding the halui line did the trick. Thank you PCW and spumco, you guys are amazing (and lighting fast responders).
 

Thanks for reporting back, and glad to hear it's sorted out.

BTW, the "=>" and "<=" in the line are just characters to help the user visualize the pin to signal connection.  They are not required, and are ignored by LCNC.  I personally find single-line HAL entries nearly impossible to read, but breaking them up in to multiple lines does make for a much longer HAL file.

For example, the single line:
net machine-is-on hm2_7i76e.0.stepgen.04.enable halui.machine.is-on

is the same to LCNC as:
net machine-is-on  <= halui.machine.is-on
net machine-is-on  => hm2_7i76e.0.stepgen.04.enable
The following user(s) said Thank You: tommylight

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

Time to create page: 0.264 seconds
Powered by Kunena Forum