INVALID_ZERO_NEG_CONSTRAINT error while running 5 axis G code
Moderators: TomKerekes, dynomotion
-
AmitKumar171
- Posts: 134
- Joined: Tue Feb 20, 2018 7:35 am
- Location: India
INVALID_ZERO_NEG_CONSTRAINT error while running 5 axis G code
Hi Tom,
I am using Kflop+Konnect for my 5 Axis cnc machine.
I am facing strange problem (INVALID_ZERO_NEG_CONSTRAINT) while running attached g code.
I have attached the trajectory planner settings and G code in which i am facing the error. Even i tried increasing decimal in g code as well but still facing same error.
Please help me in finding the error and how to fix the same.
Waiting for kind reply.
I am using Kflop+Konnect for my 5 Axis cnc machine.
I am facing strange problem (INVALID_ZERO_NEG_CONSTRAINT) while running attached g code.
I have attached the trajectory planner settings and G code in which i am facing the error. Even i tried increasing decimal in g code as well but still facing same error.
Please help me in finding the error and how to fix the same.
Waiting for kind reply.
- Attachments
-
- 04_4EM_4decimal.txt
- (742.23 KiB) Downloaded 169 times
-
- 04_4EM_3decimal.txt
- (593.6 KiB) Downloaded 183 times
Thank You
AMIT KUMAR
AMIT KUMAR
- TomKerekes
- Posts: 2868
- Joined: Mon Dec 04, 2017 1:49 am
Re: INVALID_ZERO_NEG_CONSTRAINT error while running 5 axis G code
Hi Amit,
That error shouldn’t come from GCode. It indicates a Move command from a C Program with a Max Velocity of 0. The C Program causing error might be invoked by an MCode within the GCode.
What line of GCode causes the error?
What C Programs are being invoked?
That error shouldn’t come from GCode. It indicates a Move command from a C Program with a Max Velocity of 0. The C Program causing error might be invoked by an MCode within the GCode.
What line of GCode causes the error?
What C Programs are being invoked?
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
-
AmitKumar171
- Posts: 134
- Joined: Tue Feb 20, 2018 7:35 am
- Location: India
Re: INVALID_ZERO_NEG_CONSTRAINT error while running 5 axis G code
Hi tom,
Thanks for the earlier reply.
Only INIT file is running in thread - 1 , which has soft limit program attached with it (Soft limit is defined in axis definition files and checkdistancetostop also running in infinite for loop).
So does that soft limit making that error?
Waiting for kind reply.
Thanks for the earlier reply.
Only INIT file is running in thread - 1 , which has soft limit program attached with it (Soft limit is defined in axis definition files and checkdistancetostop also running in infinite for loop).
So does that soft limit making that error?
Waiting for kind reply.
Thank You
AMIT KUMAR
AMIT KUMAR
- TomKerekes
- Posts: 2868
- Joined: Mon Dec 04, 2017 1:49 am
Re: INVALID_ZERO_NEG_CONSTRAINT error while running 5 axis G code
Hi Amit,
Please post your INIT C Program.
What line of GCode causes the error?
Please post your INIT C Program.
What line of GCode causes the error?
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
Re: INVALID_ZERO_NEG_CONSTRAINT error while running 5 axis G code
Can i post it instead of topicstarter? 
KFLOP with just my breakout board start to behave strange after some time of work. At first it works fine, but then it don't want to react properly on step commands. I mean theese buttons

