Skip to content
Demitrios V edited this page Jul 31, 2020 · 25 revisions

Supported G-codes, M-codes

The mpmd_marlin_1.1.x firmware supports many of Marlin's G/M-codes, as well as a few additional commands and extra capabilities. Most debugging features and commands, though, are disabled. The EMERGENCY_PARSER feature of Marlin is enabled -- with a side-effect being that commands must be entered in upper case (e.g. M30 or G1, not m30 or g1).

We list the supported commands, below.

Marlin Index

Here is a list of the G/M-codes supported by the mpmd_marlin_1.1.x firmware. Each code in the list links to the official Marlin G-code documentation.

G0‑G1: Linear Move G2‑G3: Controlled Arc Move G4: Dwell G27: Park toolhead G28: Auto Home G29: Bed Leveling (Automatic) G30: Single Z‑Probe G33: Delta Auto Calibration G90: Absolute Positioning G91: Relative Positioning M0‑M1: Unconditional stop M16: Expected Printer Check M17: Enable Steppers M18‑M84: Disable steppers M20: List SD Card M21: Init SD card M22: Release SD card M23: Select SD file M24: Start or Resume SD print M25: Pause SD print M26: Set SD position M27: Report SD print status M28: Start SD write M29: Stop SD write M30: Delete SD file M31: Print time M32: Select and Start M33: Get Long Path M73: Set Print Progress M75: Start Print Job Timer M76: Pause Print Job M77: Stop Print Job Timer M81: Power Off M82: E Absolute M83: E Relative M92: Set Axis Steps‑per‑unit M104: Set Hotend Temperature M105: Report Temperatures M106: Set Fan Speed M107: Fan Off M108: Break and Continue M109: Wait for Hotend Temperature M110: Set Line Number M111: Debug Level M112: Emergency Stop M113: Host Keepalive M114: Get Current Position M115: Firmware Info M117: Set LCD Message M118: Serial print M119: Endstop States M125: Park Head M140: Set Bed Temperature M155: Temperature Auto‑Report M190: Wait for Bed Temperature M200: Set Filament Diameter M201: Set Print Max Acceleration M203: Set Max Feedrate M204: Set Starting Acceleration M205: Set Advanced Settings M211: Software Endstops M220: Set Feedrate Percentage M221: Set Flow Percentage M301: Set Hotend PID M302: Cold Extrude M303: PID autotune M304: Set Bed PID M400: Finish Moves M401: Deploy Probe M402: Stow Probe M410: Quickstop M420: Bed Leveling State M421: Set Mesh Value M500: Save Settings M501: Restore Settings M502: Factory Reset M503: Report Settings M504: Validate EEPROM contents M524: Abort SD print M600: Filament Change M603: Configure Filament Change M665: Delta Configuration M666: Set Delta endstop adjustments M851: XYZ Probe Offset M900: Linear Advance Factor M928: Start SD Logging M999: STOP Restart 

Additions/ Changes

We've modified some of Marlin's G/M code commands. For the most part, though, our modifications extend a command's capability, but does not change a command's original behavior. The affected commands are listed below.

To work around limitations of the LCD/UI, we use the printer's single LED/pushbutton as a simple user interface (UI) for the M0/M1 and M600 commands. During normal operation, a flashing LED indicates that the printer is waiting for input from the user. The user presses the LED/pushbutton to continue.

As of firmware release, 119r12, the M106/M107 fan control is supported in both the auto fan flavors -ACfan and the part cooling flavors -PCfan of firmware. The -ACfan firmware combines both fan functions into one: when the fan is disabled (M106 S0, M107), the fan operates automatically at 100% whenever the hotend temperature exceeds 50°C. Otherwise, the M106 S<n> command sets the fan speed. The -PCfan firmware treats the fan as a part cooling fan only, directly controlled via the M106/M107 commands.

As of firmware release, 119r12, the M205 command's Q parameter has been changed to B to match Marlin's 2.0 firmware. Though M205 Q is part of Marlin 1.1.9, we adopt Marlin 2.0's version of the M205 command.

As of firmware release, 119r10, the M665 command includes parameters to individually adjust the diagonal rod length and effective radius for each tower (in a similar manner to adjusting the tower angles). Note that with this change, the calibration radius is now set using the "V" parameter instead of the "B" parameter (not backward compatible with Marlin).

