Prusa3d Marlin fork
G-Code List

This is a list of currently implemented G Codes in Prusa firmware (dynamically generated from doxygen).

They are shown in order of appearance in the code. There are reasons why some G Codes aren't in numerical order.

Special internal commands

These are used by internal functions to process certain actions in the right order. Some of these are also usable by the user. They are processed early as the commands are complex (strings). These are only available on the MK3(S) as these require TMC2130 drivers:


PRUSA - Internal command set G98: Activate farm mode - Notes

Set of internal PRUSA commands

Usage

PRUSA [ PRN | FAN | thx | uvlo | MMURES | RESET | fv | M28 | SN | Fir | Rev | Lang | Lz | FR ]

Parameters


G Codes

G0, G1 - Coordinated movement X Y Z E G0 & G1: Move

In Prusa Firmware G0 and G1 are the same.

Usage

  G0 [ X | Y | Z | E | F | S ]
  G1 [ X | Y | Z | E | F | S ]

Parameters

G2, G3 - Controlled Arc Move G2 & G3: Controlled Arc Move

These commands don't propperly work with MBL enabled. The compensation only happens at the end of the move, so avoid long arcs.

Usage

  G2 [ X | Y | I | E | F ] (Clockwise Arc)
  G3 [ X | Y | I | E | F ] (Counter-Clockwise Arc)

Parameters

G4 - Dwell G4: Dwell

Pause the machine for a period of time.

Usage

G4 [ P | S ]

Parameters

G10 - Retract G10: Retract

Retracts filament according to settings of M207

G11 - Retract recover G11: Unretract

Unretracts/recovers filament according to settings of M208

G21 - Sets Units to Millimters G21: Set Units to Millimeters

Units are in millimeters. Prusa doesn't support inches.

G28 - Home all Axes one at a time G28: Move to Origin (Home)

Using G28 without any parameters will perfom homing of all axes AND mesh bed leveling, while G28 W will just home all axes (no mesh bed leveling).

Usage

 G28 [ X | Y | Z | W | C ]

Parameters

G29 - Detailed Z-Probe G29: Detailed Z-Probe

In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code.

See G81

G30 - Single Z Probe G30: Single Z-Probe

In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code.

G31 - Dock the sled G31: Dock Z Probe sled

In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code.

G32 - Undock the sled G32: Undock Z Probe sled

In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code.

G30 - Single Z Probe G30: Single Z-Probe

Sensor must be over the bed. The maximum travel distance before an error is triggered is 10mm.

G75 - Print temperature interpolation G75: Print temperature interpolation

Show/print PINDA temperature interpolating.

G76 - PINDA probe temperature calibration G76: PINDA probe temperature calibration

This G-code is used to calibrate the temperature drift of the PINDA (inductive Sensor).

The PINDAv2 sensor has a built-in thermistor which has the advantage that the calibration can be done once for all materials.

The Original i3 Prusa MK2/s uses PINDAv1 and this calibration improves the temperature drift, but not as good as the PINDAv2.

superPINDA sensor has internal temperature compensation and no thermistor output. There is no point of doing temperature calibration in such case. If PINDA_THERMISTOR and SUPERPINDA_SUPPORT is defined during compilation, calibration is skipped with serial message "No PINDA thermistor". This can be caused also if PINDA thermistor connection is broken or PINDA temperature is lower than PINDA_MINTEMP.

Example

G76
echo PINDA probe calibration start
echo start temperature: 35.0°
echo ...
echo PINDA temperature -- Z shift (mm): 0.---

G80 - Mesh-based Z probe G80: Mesh-based Z probe

Default 3x3 grid can be changed on MK2.5/s and MK3/s to 7x7 grid.

Usage

  G80 [ N | C | O | M | L | R | F | B | X | Y | W | H ]

Parameters

Using the following parameters enables additional "manual" bed leveling correction. Valid values are -100 microns to 100 microns.

Additional Parameters

The following parameters are used to define the area used by the print:

G81 - Mesh bed leveling status G81: Mesh bed leveling status

Prints mesh bed leveling status and bed profile if activated.

G82: Single Z probe at current location - Not active G82: Single Z probe at current location

