Hello Guest it is March 23, 2023, 07:09:14 PM

Author Topic: Debugging stepper stall on specific command  (Read 4117 times)

0 Members and 1 Guest are viewing this topic.

Debugging stepper stall on specific command
« on: March 08, 2009, 05:14:24 PM »
I have a problem where one move command is causing a motor stall which I can't explain.
The system is a G540 with a 48v supply, the move is in free space not through the work.  The system's set at 25khz and the axis are fairly conservative:
X,Y 37.5 ipm acc 5
Z 30 ipm acc 5.
I would characterize this setup as very reliable except for this problem.

A-axis is unusual.  I needed to direct-drive turn some foam.  There's a bearing block and mandrel of course.  I ended up calling A's units "rotations" not "degrees", and have 2000 steps/unit, 750 per min, 200 acc.  I disabled Rot 360 Rollover, Ang Short Rot on G0, and later Rotational Soft Limits.  So I may have X=0 A=0 and G1 X1 A80 F1000 gives me a 1" travel and 80 rots, then I use G92 A0  to clear it so the next move is G1 X2 A80 F1000 and not A160 which is too big of a problem to write cumulative turns for.  

The weird thing is that the G-code must give very high Feedrates to maximize that stepper, and due to shortcomings of G-code it's not readily distinguishable whether you're asking to limit spin rate or XYZ travel.  In my case the turning process performs like 80 turns/in and the stepper speed is the limiting factor.  So I just give a large value like F1000 and expect Mach3 to slow down the whole move command in all axes- A, X, Y, Z- to meet the A-speed listed in Motor Tuning.  This mandates a change in thinking, if you want X-travel to be slower on the finishing pass then it's best to increase the rotations rather than muck with the feedrate.

This works as expected 99% of the time.  But like I say, this one Move command breaks it.  It moves Y about 0.1in and performs 2 rotations.  This results in stalling the Y-axis stepper, with no work under it, and 100% repeatably.  Very audible stall and the Y-axis is off.  This is different than most other moves which performed at least 5 rotations (perhaps hundreds).  In fact I modified the line to give it 5 rotations and the problem went away (for now).  

Is there any way to... diagnose this?  I know it's not much to go on.  I have a theory that it's somehow related to the use of large units on the A-axis and small units on the Y-axis causing a glitch that violated the acceleration of the Y-axis.  I was wondering if there was some way to dump the low-level instructions to the pulsing engine to trace what it's doing, or what.

Offline jimpinder

  •  1,232 1,232
  • Wakefield, West Yorks, UK
    • View Profile
Re: Debugging stepper stall on specific command
« Reply #1 on: March 12, 2009, 03:51:31 PM »
I keep re-reading this to try and make some sense of it. I do not understand what you are trying to do. As far as I can understand you appear to be using a rotational axis as a spindle for a foam block. I can understand the use of your own units, which you say require 2000 pulses per unit - this I take it, means that 2000 turns the foam block 1 rev. You then say you have this set at 750 per minute. That would mean 125 per sec, which means that your A axis needs 250,000 pulses per sec to turn your foam.

You do not say how many pulses your other axis require per sec other than they are conservative.

The way I understand Mach 3 works on multiple moves (although you do not say what all the other axis are doing) is that Mach takes the lead from the axis that is travelling the furthest distance, then adjusts the speed of all the other axis to finish at the right place at the same time.

It may be that whatever instruction is causing you the problem, and I do not see it mentioned in the post, means that the speed of rotation of the A axis which is traveling 80 units means that the resulting speed required of the Y axis (although it only has to travel one or two) is beyond the capablilities of the stepper - and it stalls.

