G28 and M30 (program end) issues on Shapeoko 3

Discussion about the arduino based g-code interpreter, grbl
Post Reply
Posts: 3
Joined: Sat Sep 19, 2015 6:14 am

G28 and M30 (program end) issues on Shapeoko 3

Post by adamsd5 » Sun Jan 27, 2019 4:06 am

I've recently returned to my Shapeoko 3, upgrading Fusion 360 and building a simple model. I don't know if the Fusion 360 post-processing has changed, but I got some bad behavior. First, it's adding commands like this:

G28 G91 Z0

I don't know what this is supposed to do, but it causes my retraction to slam up into the Z limit switch. If I manually comment this out, things work fine.

Second, at the end of the program, my bit suddenly dropped about 0.5". I'm 100% certain this is not in the Gcode. It seemed more like the motors de-energized for 0.1 second and the router dropped due to gravity before the bit stopped spinning. This dug a hole in my test piece, right at the end. I noticed that the current post-process end commands are:

G28 G91 Z0
G28 G91 X0 Y0

Where in a gcode file from a year ago, that I know worked properly, ends like this:


Does anyone understand the gcode well enough to give me some insight on these two issues?

I'd prefer not manually modify each gcode file that comes out of Fusion 360, or to provide my own post-process script, so hopefully someone can give me some pointers about why my machine is not happy with the Fusion 360 gcode. (Note that I'm using the "Carbide 3D (grbl) / carbide3d" post-processor in Fusion 360.

Posts: 1347
Joined: Tue Jan 29, 2013 4:51 pm
Location: Minneapolis, MN

Re: G28 and M30 (program end) issues on Shapeoko 3

Post by twforeman » Fri Feb 01, 2019 7:38 pm

G28 is "go to pre-defined position" If you don't have that position set, then it could cause issues.

The predefined position is set by sending G28.1 followed by the X Y Z coordinates. I never use G28.

G91 sets incremental mode

G28 G91 Z0 doesn't really make any sense to me, since it's telling it to go to the predefined position and then set incremental mode and the go to Z0 (which shouldn't move in incremental mode.)

I always hand edit my G code after creating it with Fusion 360. The post-processor is not quite correct for the Shapeoko. I should figure out what it takes to fix it and publish a correct version...

At the end of the program I never use an M30. M30 means end of program and I think that tells Grbl to turn off the steppers.

M9 turns off coolant, M5 turns off the spindle.

G code definitions are here: https://wiki.shapeoko.com/index.php/G-Code
Ender 3 3D Printer
ShapeOko v3 serial #0004 - upgrade thread
All of my ShapeOko related blog posts

Post Reply