Page 1 of 1

Unexpected Motion Buffer Starved

Posted: Thu May 19, 2022 1:50 pm
by sawel68
Hello!
There is a problem on my machine. If the limit sensor of any axis is driven over, a message appears. "Unexpected Motion Buffer Starved"
Mach3 3.047.022 with license , Kflop 4.34. I tried different versions of mach3, nothing helps.
I haven't been able to solve this problem for several days. Help me please.
This is a configuration file.


include "KMotionDef.h"
int main()
{
ch0->InputMode=NO_INPUT_MODE;
ch0->OutputMode=STEP_DIR_MODE;
ch0->Vel=40000;
ch0->Accel=4000;
ch0->Jerk=4e+06;
ch0->P=1;
ch0->I=0.01;
ch0->D=0;
ch0->FFAccel=0;
ch0->FFVel=0;
ch0->MaxI=200;
ch0->MaxErr=1e+06;
ch0->MaxOutput=200;
ch0->DeadBandGain=1;
ch0->DeadBandRange=0;
ch0->InputChan0=0;
ch0->InputChan1=0;
ch0->OutputChan0=0;
ch0->OutputChan1=0;
ch0->MasterAxis=-1;
ch0->LimitSwitchOptions=0x11f;
ch0->LimitSwitchNegBit=5;
ch0->LimitSwitchPosBit=3;
ch0->SoftLimitPos=1e+09;
ch0->SoftLimitNeg=-1e+09;
ch0->InputGain0=1;
ch0->InputGain1=1;
ch0->InputOffset0=0;
ch0->InputOffset1=0;
ch0->OutputGain=1;
ch0->OutputOffset=0;
ch0->SlaveGain=1;
ch0->BacklashMode=BACKLASH_OFF;
ch0->BacklashAmount=0;
ch0->BacklashRate=0;
ch0->invDistPerCycle=1;
ch0->Lead=0;
ch0->MaxFollowingError=1000000000;
ch0->StepperAmplitude=20;

ch0->iir[0].B0=1;
ch0->iir[0].B1=0;
ch0->iir[0].B2=0;
ch0->iir[0].A1=0;
ch0->iir[0].A2=0;

ch0->iir[1].B0=1;
ch0->iir[1].B1=0;
ch0->iir[1].B2=0;
ch0->iir[1].A1=0;
ch0->iir[1].A2=0;

ch0->iir[2].B0=0.000769;
ch0->iir[2].B1=0.001538;
ch0->iir[2].B2=0.000769;
ch0->iir[2].A1=1.92081;
ch0->iir[2].A2=-0.923885;
EnableAxisDest(0,0);

ch1->InputMode=NO_INPUT_MODE;
ch1->OutputMode=STEP_DIR_MODE;
ch1->Vel=40000;
ch1->Accel=4000;
ch1->Jerk=4e+06;
ch1->P=1;
ch1->I=0.01;
ch1->D=0;
ch1->FFAccel=0;
ch1->FFVel=0;
ch1->MaxI=200;
ch1->MaxErr=1e+06;
ch1->MaxOutput=200;
ch1->DeadBandGain=1;
ch1->DeadBandRange=0;
ch1->InputChan0=1;
ch1->InputChan1=1;
ch1->OutputChan0=1;
ch1->OutputChan1=1;
ch1->MasterAxis=-1;
ch1->LimitSwitchOptions=0x11f;
ch1->LimitSwitchNegBit=5;
ch1->LimitSwitchPosBit=3;
ch1->SoftLimitPos=1e+09;
ch1->SoftLimitNeg=-1e+09;
ch1->InputGain0=1;
ch1->InputGain1=1;
ch1->InputOffset0=0;
ch1->InputOffset1=0;
ch1->OutputGain=1;
ch1->OutputOffset=0;
ch1->SlaveGain=1;
ch1->BacklashMode=BACKLASH_OFF;
ch1->BacklashAmount=0;
ch1->BacklashRate=0;
ch1->invDistPerCycle=1;
ch1->Lead=0;
ch1->MaxFollowingError=1000000000;
ch1->StepperAmplitude=20;

ch1->iir[0].B0=1;
ch1->iir[0].B1=0;
ch1->iir[0].B2=0;
ch1->iir[0].A1=0;
ch1->iir[0].A2=0;

ch1->iir[1].B0=1;
ch1->iir[1].B1=0;
ch1->iir[1].B2=0;
ch1->iir[1].A1=0;
ch1->iir[1].A2=0;

ch1->iir[2].B0=0.000769;
ch1->iir[2].B1=0.001538;
ch1->iir[2].B2=0.000769;
ch1->iir[2].A1=1.92081;
ch1->iir[2].A2=-0.923885;
EnableAxisDest(1,0);

ch2->InputMode=NO_INPUT_MODE;
ch2->OutputMode=STEP_DIR_MODE;
ch2->Vel=40000;
ch2->Accel=4000;
ch2->Jerk=4e+06;
ch2->P=0;
ch2->I=0.01;
ch2->D=0;
ch2->FFAccel=0;
ch2->FFVel=0;
ch2->MaxI=200;
ch2->MaxErr=1e+06;
ch2->MaxOutput=200;
ch2->DeadBandGain=1;
ch2->DeadBandRange=0;
ch2->InputChan0=2;
ch2->InputChan1=0;
ch2->OutputChan0=2;
ch2->OutputChan1=0;
ch2->MasterAxis=-1;
ch2->LimitSwitchOptions=0x11f;
ch2->LimitSwitchNegBit=5;
ch2->LimitSwitchPosBit=3;
ch2->SoftLimitPos=1e+09;
ch2->SoftLimitNeg=-1e+09;
ch2->InputGain0=1;
ch2->InputGain1=1;
ch2->InputOffset0=0;
ch2->InputOffset1=0;
ch2->OutputGain=1;
ch2->OutputOffset=0;
ch2->SlaveGain=1;
ch2->BacklashMode=BACKLASH_OFF;
ch2->BacklashAmount=0;
ch2->BacklashRate=0;
ch2->invDistPerCycle=1;
ch2->Lead=0;
ch2->MaxFollowingError=1000000000;
ch2->StepperAmplitude=20;

ch2->iir[0].B0=1;
ch2->iir[0].B1=0;
ch2->iir[0].B2=0;
ch2->iir[0].A1=0;
ch2->iir[0].A2=0;

ch2->iir[1].B0=1;
ch2->iir[1].B1=0;
ch2->iir[1].B2=0;
ch2->iir[1].A1=0;
ch2->iir[1].A2=0;

ch2->iir[2].B0=0.000769;
ch2->iir[2].B1=0.001538;
ch2->iir[2].B2=0.000769;
ch2->iir[2].A1=1.92081;
ch2->iir[2].A2=-0.923885;
EnableAxisDest(2,0);


ch3->InputMode=NO_INPUT_MODE;
ch3->OutputMode=STEP_DIR_MODE;
ch3->Vel=40000;
ch3->Accel=4000;
ch3->Jerk=4e+06;
ch3->P=1;
ch3->I=0.01;
ch3->D=0;
ch3->FFAccel=0;
ch3->FFVel=0;
ch3->MaxI=200;
ch3->MaxErr=1e+06;
ch3->MaxOutput=200;
ch3->DeadBandGain=1;
ch3->DeadBandRange=0;
ch3->InputChan0=3;
ch3->InputChan1=3;
ch3->OutputChan0=3;
ch3->OutputChan1=3;
ch3->MasterAxis=-1;
ch3->LimitSwitchOptions=0x11f;
ch3->LimitSwitchNegBit=5;
ch3->LimitSwitchPosBit=3;
ch3->SoftLimitPos=1e+09;
ch3->SoftLimitNeg=-1e+09;
ch3->InputGain0=1;
ch3->InputGain1=1;
ch3->InputOffset0=0;
ch3->InputOffset1=0;
ch3->OutputGain=1;
ch3->OutputOffset=0;
ch3->SlaveGain=1;
ch3->BacklashMode=BACKLASH_OFF;
ch3->BacklashAmount=0;
ch3->BacklashRate=0;
ch3->invDistPerCycle=1;
ch3->Lead=0;
ch3->MaxFollowingError=1000000000;
ch3->StepperAmplitude=20;

ch3->iir[0].B0=1;
ch3->iir[0].B1=0;
ch3->iir[0].B2=0;
ch3->iir[0].A1=0;
ch3->iir[0].A2=0;

ch3->iir[1].B0=1;
ch3->iir[1].B1=0;
ch3->iir[1].B2=0;
ch3->iir[1].A1=0;
ch3->iir[1].A2=0;

ch3->iir[2].B0=0.000769;
ch3->iir[2].B1=0.001538;
ch3->iir[2].B2=0.000769;
ch3->iir[2].A1=1.92081;
ch3->iir[2].A2=-0.923885;
EnableAxisDest(3,0);

DefineCoordSystem(0,1,2,3);

return 0;
}