WARNING! USE WITH CAUTION! If you'll try to probe where is no leveling pad, nasty things can happen! In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code.

G83: Babystep in Z and store to EEPROM - Not active G83: Babystep in Z and store to EEPROM

In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code.

G84: UNDO Babystep Z (move Z axis back) - Not active G84: UNDO Babystep Z (move Z axis back)

In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code.

G85: Pick best babystep - Not active G85: Pick best babystep

In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code.

G86 - Disable babystep correction after home G86: Disable babystep correction after home

This G-code will be performed at the start of a calibration script. (Prusa3D specific)

G87 - Enable babystep correction after home G87: Enable babystep correction after home

This G-code will be performed at the end of a calibration script. (Prusa3D specific)

G88 - Reserved G88: Reserved

Currently has no effect.

G90 - Switch off relative mode G90: Set to Absolute Positioning

All coordinates from now on are absolute relative to the origin of the machine. E axis is left intact.

G91 - Switch on relative mode G91: Set to Relative Positioning

All coordinates from now on are relative to the last position. E axis is left intact.

G92 - Set position G92: Set Position

It is used for setting the current position of each axis. The parameters are always absolute to the origin. If a parameter is omitted, that axis will not be affected. If X, Y, or Z axis are specified, the move afterwards might stutter because of Mesh Bed Leveling. E axis is not affected if the target position is 0 (G92 E0). A G92 without coordinates will reset all axes to zero on some firmware. This is not the case for Prusa-Firmware!

Usage

  G92 [ X | Y | Z | E ]

Parameters

G98 - Activate farm mode G98: Activate farm mode

Enable Prusa-specific Farm functions and g-code. See Internal Prusa commands.

G99 - Deactivate farm mode G99: Deactivate farm mode

Disables Prusa-specific Farm functions and g-code.

End of G-Codes


M Commands

M0, M1 - Stop the printer M0: Stop or Unconditional stop

Usage

M0 [P<ms<] [S<sec>] [string] M1 [P<ms>] [S<sec>] [string]

Parameters

M17 - Enable all axes M17: Enable/Power all stepper motors

M20 - SD Card file list M20: List SD card

Usage

M20 [ L | T ]

Parameters

M21 - Init SD card M21: Initialize SD card

M22 - Release SD card M22: Release SD card

M23 - Select file M23: Select SD file

Usage

M23 [filename]

M24 - Start SD print M24: Start/resume SD print

M26 - Set SD index M26: Set SD position

Set position in SD card file to index in bytes. This command is expected to be called after M23 and before M24. Otherwise effect of this command is undefined.

Usage

  M26 [ S ]

Parameters

M27 - Get SD status M27: Report SD print status

Usage

  M27 [ P ]

Parameters

M28 - Start SD write M28: Begin write to SD card

M29 - Stop SD write M29: Stop writing to SD card

Stops writing to the SD file signaling the end of the uploaded file. It is processed very early and it's not written to the card.

M30 - Delete file M30: Delete a file on the SD card

Usage

M30 [filename]

M32 - Select file and start SD print M32: Select file and start SD print

Todo:
What are the parameters P and S for in M32?

M928 - Start SD logging M928: Start SD logging

Usage

M928 [filename]

M31 - Report current print time M31: Output time since last M109 or SD card start to serial

M42 - Set pin state M42: Switch I/O pin

Usage

M42 [ P | S ]

Parameters

M44 - Reset the bed skew and offset calibration M44: Reset the bed skew and offset calibration

M45 - Bed skew and offset with manual Z up M45: Bed skew and offset with manual Z up

Usage

M45 [ V ]

Parameters

M46 - Show the assigned IP address M46: Show the assigned IP address.

M47 - Show end stops dialog on the display M47: Show end stops dialog on the display

M48 - Z-Probe repeatability measurement function M48: Measure Z-Probe repeatability

This function assumes the bed has been homed. Specifically, that a G28 command as been issued prior to invoking the M48 Z-Probe repeatability measurement function. Any information generated by a prior G29 Bed leveling command will be lost and needs to be regenerated.

The number of samples will default to 10 if not specified. You can use upper or lower case letters for any of the options EXCEPT n. n must be in lower case because Marlin uses a capital N for its communication protocol and will get horribly confused if you send it a capital N.

