Spindle travelling up the Y axis after job is complete

I have noticed that after a job completes, the spindle is first sent back to the zero position for X and Y, and then it travels up the Y axis as far as it can go. I have already experienced a few near-misses with a clamp holding down the work piece and am concerned that I will forget about it one time and ruin either the bit or my clamp.

I have looked at the gcode and it ends with a “G0X0,Y0”, and then an “M02”. I assume the M02 is telling my XL to move the spindle up there? Is there a way to change that? I would prefer to have it stay at X0Y0.

I am using Aspire to generate the gcode and am using the Shapeoko post-processor.

Correct.

M2 Program Pause and End
M02 was the original program-end code, now considered obsolete, but still supported for backward compatibility.

You should be able to edit or modify the post-processor to not emit that code.

1 Like

I use v carve pro from aspire and it does the same thing.
Once you know it is going to do it , it is kinda handy for a tool change.

1 Like

I believe this is related to what was discussed here:

Does CM Interprets M02 to mean “retreat”? Looking at @WillAdams for confirmation there.

Yes, Grbl goes back to machine origin when M2 or M30 is sent.

Thanks for the replies everyone. I had an issue after removing the M02 last night and want to ensure that A) I am doing it correctly, and B) that this was hopefully just coincidence.

I opened the .gcode file with wordpad and removed the entire last line that had the M02 command in it, and then saved the file. When I ran it, everything went perfectly and the spindle stayed at X0Y0 as planned. The Carbide Connect software, however, popped up an error message stating that it had lost contact with the Shapeoko. Reconnecting didn’t work and neither did quitting CC and restarting it. Shutting off power to the Shapeoko and restarting finally let me connect again. Luckily, it retained the zero coordinates and I was able to change tools and do my finishing job.

So, just bad luck? Or did I edit the gcode file incorrectly? I suppose I could run a simple job tonight to test…

1 Like

Most likely you lost connection due to EMI when switching off the router:

https://www.shapeoko.com/wiki/index.php/Electronics#USB_Disconnection

1 Like

I tried again this evening, but this time I created my own post processor and everything worked perfectly.

I appreciate the help!

I’ve been using my Shapeoko for several months now. I haven’t graduated from Noob status though. This thread is the only thing I can find about the spindle traveling up the Y-Axis automatically after a job has finished. This is very frustrating since you also can’t even pause it to move hold downs out of the way. The main concern with mine is my dust collection mount being independent of the spindle z-axis. The machine automatically moving can allow the dust collection mount to hit my hold downs since it sits pretty low. The bit hitting anything isn’t a problem. I wired up an ‘oh s*%t’ button to kill everything in an emergency and it’s been used more than once. This also makes me lose my zero though.

I’m just not clear on how to resolve this especially since you said you got an error when editing the GCode. I thought changing a setting or simply editing the last line in the GCode would have been all needed. I really would like the spindle to just raise and stay put then I’ll manually move the spindle out of the way. Not sure if the Gcode sending the spindle out of the way is originating in the GCode generated by Vcarve or if it’s something Carbide motion is doing.

Any help for a noob would be greatly appreciated. I’m using a S3XXL with Vcarve Pro and Carbide Motion.

Thanks!

The command which causes this is

 M30

Edit the G-Code to remove that and replace it with the behavior you want. For example:

 G0 Z25

would lift up 25mm above where zero is set

The community has notes on G-Code at: https://wiki.shapeoko.com/index.php/G-Code

2 Likes

I meant to come back here sooner. Thank you for the help. Works perfectly.

1 Like

I recently found this thread and after replacing M02 with G0 Z25 the machine fails at the end of the job. Meaning it stops at X&Y zero position, however, when attempting to jog with the controller left or right it only moves down until it crashes into the material or the probe after the next piece of material is replaced.