Re: Unexpected Motion Buffer Starved

Posted: Thu May 19, 2022 5:04 pm
by TomKerekes
Hello,

I'm not sure what you are expecting to happen when when you hit a limit switch. Your Limit switch option is to disable the axis.

The displayed error message is somewhat confusing. Our later Versions handle it differently. You might try V4.35f.

Re: Unexpected Motion Buffer Starved

Posted: Fri May 20, 2022 7:50 am
by sawel68
Hello! Thanks Tom for the quick response!
According to your advice, I installed version 4.35f. But the problem hasn't gone away.
I have tried different limit switch modes. LimitSwitchOption 0x10f, 0x11f, 0x12f
When moving by hand, no error occurs. But when I type in a line, let's say Z100, as soon as the axis reaches the sensor, an error message occurs. And a message appears in the status line that all axes are unavailable.

Re: Unexpected Motion Buffer Starved

Posted: Fri May 20, 2022 8:19 am
by sawel68

Re: Unexpected Motion Buffer Starved

Posted: Fri May 20, 2022 5:33 pm
by TomKerekes
Did you change all 4 axes to 0x 12f ? What happens in that case?

Re: Unexpected Motion Buffer Starved

Posted: Sat May 21, 2022 4:33 am
by sawel68
I assigned to variable LimitSwitchOption 0x12f on all 4 axes. I explore only on the axis Z.
When controlled manually, the axis adequately responds to movements and the limit sensor.
But, when I run the G code for execution, then after hitting the limit sensor and stopping the axis, it is necessary to press reset. Otherwise, after the first pressing of the navigation keys, an error occurs.
If after that you press OK on the error message, then the axes starts to move without reacting to the limit sensor.
Only a reset can stop the axis in this case.