Todo:
Why would you check for both uppercase and lowercase? Seems wasteful.

Usage

M48 [ n | X | Y | V | L ]

Parameters

M72 - Set/get Printer State M72: Set/get Printer State

Without any parameter get printer state

Usage

M72 [ S ]

Parameters

M73 - Set/get print progress M73: Set/Get build percentage

Usage

M73 [ P | R | Q | S | C | D ]

Parameters

M75 - Start the print job timer M75: Start the print job timer

M76 - Pause the print job timer M76: Pause the print job timer

M77 - Stop the print job timer M77: Stop the print job timer

M78 - Show statistical information about the print jobs M78: Show statistical information about the print jobs

M79 - Start host timer M79: Start host timer

Start the printer-host enable keep-alive timer. While the timer has not expired, the printer will enable host specific features.

Usage

M79 [ S ]

Parameters

M104 - Set hotend temperature M104: Set Extruder Temperature

Usage

M104 [ S ]

Parameters

M112 - Emergency stop M112: Full (Emergency) Stop

It is processed much earlier as to bypass the cmdqueue.

M140 - Set bed temperature M140: Set Bed Temperature (Fast)

Usage

M140 [ S ]

Parameters

M105 - Report temperatures M105: Get Extruder Temperature

Prints temperatures:

Example:

ok T:20.2 /0.0 B:19.1 /0.0 T0:20.2 /0.0 @:0 B@:0 P:19.8 A:26.4

M155 - Automatically send status M155: Automatically send temperatures

Usage

M155 [ S ] [ C ]

Parameters

M109 - Wait for extruder temperature M109: Set Extruder Temperature and Wait

Usage

M104 [ B | R | S ]

Parameters (not mandatory)

Parameters S and R are treated identically. Command always waits for both cool down and heat up. If no parameters are supplied waits for previously set extruder temperature.

M190 - Wait for bed temperature M190: Wait for bed temperature to reach target temp

Usage

M190 [ R | S ]

Parameters (not mandatory)

If no parameter is supplied, waits for heating or cooling to previously set temperature.

M106 - Set fan speed M106: Fan On

Usage

M106 [ S ]

Parameters

M107 - Fan off M107: Fan Off

M80 - Turn on the Power Supply M80: ATX Power On

Only works if the firmware is compiled with PS_ON_PIN defined.

M81 - Turn off Power Supply M81: ATX Power Off

Only works if the firmware is compiled with PS_ON_PIN defined.

M82 - Set E axis to absolute mode M82: Set extruder to absolute mode

Makes the extruder interpret extrusion as absolute positions.

M83 - Set E axis to relative mode M83: Set extruder to relative mode

Makes the extruder interpret extrusion values as relative positions.

M84 - Disable steppers M84: Stop idle hold

This command can be used to set the stepper inactivity timeout (S) or to disable steppers (X,Y,Z,E) This command can be used without any additional parameters. In that case all steppers are disabled.

The file completeness check uses this parameter to detect an incomplete file. It has to be present at the end of a file with no parameters.

M84 [ S | X | Y | Z | E ]

M18 - Disable steppers M18: Disable all stepper motors

Equal to M84 (compatibility)

M85 - Set max inactive time M85: Set Inactivity Shutdown Timer

Usage

M85 [ S ]

Parameters

M86 - Set safety timer expiration time M86: Set Safety Timer expiration time

When safety timer expires, heatbed and nozzle target temperatures are set to zero.

Usage

M86 [ S ]

Parameters

M92 Set Axis steps-per-unit M92: Set axis_steps_per_unit

Allows programming of steps per unit (usually mm) for motor drives. These values are reset to firmware defaults on power on, unless saved to EEPROM if available (M500 in Marlin)

Usage

M92 [ X | Y | Z | E ]

Parameters

M110 - Set Line number M110: Set Current Line Number

Sets the line number in G-code

Usage

M110 [ N ]

Parameters

M113 - Get or set host keep-alive interval M113: Host Keepalive

During some lengthy processes, such as G29, Marlin may appear to the host to have “gone away.” The “host keepalive” feature will send messages to the host when Marlin is busy or waiting for user response so the host won’t try to reconnect (or disconnect).