Firmware release, 119r11, includes Marlin's linear advance feature; controlled via the M900 command. It is not clear if linear advance is a workable addition to the firmware, so the feature is disabled by default. More information about linear advance can be found in the Marlin documentation (see Linear Advance).

Codes M988 and M989 are not part of the original Marlin firmware. We've added these codes to provide a mechanism to capture the printer's serial output (in a file on the SD card). This capability is useful in creating some of the utility commands. (For example the AUTOCALIBRATE.gcode command uses M988/M989 to record the results of the entire calibration process.)

G29: Bed Leveling (Automatic) 

G29 P0     ; auto bed level, adjust for height (Z) only (same as G33 P1)
G29 C1     ; create a plane bed level mesh using a least square fit of the existing mesh

As of firmware release, 119r12

G29 C0       ; creates a valid mesh of all zeros (F, B, L, R can also be used)
G29 C0 Z<n>  ; creates a valid mesh of all <n> values (F, B, L, R can also be used)
G29 D        ; (dryrun) does not change the mesh; can be used to sample the bed
G29 J        ; (without W) clears the mesh
G29 W I<n> J<n> U  ; writes NaN in slot (I,J)
G29 Q[1]     ; print the current mesh information 
G29 Q0       ; list the current mesh in settings format
G29 H        ; Marlin 2.0's H parameter is NOT supported

G30: Single Z‑Probe 

As of firmware release, 119r12

; G30 outputs, Bed X: <n> Y: <n> Z: <n> Q: <n>
; where Q: <n> is the mesh-corrected Z value (Q only displays if the mesh is available)

M0‑M1: Unconditional stop 

M0 ...
M1 ...
; uses the pushbutton LED for user input:
; blue flashing -- waiting for user (press to continue)

M20: List SD Card 

M20 P1     ; list SD card contents using long file names

M106: Set Fan Speed 
M107: Fan Off 

M106 ...
M107
; not available with the "auto-control" fan variant of firmware (-ACfan)  
; i.e., available with the "part-cooling" fan variant of firmware (-PCfan)

As of firmware release, 119r12

M106 S<n>  ; set the fan speed, 0-255. (-ACfan: 0 enables the AC fan)
M107       ; disable the fan (-ACfan: enables the AC fan)

M111: Debug Level 

M111 S128  ; (high bit set) disable probe compensation

M115: Firmware Info 

M115       ; also shows version, release, compile-time options, build date

M117: Set LCD Message 

M117 ...   ; non-functional on the LCD - the command is ignored

M118: Serial print 

M118 {<string>}  ; send a control string ({<string>}) to the LCD

M205: Set Advanced Settings 

As of firmware release, 119r12:

M205 B<n>  ; changed to B (from Q) to match Marlin's 2.0 firmware

M401: Deploy Probe 
M402: Stow Probe 

M401       ; the hotend is the probe, so the command is ignored
M402       ; the hotend is the probe, so the command is ignored

M600: Filament Change 

NOTE: If supplied, the absolute value for the parameters E (retract), L (load), and U (unload) must be less than EXTRUDE_MAXLENGTH (500). Thanks to @whudson for bringing this to light.

M600 ...
; uses the pushbutton LED for user input:
; cyan flashing -- waiting for user to insert filament (press to continue)
; yellow flashing -- waiting for user before re-heating nozzle (press to continue)
; yellow solid -- nozzle re-heating, please stand-by
; NOTE: absolute value of E, L, U parameters must be less than EXTRUDE_MAXLENGTH (500)

M665: Delta Configuration 

; as of 119r10 (also note that the previous parameter "B" is now defined as "V")
M665 A<number> B<number> C<number> ; individually adjust to the diagonal rod length
M665 D<number> E<number> F<number> ; individually adjust the effective radius
M665 V<number> ; set the calibration radius

•M988: Open Capture File 

M988 <filename>  ; open an output log file in the root directory (DOS 8.3 format)

•M989: Close Capture File 

M989        ; close an open output log file
M989 P1     ; close and delete an open output log file

M990: Simple Upload 

M990 S<size> /<filename>  ; upload to <filename> (DOS 8.3 format)