Re: Unexpected Motion Buffer Starved

Posted: Sat May 21, 2022 11:11 pm
by TomKerekes
Your Axis settings are somewhat odd. With a max Velocity of 40000 counts/sec and an Acceleration of only 4000 counts/sec2 that would take 10 seconds to accelerate and decelerate.

The 0x12f mode comes to a controlled stop using feed hold when a limit switch is detected. The long time to stop can cause some strange behavior.

Try changing the acceleration to something more common such as 400000 to stop in 0.1 seconds and check the results.

I get different messages and behavior than what you describe. Are you sure you are actually using V4.35f?

Note when GCode hits a limit and feed holds to stop you must push Stop to halt the GCode and be allowed to Jog or Run GCode again.

Do you have a 4th axis? If not remove it from the Coordinate System with:
DefineCoordSystem(0,1,2,-1);

If you still have problems please post your Mach3 Profile

Re: Unexpected Motion Buffer Starved

Posted: Sun May 22, 2022 5:14 am
by sawel68
Thanks Tom!
<<Note when GCode hits a limit and feed holds to stop you must push Stop to halt the GCode and be allowed to Jog or Run GCode again.>>
I didn’t do this, that’s why it didn’t work. For some reason it wasn't obvious to me.))
Now everything works. Thanks again.
PS. If, after stopping by the limit sensor, the movement keys are pressed without pressing the stop, the error message still appears. Can be protected from these not correct actions of the operator in the next versions? Fool protection))).

Re: Unexpected Motion Buffer Starved

Posted: Sun May 22, 2022 5:06 pm
by TomKerekes
PS. If, after stopping by the limit sensor, the movement keys are pressed without pressing the stop, the error message still appears. Can be protected from these not correct actions of the operator in the next versions? Fool protection))).
I don't see that error message here. And what's wrong with an error message if an operator does something wrong?

But no, Mach3 is obsolete and unsupported. Consider using our free KMotionCNC.