Usage

M113 [ S ]

Parameters

M115 - Firmware info M115: Get Firmware Version and Capabilities

Print the firmware info and capabilities Without any arguments, prints Prusa firmware version number, machine type, extruder count and UUID. M115 U Checks the firmware version provided. If the firmware version provided by the U code is higher than the currently running firmware, it will pause the print for 30s and ask the user to upgrade the firmware.

Examples:

M115 results:

FIRMWARE_NAME:Prusa-Firmware 3.8.1 based on Marlin FIRMWARE_URL:https://github.com/prusa3d/Prusa-Firmware PROTOCOL_VERSION:1.0 MACHINE_TYPE:Prusa i3 MK3S EXTRUDER_COUNT:1 UUID:00000000-0000-0000-0000-000000000000

M115 V results:

3.8.1

M115 U3.8.2-RC1 results on LCD display for 30s or user interaction:

New firmware version available: 3.8.2-RC1 Please upgrade.

Usage

M115 [ V | U ]

Parameters

M114 - Get current position M114: Get Current Position

M117 - Display Message M117: Display Message

M118 - Serial print M118: Serial print

Usage

M118 [ A1 | E1 ] [ String ]

Parameters

M120 - Enable endstops M120: Enable endstop detection

M121 - Disable endstops M121: Disable endstop detection

M119 - Get endstop states M119: Get Endstop Status

Returns the current state of the configured X, Y, Z endstops. Takes into account any 'inverted endstop' settings, so one can confirm that the machine is interpreting the endstops correctly.

Todo:
update for all axes, use for loop

M123 - Tachometer value M123: Tachometer value

This command is used to report fan speeds and fan pwm values.

Usage

  M123

Example:

E0:3240 RPM PRN1:4560 RPM E0@:255 PRN1@:255

M150 - Set RGB(W) Color M150: Set LED color

In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code by defining BLINKM and its dependencies.

Usage

M150 [ R | U | B ]

Parameters

M200 - Set filament diameter M200: Set filament diameter

Usage

M200 [ D | T ]

Parameters

M201 - Set Print Max Acceleration M201: Set max printing acceleration

For each axis individually.

Usage

M201 [ X | Y | Z | E ]

Parameters

M203 - Set Max Feedrate M203: Set maximum feedrate

For each axis individually.

Usage

M203 [ X | Y | Z | E ]

Parameters

M204 - Acceleration settings M204: Set default acceleration

Old format:

Usage
M204 [ S | T ]
Parameters

New format:

Usage
M204 [ P | R | T ]
Parameters

M205 - Set advanced settings M205: Advanced settings

Set some advanced settings related to movement.

Usage

M205 [ S | T | B | X | Y | Z | E ]

Parameters

M206 - Set additional homing offsets M206: Offset axes

Usage

M206 [ X | Y | Z ]

Parameters

M207 - Set firmware retraction M207: Set retract length

Usage

M207 [ S | F | Z ]

Parameters

M208 - Set retract recover length M208: Set unretract length

Usage

M208 [ S | F ]

Parameters

M209 - Enable/disable automatict retract M209: Enable automatic retract

This boolean value S 1=true or 0=false enables automatic retract detect if the slicer did not support G10/G11: every normal extrude-only move will be classified as retract depending on the direction.

Usage

M209 [ S ]

Parameters

M214 - Set Arc configuration values (Use M500 to store in eeprom) M214: Set Arc configuration values

Usage

M214 [P] [S] [N] [R] [F]

Parameters


M214 - Set Arc Parameters (Use M500 to store in eeprom) P<MM_PER_ARC_SEGMENT> S<MIN_MM_PER_ARC_SEGMENT> R<MIN_ARC_SEGMENTS> F<ARC_SEGMENTS_PER_SEC>

M220 Set feedrate percentage M220: Set speed factor override percentage

Usage

M220 [ B | S | R ]

Parameters

M221 - Set extrude factor override percentage M221: Set extrude factor override percentage

Usage

M221 [ S ]

Parameters

M226 - Wait for Pin state M226: Wait for pin state

Wait until the specified pin reaches the state required

Usage

M226 [ P | S ]

Parameters

