Lathe C axis homing
- spumco
- Offline
- Platinum Member
-
Less
More
- Posts: 2077
- Thank you received: 862
06 Apr 2026 17:02 #345232
by spumco
Yes, logic.s0free is 0x105
There are probably other essential ingredients missing from that hal file. Best bet is for me to post my whole config... You've got two options:
- Collet closer position sensor logic/interlocks for both main and sub-spindles
- GUI view rotation for sub/main spindle work
- Other stuff yet to be discovered
Your pick.
Replied by spumco on topic Lathe C axis homing
From what I gather, logic.s0free should be an AND device, so with personality=0x105? Maybe there are other essential things there? I assume SPIN0-xx signals are distributed in another file?
Yes, logic.s0free is 0x105
There are probably other essential ingredients missing from that hal file. Best bet is for me to post my whole config... You've got two options:
- I can give you a slightly out-of-date version right this second. It has all the spindle/c-axis stuff in it, OR
- Wait until tonight and I'll give you the latest version
- Includes a switchkins component for my separate parting slide, plus some changes that don't affect C-axis stuff
- Collet closer position sensor logic/interlocks for both main and sub-spindles
- GUI view rotation for sub/main spindle work
- Other stuff yet to be discovered
Your pick.
Please Log in or Create an account to join the conversation.
- jetbadger
- Offline
- New Member
-
Less
More
- Posts: 19
- Thank you received: 2
06 Apr 2026 19:30 #345243
by jetbadger
Replied by jetbadger on topic Lathe C axis homing
Oh whichever is easiest for you, I don't have a parting slide and C axis at this moment is all I'm trying to do. I'm immensely grateful anyway
Please Log in or Create an account to join the conversation.
- spumco
- Offline
- Platinum Member
-
Less
More
- Posts: 2077
- Thank you received: 862
07 Apr 2026 01:32 #345248
by spumco
Replied by spumco on topic Lathe C axis homing
Here you go.
Again, it's complicated. Feel free to ask questions if something is unclear.
A few thoughts:
Again, it's complicated. Feel free to ask questions if something is unclear.
A few thoughts:
- Still a work in progress, but the part(s) you want works.
- HAL files are broken up by major components of the config.
- Lots of comments - you should get a sense of the uncountable number of times I've tried or tweaked something.
- Signal names are all upper case because LCNC's halshow sorts by case first, then alphabetically. Drives me nuts searching for signals if they're all jumbled due to upper/lower case.
- Sub-spindle is not connected to an axis. LCNC doesn't have duplicate rotary axes like UVW for XYZ. I found (so far) M19 works fine for the sub.
- Main spindle motor is a SZGH 'servo spindle' - an induction motor with a pretty smart drive.
- The drive has position, velocity, and torque modes, just like a brushless PM servo
- I believe @Aciera switches his drive between velocity and position when he switches LCNC between spindle and C-axis.
- I found that position mode had a bit of dither at stand-still, possibly due to the induction motor characteristics. So my drive/motor is always in velocity mode, unlike @Aciera's example. This may help you with your Schaublin's spindle drive.
The following user(s) said Thank You: jetbadger
Please Log in or Create an account to join the conversation.
- jetbadger
- Offline
- New Member
-
Less
More
- Posts: 19
- Thank you received: 2
07 Apr 2026 21:40 #345293
by jetbadger
Replied by jetbadger on topic Lathe C axis homing
Thank you!
The comments and overall formatting you did I greatly appreciate, makes it much easier to follow for someone like me and I think I'm starting to get an idea of how most of it works, well atleast to some extent.
For now the spindle drive is always in position mode, it's just a servo drive/motor. It seems to work okay, but then again it's a bit early to tell.
I will test things on the actual machine in the upcoming days as it's a bit of a drive, but I have high hopes this time
The comments and overall formatting you did I greatly appreciate, makes it much easier to follow for someone like me and I think I'm starting to get an idea of how most of it works, well atleast to some extent.
For now the spindle drive is always in position mode, it's just a servo drive/motor. It seems to work okay, but then again it's a bit early to tell.
I will test things on the actual machine in the upcoming days as it's a bit of a drive, but I have high hopes this time
Please Log in or Create an account to join the conversation.
- jetbadger
- Offline
- New Member
-
Less
More
- Posts: 19
- Thank you received: 2
09 Apr 2026 15:09 #345361
by jetbadger
Replied by jetbadger on topic Lathe C axis homing
I suppose having the drive itself in position mode is causing this? The movement is choppy no matter what. I suppose it's because the output is controlling a position step/dir signal rather a speed signal? I wanted to rewire it for speed, but apparently my drive doesn't allow for speed control over digital step/dir signals. I'm sure there must be a way for it to work in position mode though?
Attachments:
Please Log in or Create an account to join the conversation.
- spumco
- Offline
- Platinum Member
-
Less
More
- Posts: 2077
- Thank you received: 862
09 Apr 2026 18:18 #345367
by spumco
Replied by spumco on topic Lathe C axis homing
Yes, possibly the drive itself is responsible for the choppy movement.
What input methods are available for velocity mode? If the drive accepts PWM, you can change stepgens to PWMgens on Mesa cards.
You also may be able to tune the drive to run more smoothly in position mode. Perhaps the drive permits different tuning values to be changed on-the-fly by the user via inputs (or modbus)? This might allow you to keep the drive in position mode, but have a tight tune for Caxis and a more gentle tune for spindle/velocity mode.
What is the drive mfgr/model?
What input methods are available for velocity mode? If the drive accepts PWM, you can change stepgens to PWMgens on Mesa cards.
You also may be able to tune the drive to run more smoothly in position mode. Perhaps the drive permits different tuning values to be changed on-the-fly by the user via inputs (or modbus)? This might allow you to keep the drive in position mode, but have a tight tune for Caxis and a more gentle tune for spindle/velocity mode.
What is the drive mfgr/model?
Please Log in or Create an account to join the conversation.
- jetbadger
- Offline
- New Member
-
Less
More
- Posts: 19
- Thank you received: 2
09 Apr 2026 18:37 #345369
by jetbadger
Replied by jetbadger on topic Lathe C axis homing
The drive is an Astraada SRV-63. There's only analog in and serial for speed mode sadly.
However shouldn't the stepgen treat it like a velocity signal anyway? As in it generates signal until it reaches setpoint, the drive will turn the motor as long as it receives steps, right? I've been breaking my head about this all day and can;t seem to figure out why is even the setpoint from LCNC choppy? The joint.2.motor-pos-cmd is the origin of the signal it seems to me and shouldn't it be a smooth slope, letting the pid loop take care of reaching the values? Can;t seem to find info on what actually happens in LCNC between something like "G0C0" and joint.x.motor-pos-cmd. A bit stumped now :|
However shouldn't the stepgen treat it like a velocity signal anyway? As in it generates signal until it reaches setpoint, the drive will turn the motor as long as it receives steps, right? I've been breaking my head about this all day and can;t seem to figure out why is even the setpoint from LCNC choppy? The joint.2.motor-pos-cmd is the origin of the signal it seems to me and shouldn't it be a smooth slope, letting the pid loop take care of reaching the values? Can;t seem to find info on what actually happens in LCNC between something like "G0C0" and joint.x.motor-pos-cmd. A bit stumped now :|
Please Log in or Create an account to join the conversation.
- spumco
- Offline
- Platinum Member
-
Less
More
- Posts: 2077
- Thank you received: 862
09 Apr 2026 20:29 #345377
by spumco
Replied by spumco on topic Lathe C axis homing
Keep in mind that we're reaching the limits of my competency...
I think the typical/standard configuration is to put the LCNC stepgen in velocity mode (stepgen.N.control-type = 1), and let LCNC's PID manage getting to the target position.
I seem to recall reading a forum post a while back describing where some developers discovered (years ago) that a velocity-mode stepgen w/PID wound up being more accurate - or otherwise 'better' - than a position-mode stepgen.
So instead of using stepgen.N.position-cmd as the PID output, stepgen.N.velocity-cmd is used. Or something like that.
How are your other axes controlled? Velocity-mode or position-mode stepgens?
I think the typical/standard configuration is to put the LCNC stepgen in velocity mode (stepgen.N.control-type = 1), and let LCNC's PID manage getting to the target position.
I seem to recall reading a forum post a while back describing where some developers discovered (years ago) that a velocity-mode stepgen w/PID wound up being more accurate - or otherwise 'better' - than a position-mode stepgen.
So instead of using stepgen.N.position-cmd as the PID output, stepgen.N.velocity-cmd is used. Or something like that.
How are your other axes controlled? Velocity-mode or position-mode stepgens?
Please Log in or Create an account to join the conversation.
- jetbadger
- Offline
- New Member
-
Less
More
- Posts: 19
- Thank you received: 2
09 Apr 2026 22:31 #345379
by jetbadger
Replied by jetbadger on topic Lathe C axis homing
I indeed have all the axis stepgens in control_type=1, really all I changed from yours in spindle config are the step and encoder scaling pretty much.
That was sort of a weird for me that other axis work fine, but C axis has this choppy behaviour. Obviously it's the only one with actual feeedback but I tried looping back stepgen pos-fb instead of encoder feedbackk in the hal, which should in my head mirror the setup of x and z axis, however the choppiness still remained. Unless I'm missing something silly again
That was sort of a weird for me that other axis work fine, but C axis has this choppy behaviour. Obviously it's the only one with actual feeedback but I tried looping back stepgen pos-fb instead of encoder feedbackk in the hal, which should in my head mirror the setup of x and z axis, however the choppiness still remained. Unless I'm missing something silly again
Please Log in or Create an account to join the conversation.
- spumco
- Offline
- Platinum Member
-
Less
More
- Posts: 2077
- Thank you received: 862
09 Apr 2026 22:39 - 09 Apr 2026 22:40 #345380
by spumco
Replied by spumco on topic Lathe C axis homing
I really don't know the answers here, but maybe some things you can try while you wait for someone smart to chime in...
Disconnect the encoder feedback and just use the stepgen position - i.e. run it open loop. Still choppy?
EDIT - nevermind, you already did that
Check the step-to-distance values. Do you have really coarse steps per degree/rotation or something? I'd start by:
EDIT - nevermind, you already did that
Check the step-to-distance values. Do you have really coarse steps per degree/rotation or something? I'd start by:
- Figuring out the maximum input frequency of your drive
- Do some math
- Set the drive's internal steps-per-rotation to as high as possible without exceeding the max input freq at your maximum spindle speed
- Adjust INI & HAL files so the spindle and axis steps-per-whatever match your new drive parameter values
I don't know if either of these will help, but they're free to test.
Last edit: 09 Apr 2026 22:40 by spumco.
The following user(s) said Thank You: jetbadger
Please Log in or Create an account to join the conversation.
Time to create page: 0.504 seconds