Console is filled with this:
MoveType:INVALID_ZERO_NEG_CONSTRAINT
MoveEx Failed! chan=0 a0=0 v0=1e-06 dx=2.03727e-09 MaxVel=0 Accel=6e+06 Decel=6e+06 Jerk=4e+07
MoveType:INVALID_ZERO_NEG_CONSTRAINT
MoveEx Failed! chan=2 a0=0 v0=4e-05 dx=3.08279e-06 MaxVel=0 Accel=2e+06 Decel=2e+06 Jerk=1e+07
MoveType:INVALID_ZERO_NEG_CONSTRAINT
MoveEx Failed! chan=2 a0=0 v0=0 dx=-1e-05 MaxVel=0 Accel=2e+06 Decel=2e+06 Jerk=1e+07
Looks like axis refuse to move with negative velocity.
Also what is biggest trouble, it can't properly execute G0 commands. Axis start movement to destination, but before reaching it goes back a bit and floats few seconds around that wrong position. Machine reacts to step commands similarly. It ends up with axis disable due to max following error. I tried to lower speeds and acceleration, that didn't help at all.
Init file attached.
Also, i can't understand what am i doing wrong with CSS mode. Maybe it's question for another topic. To make spindle start rotation i have to:
1. Init
2. At least once M3 G97
3. G96 S(x) D(y)
4. Init again
And only after this spindle can rotate in CSS mode. Should I implement it in init file another way?
KFLOP with just my breakout board start to behave strange after some time of work. At first it works fine, but then it don't want to react properly on step commands. I mean theese buttons

Console is filled with this:
MoveType:INVALID_ZERO_NEG_CONSTRAINT
MoveEx Failed! chan=0 a0=0 v0=1e-06 dx=2.03727e-09 MaxVel=0 Accel=6e+06 Decel=6e+06 Jerk=4e+07
MoveType:INVALID_ZERO_NEG_CONSTRAINT
MoveEx Failed! chan=2 a0=0 v0=4e-05 dx=3.08279e-06 MaxVel=0 Accel=2e+06 Decel=2e+06 Jerk=1e+07
MoveType:INVALID_ZERO_NEG_CONSTRAINT
MoveEx Failed! chan=2 a0=0 v0=0 dx=-1e-05 MaxVel=0 Accel=2e+06 Decel=2e+06 Jerk=1e+07
Looks like axis refuse to move with negative velocity.
Also what is biggest trouble, it can't properly execute G0 commands. Axis start movement to destination, but before reaching it goes back a bit and floats few seconds around that wrong position. Machine reacts to step commands similarly. It ends up with axis disable due to max following error. I tried to lower speeds and acceleration, that didn't help at all.
Init file attached.
Also, i can't understand what am i doing wrong with CSS mode. Maybe it's question for another topic. To make spindle start rotation i have to:
1. Init
2. At least once M3 G97
3. G96 S(x) D(y)
4. Init again
And only after this spindle can rotate in CSS mode. Should I implement it in init file another way?
- Attachments
-
- Init16m05a.c
- (4.05 KiB) Downloaded 43 times
- TomKerekes
- Posts: 2868
- Joined: Mon Dec 04, 2017 1:49 am
Re: INVALID_ZERO_NEG_CONSTRAINT error while running 5 axis G code
Hi,
What Version of KMotion are you running?
Somehow a microscopic move of Axis 0 is being commanded with a maximum allowed velocity of zero. When those errors are displayed enter 'Vel0' in the console screen to see if the velocity is really 0.
Regarding CSS: Please post your MySpindleDefs.h and CSSJog.c files.
Also post your \KMotion\Data\GCodeConfigCNC.txt so we know your entire configuration.
What Version of KMotion are you running?
Somehow a microscopic move of Axis 0 is being commanded with a maximum allowed velocity of zero. When those errors are displayed enter 'Vel0' in the console screen to see if the velocity is really 0.
Regarding CSS: Please post your MySpindleDefs.h and CSSJog.c files.
Also post your \KMotion\Data\GCodeConfigCNC.txt so we know your entire configuration.
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
Re: INVALID_ZERO_NEG_CONSTRAINT error while running 5 axis G code
KMotion5.4.1
On older versions behaviour was the same, but i am not 100% sure.
Responce to Vel0

Same for period when console spam those messages, and when axis is standing still and console is calm.
About CSS files i didn't change CSSJog.c, just MySpindleDefs.
And a small update: previously stated step 3 is not needed. To activate SCC minimum steps are:
1. Init
2. At least once M3 G97 (G97 default mode, no need to write it)
3. Init again
Only after this, spindle will rotate in CSS mode.
On older versions behaviour was the same, but i am not 100% sure.
Responce to Vel0