M280 - Set/Get servo position M280: Set servo position

In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code.

Usage

M280 [ P | S ]

Parameters

M300 - Play tone M300: Play beep sound

In Prusa Firmware the defaults are 100Hz and 1000ms, so that M300 without parameters will beep for a second.

Usage

M300 [ S | P ]

Parameters

M301 - Set hotend PID M301: Set PID parameters

Sets Proportional (P), Integral (I) and Derivative (D) values for hot end. See also PID Tuning.

Usage

M301 [ P | I | D ]

Parameters

M304 - Set bed PID M304: Set PID parameters - Bed

Sets Proportional (P), Integral (I) and Derivative (D) values for bed. See also PID Tuning.

Usage

M304 [ P | I | D ]

Parameters

M240 - Trigger camera M240: Trigger camera

In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code.

You need to (re)define and assign CHDK or PHOTOGRAPH_PIN the correct pin number to be able to use the feature.

M302 - Allow cold extrude, or set minimum extrude temperature M302: Allow cold extrudes

This tells the printer to allow movement of the extruder motor above a certain temperature, or if disabled, to allow extruder movement when the hotend is below a safe printing temperature.

Usage

M302 [ S ]

Parameters

M303 - PID autotune M303: Run PID tuning

PID Tuning refers to a control algorithm used in some repraps to tune heating behavior for hot ends and heated beds. This command generates Proportional (Kp), Integral (Ki), and Derivative (Kd) values for the hotend or bed. Send the appropriate code and wait for the output to update the firmware values.

Usage

M303 [ E | S | C ]

Parameters

M310 - Thermal model settings M310: Thermal model settings

Usage

M310                                           ; report values
M310 [ A ] [ F ]                               ; autotune
M310 [ S ]                                     ; set 0=disable 1=enable
M310 [ I ] [ R ]                               ; set resistance at index
M310 [ P | U | V | C ]                         ; set power, temperature coefficient, intercept, capacitance
M310 [ D | L ]                                 ; set simulation filter, lag
M310 [ B | E | W ]                             ; set beeper, warning and error threshold
M310 [ T ]                                     ; set ambient temperature correction

Parameters

M400 - Wait for all moves to finish M400: Wait for current moves to finish

Finishes all current moves and and thus clears the buffer. Equivalent to G4 with no parameters.

M403 - Set filament type (material) for particular extruder and notify the MMU M403 - Set filament type (material) for particular extruder and notify the MMU

Currently three different materials are needed (default, flex and PVA).
And storing this information for different load/unload profiles etc. in the future firmware does not have to wait for "ok" from MMU.

Usage

M403 [ E | F ]

Parameters

M405 - Filament Sensor on M405: Filament Sensor on

Turn on Filament Sensor extrusion control.

Usage

M405

M406 - Filament Sensor off M406: Filament Sensor off

Turn off Filament Sensor extrusion control.

Usage

M406

M420 - Mesh bed leveling status M420: Mesh bed leveling status

Prints mesh bed leveling status and bed profile if activated.

M500 - Store settings in EEPROM M500: Store parameters in non-volatile storage

Save current parameters to EEPROM.

M501 - Read settings from EEPROM M501: Read parameters from EEPROM

Set the active parameters to those stored in the EEPROM. This is useful to revert parameters after experimenting with them.

M502 - Revert all settings to factory default M502: Restore Default Settings

This command resets all tunable parameters to their default values, as set in the firmware's configuration files. This doesn't reset any parameters stored in the EEPROM, so it must be followed by M500 to write the default settings.

M503 - Repport all settings currently in memory M503: Report Current Settings

This command asks the firmware to reply with the current print settings as set in memory. Settings will differ from EEPROM contents if changed since the last load / save. The reply output includes the G-Code commands to produce each setting. For example, Steps-Per-Unit values are displayed as an M92 command.

M509 - Force language selection M509: Force language selection

Resets the language to English. Only on Original Prusa i3 MK2.5/s and MK3/s with multiple languages.

M540 - Abort print on endstop hit (enable/disable) M540 in Marlin: Enable/Disable "Stop SD Print on Endstop Hit"

In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code. You must define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED.

Usage

M540 [ S ]

Parameters