I have a feeling it might be that your acceleration figure for your A axis is 4 to 1 (roughly). For your Y axis to keep position accurately, it will need the same acceleration rate. You have set that at 7 to one (much slower) It may be that this particular motor will not meet that higher criteria.
« Last Edit: March 12, 2009, 03:53:21 PM by jimpinder »
Not me driving the engine - I'm better looking.
Re: Debugging stepper stall on specific command
« Reply #2 on: March 13, 2009, 10:37:39 PM »
X,Y axis: 40,000 pulses/in, max 37.5 ipm,  acc 5
A-axis: 2000 pulses/"in" (rotation), max 750 "ipm" (rpm), acc 200 (this acc value was larger than it should be, I miscalculated, but the intertial load on the axis is fairly trivial anyways, like an oz of foam 3" in dia)

location began as X1.88 Y1.4065 Z0 A0
G1 Y1.065 A2 F3000 caused the Y-axis to stall.

F3000 was put in as a "just the Mach3 limit on the A-axis rate decide".  You kinda have to do this, because AFAIK otherwise if you enter F750 Mach3 calculates speed as (X^2+Y^2+Z^2+A^2)^0.5, right?  Well in truth it wouldn't slow down the A-axis much seeing as the X & Y units are much smaller, but it's still counterproductive.  In any case, all the code has this same Feedrate and it causes no problem.

Also I'd readily accept that it was a problem with the A-axis acceleration, like I say I know I made it too large, even though it didn't happen elsewhere in the code- except for the simple problem that it wasn't the A-axis which stalled but the Y.

Which, no, I can't make sense of this either.  Which is why I was hoping there was some sort of debugging method showing some kind of level between its interpretation of what the G-code was asking it to do and the low-level pulses.  But I haven't seen any indication that such a thing exists.

Of course having discovered that the A-axis problem I can set this back up and retry it again.  I dunno, I've made some changes since then, this may not even be reproducible at this point.

Offline Chip

  • *
  •  2,055 2,055
  • Gainesville Florida USA
    • View Profile
Re: Debugging stepper stall on specific command
« Reply #3 on: March 14, 2009, 01:53:24 AM »
Hi, MechanoMan

Hears a old screen set that has velocity for each axis, Maybe it will give you some Info.

Edit: What ver. of mach3 are you using, It's under Help, About.

« Last Edit: March 14, 2009, 01:03:08 PM by Chip »
Re: Debugging stepper stall on specific command
« Reply #4 on: March 14, 2009, 06:19:33 PM »
Oh no... problem's still here!

With the A-axis acc set to 100 (which makes it exactly the same as the rotational acc of 5 on the linear axis), and the Feedrate set to 750 for the rotational commands (which is "normal"):
Code: [Select]
G92 A0
G0        Y[0.1+#1+#2]
G0 X#3
G1        Y[#1+#2+0.01]      A5  F750
G1                           A15 F750
G1        Y[0.1+#1+#2]       A18 F750(stalls here)
G92 A0
G0    Y1.25       F50

Measurement shows the Y-axis was exactly -0.1 from where it was supposed to be after this.  Well, the way I measured it is probably only accurate to within a few mils but it showed up as dead on -0.1.
Changing the last move to A22- which makes the move take longer, since A was the limiting factor- and the problem goes away.

With the Y-axis off by -0.1, it looks like Mach3 forgot to use the Y-acc value entirely, stepped at 37.5 from a 0 standstill, and stalled the motor.  The stall definitely happened, it can be heard, and the axis being off by -0.1 supports the theory that the stall was immediate.  Well, that is, it's impossible that it could have followed the acceleration value but not the top speed.  For one, the Y-axis motion is only 0.1in.  That is not enough distance to accelerate past the max ipm of the motor on a G540 48v while satisfying the 5ipm/sec acc rule, that motor can go >>60ipm without stalling if acceleration rules are followed.  And it's beside the point because Mach3 is only set at 25khz, so it's physically impossible for it to move the Y-axis faster than 37.5 ipm.
« Last Edit: March 14, 2009, 07:10:26 PM by MechanoMan »
Re: Debugging stepper stall on specific command
« Reply #5 on: March 14, 2009, 07:09:09 PM »
hmm... further experimentation...
After going with the larger A-value in the problem line, I got the impression that it was stalling the A-axis at the end by not following the deceleration rule.  I can kind here it.  But seeing as it's at the end of the move, not the start, it's a transient thing.

I changed the A-acceleration to 20, which is very slow and you can clearly see the motor ramp up and down.
Yes.  With the larger A-value that prevents the problem of an illegal Y-acc stall at the start, now it's using an illegal A-acc value at the end.  I don't get it.

More tinkering... swapping things around...
I FOUND IT!!!  It's the M5 command in CV mode!!
I don't get why, but at the end... it's totally disregarding the acc values in the command preceding the M5.
Just jumps the axes right to a full stop without regard for deceleration on existing speed.

I'm using G64 to set CV mode.  Setting it to G61, Exact Stop, makes to problem go away!

I tried using G4 p1 (Dwell 1 sec) after the problem command in CV mode.  It doesn't help.  In this case, it jerks to a stop without using the acc value prior to the Dwell.
« Last Edit: March 14, 2009, 07:25:52 PM by MechanoMan »