Same for period when console spam those messages, and when axis is standing still and console is calm.
About CSS files i didn't change CSSJog.c, just MySpindleDefs.
And a small update: previously stated step 3 is not needed. To activate SCC minimum steps are:
1. Init
2. At least once M3 G97 (G97 default mode, no need to write it)
3. Init again
Only after this, spindle will rotate in CSS mode.
- Attachments
-
- CSSJog.c
- (1.98 KiB) Downloaded 41 times
-
- MySpindleDefs.h
- (640 Bytes) Downloaded 40 times
-
- GCodeConfigCNC.txt
- (23.34 KiB) Downloaded 41 times
Re: INVALID_ZERO_NEG_CONSTRAINT error while running 5 axis G code
About INVALID_ZERO_NEG_CONSTRAINT I am suspecting hardware issues. The point is this thing is not happening on cold machine. I can work for a few hours and it works fine. Then slowly troubles are coming and become bigger. Reboot of KFLOP, PC or both don't help. I tried even reflash firmware suspecting some buffer overflows, zero result. But if i give some rest to machine, after some time it works well, for some time.
Now i got this state of trouble, tripple checked it, yes it's right here. Blew the KFLOP board with air compressor to cool it down, and now it works fine again. I think some unlucky capacitor might help to mess up numbers. How do you think?
-----------------
update
Unluckily, at the second time air compressor doesn't help.
Now i got this state of trouble, tripple checked it, yes it's right here. Blew the KFLOP board with air compressor to cool it down, and now it works fine again. I think some unlucky capacitor might help to mess up numbers. How do you think?
-----------------
update
Unluckily, at the second time air compressor doesn't help.
- TomKerekes
- Posts: 2868
- Joined: Mon Dec 04, 2017 1:49 am
Re: INVALID_ZERO_NEG_CONSTRAINT error while running 5 axis G code
Sorry I'm having a hard time coming up with a scenario that would cause the zero constraint error. Any further info or a way to reproduce would be helpful. The cooling would be very strange, but it seems that might have been a coincidence?
MoveEx would be more related to the Jog buttons but you indicate it happens with the Step buttons?
The "v0=1e-06" strangely indicates a move is commanded while a motion is still in progress, not stopped, but moving extremely slowly.
I see you have The GamePad enabled in the Trajectory Planner Screen. You might disable that to see if it is somehow related.
Regarding CSS: have you changed the OnCWJog.c or OffJog.c, or SpindleJog.c programs?
MoveEx would be more related to the Jog buttons but you indicate it happens with the Step buttons?
The "v0=1e-06" strangely indicates a move is commanded while a motion is still in progress, not stopped, but moving extremely slowly.
I see you have The GamePad enabled in the Trajectory Planner Screen. You might disable that to see if it is somehow related.
Regarding CSS: have you changed the OnCWJog.c or OffJog.c, or SpindleJog.c programs?
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
Re: INVALID_ZERO_NEG_CONSTRAINT error while running 5 axis G code
Ofc this might be the case. I spent some time to get that air to the board. It feels like i start working with some ammount of impulses or MFlops, that are slowly regenerating) when machine idles. Yesterday lathe started to dance, i gave some more job to grow bigger troubles and left it to take a rest for 2 hours, PC and KFLOP were turned on purpose. After that time i continued my work without any troubles for some more time, don't remember how much.TomKerekes wrote: ↑Sat Nov 08, 2025 12:35 amThe cooling would be very strange, but it seems that might have been a coincidence?
About jog buttons, try to flip imagination
1 more detail. In time when system works worse, some times KFLOP misses M5 command.
I often use sort of
G0 Z33 M5
M0
to clean chips and/or check size, so turned on spindle is noticable.
Checked supply voltage, both 5 and 12 volts are perfect.
Ok, i will check the work without gamepad today.
I know 2 ways to reproduce it. I can drop you my typical GCode, maybe there are some violent numbers, and any files you ask. Or send you my boardTomKerekes wrote: ↑Sat Nov 08, 2025 12:35 amAny further info or a way to reproduce would be helpful.
Nope. Not enough skills in C programmingTomKerekes wrote: ↑Sat Nov 08, 2025 12:35 amRegarding CSS: have you changed the OnCWJog.c or OffJog.c, or SpindleJog.c programs?