M851 - Set Z-Probe Offset M851: Set Z-Probe Offset"

Sets the Z-probe Z offset. This offset is used to determine the actual Z position of the nozzle when using a probe to home Z with G28. This value may also be used by G81 (Prusa) / G29 (Marlin) to apply correction to the Z position. This value represents the distance from nozzle to the bed surface at the point where the probe is triggered. This value will be negative for typical switch probes, inductive probes, and setups where the nozzle makes a circuit with a raised metal contact. This setting will be greater than zero on machines where the nozzle itself is used as the probe, pressing down on the bed to press a switch. (This is a common setup on delta machines.)

Usage

M851 [ Z ]

Parameters

M552 - Set IP address M552: Set IP address, enable/disable network interface"

Sets the printer IP address that is shown in the support menu. Designed to be used with the help of host software. If P is not specified nothing happens. If the structure of the IP address is invalid, 0.0.0.0 is assumed and nothing is shown on the screen in the Support menu.

Usage

M552 [ P<IP_address> ]

Parameters

M600 - Initiate Filament change procedure M600: Filament change pause

Initiates Filament change, it is also used during Filament Runout Sensor process. If the M600 is triggered under 25mm it will do a Z-lift of 25mm to prevent a filament blob.

Usage

M600 [ X | Y | Z | E | L | AUTO ]

M601 - Pause print M601: Pause print

Without any parameters it will park the extruder to default or last set position. The default pause position will be set during power up and a reset, the new pause positions aren't permanent.

Usage

 M601 [ X | Y | Z | S ]

Parameters

M125 - Pause print M125: Pause print

Without any parameters it will park the extruder to default or last set position. The default pause position will be set during power up and a reset, the new pause positions aren't permanent.

Usage

 M125 [ X | Y | Z | S ]

Parameters

M25 - Pause SD print M25: Pause SD print

Without any parameters it will park the extruder to default or last set position. The default pause position will be set during power up and a reset, the new pause positions aren't permanent.

Usage

 M25 [ X | Y | Z | S ]

Parameters

M602 - Resume print M602: Resume print

M603 - Stop print M603: Stop print

M850 - Sheet parameters M850: Sheet parameters

Get and Set Sheet parameters

Usage

 M850 [ S | Z | L | B | P | A ]

Parameters

M860 - Wait for extruder temperature (PINDA) M860 Wait for Probe Temperature

Wait for PINDA thermistor to reach target temperature

Usage

M860 [ S ]

Parameters

M861 - Set/Get PINDA temperature compensation offsets M861 Set Probe Thermal Compensation

Set compensation ustep value S for compensation table index I.

Usage

M861 [ ? | ! | Z | S | I ]

Parameters

M862 - Print checking M862: Print checking

Checks the parameters of the printer and gcode and performs compatibility check

When run with P<> argument, the check is performed against the input value. When run with Q argument, the current value is shown.

M862.3 accepts text identifiers of printer types too. The syntax of M862.3 is (note the quotes around the type):

  M862.3 P "MK3S"

Accepted printer type identifiers and their numeric counterparts:

M900 - Set Linear advance options M900 Set Linear Advance Scaling Factors

Sets the advance extrusion factors for Linear Advance. If any of the R, W, H, or D parameters are set to zero the ratio will be computed dynamically during printing.

Usage

M900 [ K | R | W | H | D]

Parameters

M907 - Set digital trimpot motor current in mA using axis codes M907: Set digital trimpot motor

Set digital trimpot motor current using axis codes (X, Y, Z, E, B, S). M907 has no effect when the experimental Extruder motor current scaling mode is active (that applies to farm printing as well)

Usage

M907 [ X | Y | Z | E | B | S ]

Parameters

M908 - Control digital trimpot directly M908: Control digital trimpot directly

In Prusa Firmware this G-code is deactivated by default, must be turned on in the source code. Not usable on Prusa printers.

Usage

M908 [ P | S ]

Parameters

M910 - TMC2130 init M910: TMC2130 init

Not active in default, only if TMC2130_SERVICE_CODES_M910_M918 is defined in source code.

M911 - Set TMC2130 holding currents M911: Set TMC2130 holding currents

Not active in default, only if TMC2130_SERVICE_CODES_M910_M918 is defined in source code.

Usage

M911 [ X | Y | Z | E ]

Parameters

M912 - Set TMC2130 running currents M912: Set TMC2130 running currents

Not active in default, only if TMC2130_SERVICE_CODES_M910_M918 is defined in source code.

Usage

M912 [ X | Y | Z | E ]

Parameters

M913 - Print TMC2130 currents M913: Print TMC2130 currents

Not active in default, only if TMC2130_SERVICE_CODES_M910_M918 is defined in source code. Shows TMC2130 currents.

M914 - Set TMC2130 normal mode M914: Set TMC2130 normal mode

Updates EEPROM only if "P" is given, otherwise temporary (lasts until reset or motor idle timeout)

Usage

M914 [ P | R | Q ]

Parameters

M915 - Set TMC2130 silent mode M915: Set TMC2130 silent mode

Updates EEPROM only if "P" is given, otherwise temporary (lasts until reset or motor idle timeout)

Usage

M915 [ P | R | Q]

Parameters

M916 - Set TMC2130 Stallguard sensitivity threshold M916: Set TMC2130 Stallguard sensitivity threshold

Not active in default, only if TMC2130_SERVICE_CODES_M910_M918 is defined in source code.

Usage

M916 [ X | Y | Z | E ]

Parameters

M917 - Set TMC2130 PWM amplitude offset (pwm_ampl) M917: Set TMC2130 PWM amplitude offset (pwm_ampl)

Not active in default, only if TMC2130_SERVICE_CODES_M910_M918 is defined in source code.

Usage

M917 [ X | Y | Z | E ]

Parameters

M918 - Set TMC2130 PWM amplitude gradient (pwm_grad) M918: Set TMC2130 PWM amplitude gradient (pwm_grad)

Not active in default, only if TMC2130_SERVICE_CODES_M910_M918 is defined in source code.

Usage

M918 [ X | Y | Z | E ]

Parameters

M350 - Set microstepping mode M350: Set microstepping mode

Printers with TMC2130 drivers have X, Y, Z and E as options. The steps-per-unit value is updated accordingly. Not all resolutions are valid! Printers without TMC2130 drivers also have B and S options. In this case, the steps-per-unit value in not changed!

Usage

M350 [ X | Y | Z | E | B | S ]

Parameters

Only valid for MK2.5(S) or printers without TMC2130 drivers

M351 - Toggle Microstep Pins M351: Toggle MS1 MS2 pins directly

Toggle MS1 MS2 pins directly.

Usage

M351 [B<0|1>] [E<0|1>] S<1|2> [X<0|1>] [Y<0|1>] [Z<0|1>]

Parameters

M701 - Load filament to extruder M701: Load filament

Load filament into the active extruder.

Usage

M701 [ P | T | L | Z ]

Parameters

M702 - Unload filament M702: Unload filament

Usage

M702 [ U | Z ]

Parameters

M704 - Preload to MMU M704: Preload to MMU

Usage

M704 [ P ]

Parameters

M705 - Eject filament M705: Eject filament

Usage

M705 [ P ]

Parameters

M706 - Cut filament M706: Cut filament

Usage

M706 [ P ]

Parameters

M707 - Read from MMU register M707: Read from MMU register

Usage

M707 [ A ]

Parameters

Example

M707 A0x1b - Read a 8bit integer from register 0x1b and prints the result onto the serial line.

Does nothing if the A parameter is not present or if MMU is not enabled.

M708 - Write to MMU register M707: Write to MMU register

Usage

M708 [ A | X ]

Parameters

Example

M708 A0x1b X05 - Write to register 0x1b the value 05.

Does nothing if A parameter is missing or if MMU is not enabled.

M709 - MMU power & reset M709: MMU power & reset

The MK3S cannot not power off the MMU, but we can en- and disable the MMU.

The new state of the MMU is stored in printer's EEPROM - i.e. if you disable the MMU via M709, it will not be activated after the printer resets.

Usage

M709 [ S | X ]

Parameters

Example

M709 X0 - issue an X0 command via communication into the MMU (soft reset)

M709 X1 - toggle the MMU's reset pin (hardware reset)

M709 X42 - erase MMU EEPROM

M709 S1 - enable MMU

M709 S0 - disable MMU

M709 - Serial message if en- or disabled

End of M-Commands


T<extruder nr.> - select extruder in case of multi extruder printer. Selects filament position 1-5 (T0-T4) in case of MMU.

For MMU2/S / MMU3: T<extruder nr.> - Selects the filament position. A Gcode to load a filament to the nozzle must follow. Tx - Printer asks user to select a filament position. Then loads the filament from the MMU unit into the extruder wheels only. G-code to heat up the nozzle follows. Tc - Loads the filament tip from the extruder wheels into the nozzle. T? - acts the same as Tx followed by Tc

End of T-Codes


D codes

D-1 - Endless Loop D-1: Endless Loop

D0 - Reset D0: Reset

Usage

D0 [ B ]

Parameters

D1 - Clear EEPROM and RESET D1: Clear EEPROM and RESET

  D1

D2 - Read/Write RAM D3: Read/Write RAM

This command can be used without any additional parameters. It will read the entire RAM.

Usage

D2 [ A | C | X ]

Parameters

Notes

D3 - Read/Write EEPROM D3: Read/Write EEPROM

This command can be used without any additional parameters. It will read the entire eeprom.

Usage

D3 [ A | C | X ]

Parameters

Notes

D4 - Read/Write PIN D4: Read/Write PIN

To read the digital value of a pin you need only to define the pin number.

Usage

D4 [ P | F | V ]

Parameters

D5 - Read/Write FLASH D5: Read/Write Flash

This command can be used without any additional parameters. It will read the 1kb FLASH.

Usage

D5 [ A | C | X | E ]

Parameters

Notes

D6 - Read/Write external FLASH D6: Read/Write external Flash

Reserved

D7 - Read/Write Bootloader D7: Read/Write Bootloader

Reserved

D8 - Read/Write PINDA D8: Read/Write PINDA

Usage

D8 [ ? | ! | P | Z ]

Parameters

D9 - Read ADC D9: Read ADC

Usage

D9 [ I | V ]

Parameters

D10 - Set XYZ calibration = OK D10: Set XYZ calibration = OK

D12 - Time D12: Time

Writes the current time in the log file.

D20 - Generate an offline crash dump D20: Generate an offline crash dump

Generate a crash dump for later retrival.

Usage

D20 [E]

Parameters

D21 - Print crash dump to serial D21: Print crash dump to serial

Output the complete crash dump (if present) to the serial.

Usage

D21

Notes

D22 - Clear crash dump state D22: Clear crash dump state

Clear an existing internal crash dump.

Usage

D22

D23 - Request emergency dump on serial D23: Request emergency dump on serial

On boards without offline dump support, request online dumps to the serial port on firmware faults. When online dumps are enabled, the FW will dump memory on the serial before resetting.

Usage

D23 [E] [R]

Parameters

D70 - Enable low-level thermal model logging for offline simulation

Usage

D70 [ S ]

Parameters

D80 - Bed check D80: Bed check

This command will log data to SD card file "mesh.txt".

Usage

D80 [ E | F | G | H | I | J ]

Parameters

D81 - Bed analysis D80: Bed analysis

This command will log data to SD card file "wldsd.txt".

Usage

D81 [ E | F | G | H | I | J ]

Parameters

D106 - Print measured fan speed for different pwm values D106: Print measured fan speed for different pwm values

D2130 - Trinamic stepper controller D2130: Trinamic stepper controller

Todo:
Please review by owner of the code. RepRap Wiki Gcode needs to be updated after review of owner as well.

Usage

D2130 [ Axis | Command | Subcommand | Value ]

Parameters

Examples:

  D2130E?wave

Print extruder microstep linearity compensation curve

D2130E!wave0

Disable extruder linearity compensation curve, (sine curve is used)

D2130E!wave220

(sin(x))^1.1 extruder microstep compensation curve used

Notes: For more information see https://www.trinamic.com/fileadmin/assets/Products/ICs_Documents/TMC2130_datasheet.pdf

D9125 - PAT9125 filament sensor D9125: PAT9125 filament sensor

Usage

D9125 [ ? | ! | R | X | Y | L ]

Parameters

End of D-Codes