Site Navigation

Your Account

Choose Language


This page describes the RepRapFirmware supported G-codes, originally based on the information from the [ RepRap wiki G-code page].


This page describes the RepRapFirmware supported G-codes, originally based on the information from the

G-Codes are a widely used machine control language. They are human readable and editable. RepRapFirmware follows the philosophy of "G-code everywhere", in essence the users or external program's interaction with the firmware should be through G-codes. There are G-codes for all supported control and configuration inputs along with status and debugging information.

There are some G-Codes listed on the that are not implemented in RepRapFirmware. More details can be found on the G-Codes not implemented page.


Introduction ¶ 

A typical piece of G-code sent to a machine running RepRapFirmware might look like this (The meaning of these codes (and more) is explained below on this page.)

G10 P0 S195 R175
G1 X100 Y100 Z0.3 F3000
G1 X100.4 Y99.3 E0.23 F600
'''....many 1000 more lines'''


G-Code Everywhere ¶ 

A design philosophy of RepRapFirmware is "G-code everywhere" what this means is explained in this sub section

The G-code can originate from a number of sources:

In all cases the G-Code could

  • be entered by user one line at time, for example during configuration or testing
  • be sent by the User Interface (Pronterface, Web Interface or PanelDue) in response to the user pressing buttons
  • originate from macros that are triggered on startup, on certain events (such as error conditions), or called by the user or UI.
  • be from a g-code file which are normally stored on the on-board or external SD card.

A key difference from other 3d printer firmwares is not employing a separate command set (other than G-codes) to configure the printer. To that end RepRapFirmware has a large collection of configuration g-codes that allow the behaviour of the machine to be controlled. For some examples of when these G-Codes are employed have a look at these wiki pages:

The advantage of "G-code everywhere" is the same commands can be send from any of the G-Code sources, and originate from the user, a UI, macro or file and it will generate the same response from the firmware. This greatly improves the ease and power of firmware configuration and operation.


G-Code Structure ¶ 

This section explains the elements that make up a G-Code command.

Comments ¶ 

G-Code comments begin at a semicolon, and end at the end of the line:

T0 ; This is a comment
G92 E0
''';So is this'''

Alternatively, comments can be enclosed in brackets, but they must start and end on the same line:

G28 (here come the axes to be homed) X Y

Comments and white space will be ignored by RepRapFirmware when executing the G-Code


Fields ¶ 

A RepRap G-Code is a list of fields that are separated by white spaces or line breaks. A field can be interpreted as a command, parameter, or for any other special purpose. It consists of one letter directly followed by a number, or can be only a stand-alone letter (Flag). The letter gives information about the meaning of the field (see the list below in this section). Numbers can be integers (128) or fractional numbers (12.42), depending on context. For example, an X coordinate can take integers (X175) or fractionals (X17.62), but selecting extruder number 2.76 would make no sense. In this description, the numbers in the fields are represented by nnn as a placeholder.

In RepRapFirmware, some parameters can be followed by more than one number, with colon used to separate them. Typically this is used to specify extruder parameters, with one value provided per extruder. If only one value is provided where a value is needed for each extruder, then that value is applied to all extruders.

GnnnStandard G-Code command, such as move to a point
MnnnRepRap-defined command, such as turn on a cooling fan
TnnnSelect tool nnn. In RepRap, a tool is typically associated with a nozzle, which may be fed by one or more extruders.
SnnnCommand parameter, such as time in seconds; temperatures; voltage to send to a motor
PnnnCommand parameter, such as time in milliseconds; proportional (Kp) in PID Tuning
XnnnA X coordinate, usually to move to. This can be an Integer or Fractional number.
YnnnA Y coordinate, usually to move to. This can be an Integer or Fractional number.
ZnnnA Z coordinate, usually to move to. This can be an Integer or Fractional number.
U,V,WAdditional axis coordinates
InnnParameter - X-offset in arc move (Not yet implemented in RepRapFirmware); integral (Ki) in PID Tuning; signal inversion
JnnnParameter - Y-offset in arc move (Not yet implemented in RepRapFirmware)
DnnnParameter - used for diameter; derivative (Kd) in PID Tuning; drive number
HnnnParameter - used for heater number in PID Tuning
FnnnFeedrate in mm per minute. (Speed of print head movement)
RnnnParameter - used for temperatures
QnnnParameter - not currently used
EnnnLength of filament to move through the extruder. This is exactly like X, Y and Z, but for the length of filament to consume.
NnnnLine number. Used to request repeat transmission in the case of communications errors. Optional
*nnnChecksum. Used to check for communications errors. Optional

Case sensitivity ¶ 

The original NIST GCode standard requires gcode interpreters to be case-insensitive, except for characters in comments. However, not all 3D printer firmwares conform to this and some recognise uppercase command letters and parameters only.

RepRapFirmware version 1.19 and later is case-insensitive, except for characters within quoted strings. RepRapFirmware version 1.18 and earlier accept only uppercase letters for command and parameter letters.

Quoted strings ¶ 

In RepRapFirmware, some commands support quoted strings when providing file names and other string parameters. This allows file names, WiFi passwords etc. to contain spaces, semicolons and other characters that would otherwise not be permitted. Double-quote characters are used to delimit the string, and any double-quote character within the string must be repeated.

Unfortunately, many gcode sender programs convert all characters to uppercase and don't provide any means to disable this feature. Therefore, within a quoted-string, the single-quote character is used as a flag to force the following character to lowercase. If you want to include a single quote character in the string, use two single quote characters to represent one single quote character.

Example: to add SSID MYROUTER with password ABCxyz;" 123 to the WiFi network list, use command:

M587 S"MYROUTER" P"ABCxyz;"" 123"

or if you can't send lowercase characters:

M587 S"MYROUTER" P"ABC'X'Y'Z;"" 123"

Checking ¶ 

This is an optional feature that is seldom used as g-code files are normally printed form the on-board SD card.

N: Line number

Example: N123

If present, the line number should be the first field in a line. For G-code stored in files on SD cards the line number is usually omitted.

If checking is supported, the firmware expects line numbers to increase by 1 each line, and if that doesn't happen it is flagged as an error. But you can reset the count using M110 (see below).

*: Checksum

Example: *71

If present, the checksum should be the last field in a line, but before a comment. For G-code stored in files on SD cards the checksum is usually omitted.

If checking is supported, the RepRap firmware checks the checksum against a locally-computed value and, if they differ, requests a repeat transmission of the line of the given number.


Example: N123 [...G Code in here...] *71

The firmware checks the line number and the checksum.

You can leave both of these out - RepRap will still work, but it won't do checking. You have to have both or neither though.

If only one appears, it produces an error.

The checksum "cs" for a G-Code string "cmd" (including its line number) is computed by exor-ing the bytes in the string up to and not including the * character as follows:

int cs = 0;
for(i = 0; cmd[i] != '*' && cmd[i] != NULL; i++)
 cs = cs ^ cmd[i];
cs &= 0xff; // Defensive programming...

and the value is appended as a decimal integer to the command after the * character.


Buffering ¶ 

RepRapFirmware stores some commands in a ring buffer internally for execution. This means that there is no (appreciable) delay while a command is acknowledged and the next transmitted. In turn, this means that sequences of line segments can be plotted without a dwell between one and the next. As soon as one of these buffered commands is received it is acknowledged and stored locally. If the local buffer is full, then the acknowledgement is delayed until space for storage in the buffer is available. This is how flow control is achieved.

The following moving commands are buffered: G0-G3 and G28-G32. All other G, M or T commands are not buffered.

Older versions of RepRapFirmware implemented an internal queue to ensure that certain codes (like M106) are executed in the right order and not when the last move has been added to the look-ahead queue. This feature is currently not available in current versions of RepRapFirmware

When an unbuffered command is received it is stored, but it is not acknowledged to the host until the buffer is exhausted and then the command has been executed.


G-commands ¶ 

G0 & G1: Move ¶ 

  • G0 : Rapid linear Move
  • G1 : Linear Move


  • G0 Xnnn Ynnn Znnn Ennn Fnnn Snnn
  • G1 Xnnn Ynnn Znnn Ennn Fnnn Snnn


  • Not all parameters need to be used, but at least one has to be used
  • Xnnn The position to move to on the X axis
  • Ynnn The position to move to on the Y axis
  • Znnn The position to move to on the Z axis
  • Ennn The amount to extrude between the starting point and ending point
  • Fnnn The feedrate per minute of the move between the starting point and ending point (if supplied)
  • Snnn Flag to check if an endstop was hit (S1 to check, S0 to ignore, S2+S3 see note, default is S0) 1
  • R1 Return to the coordinates a print was previously paused at. 2


  • G0 X12 ;(move to 12mm on the X axis)
  • G0 F1500 ;(Set the feedrate to 1500mm/minute)
  • G1 X90.6 Y13.8 E22.4 ;(Move to 90.6mm on the X axis and 13.8mm on the Y axis while extruding 22.4mm of material)

RepRapFirmware treats G0 and G1 as the same command, since it's just as efficient as not doing so.3


G1 F1500
G1 X50 Y25.3 E22.4

In the above example, we set the feedrate to 1500mm/minute on line 1, then move to 50mm on the X axis and 25.3mm on the Y axis while extruding 22.4mm of filament between the two points.

G1 F1500
G1 X50 Y25.3 E22.4 F3000

However, in the above example, we set a feedrate of 1500mm/minute on line 1, then do the move described above accelerating to a feedrate of 3000 mm/minute as it does so. The extrusion will accelerate along with the X and Y movement, so everything stays synchronized.

Feedrate is treated as simply another variable (like X, Y, Z, and E) to be linearly interpolated. This gives complete control over the acceleration and deceleration of the printer head in such a way that ensures that everything moves smoothly together, and the right volume of material is extruded at all points. The feedrate specified may not be reached due to a lower feedrate limit being configured, or the move being too short for the axis to accelerate and decelerate in time.

For CNC users especially: RRF has a minimum movement speed of 0.5mm/sec


1RepRapFirmware can be set to enable or disable the "sensing" of endstops during a move. Using the S1 or S2 parameter on a delta printer causes the XYZ parameters to refer to the individual tower motor positions instead of the head position, and to enable endstop detection as well if the parameter is S1. If S3 is passed instead, RepRapFirmware will measure the axis length.

2If this parameter is used and the code contains axis letters, an offset will be added to the pause coordinates (e.g. G1 R1 Z5).

3In the RS274NGC Spec, G0 is Rapid Move, which was used to move between the current point in space and the new point as quickly and efficiently as possible, and G1 is Controlled Move, which was used to move between the current point in space and the new point as precise as possible. Some older machines, CNC or otherwise, used to move faster if they did not move in a straight line. This is also true for some non-Cartesian printers, like delta or polar printers, which move easier and faster in a curve.


G2 & G3: Controlled Arc Move ¶ 

Supported by firmware 1.18 and later.


  • G2 Xnnn Ynnn Innn Jnnn Ennn Fnnn (Clockwise Arc)
  • G3 Xnnn Ynnn Innn Jnnn Ennn Fnnn (Counter-Clockwise Arc)


  • Xnnn The position to move to on the X axis.
  • Ynnn The position to move to on the Y axis.
  • Innn The point in X space from the current X position to maintain a constant distance from.
  • Jnnn The point in Y space from the current Y position to maintain a constant distance from.
  • Ennn The amount to extrude between the starting point and ending point.
  • Fnnn The feedrate per minute of the move between the starting point and ending point (if supplied).


  • G2 X90.6 Y13.8 I5 J10 E22.4 (Move in a Clockwise arc from the current point to point (X=90.6,Y=13.8), with a center point at (X=current_X+5, Y=current_Y+10), extruding 22.4mm of material between starting and stopping)
  • G3 X90.6 Y13.8 I5 J10 E22.4 (Move in a Counter-Clockwise arc from the current point to point (X=90.6,Y=13.8), with a center point at (X=current_X+5, Y=current_Y+10), extruding 22.4mm of material between starting and stopping)


G4: Dwell ¶ 

Pause the machine for a period of time.


  • Pnnn Time to wait, in milliseconds
  • Snnn Time to wait, in seconds


  • G4 P200

In this case sit still doing nothing for 200 milliseconds. During delays the state of the machine (for example the temperatures of its extruders) will still be preserved and controlled.


G10: Tool Offset ¶ 

This form of the G10 command is recognised by having a P, R or S parameter but no L parameter.


  • G10 Pnnn Xnnn Ynnn Znnn Rnnn Snnn


  • Pnnn Tool number
  • Xnnn X offset
  • Ynnn Y offset
  • U,V,Wnnn U, V and W axis offsets1
  • Znnn Z offset2
  • Rnnn Standby temperature(s)
  • Snnn Active temperature(s)


  • G10 P2 X17.8 Y-19.3 Z0.0 (sets the offset for tool (or in older implementations extrude head) 2 to the X, Y, and Z values specified)
  • G10 P1 R140 S205 (set standby and active temperatures for tool 1)

Remember that any parameter that you don't specify will automatically be set to the last value for that parameter. That usually means that you want explicitly to set Z0.0. RepRapFirmware will report the tool parameters if only the tool number is specified.

The R value is the standby temperature in oC that will be used for the tool, and the S value is its operating temperature. If you don't want the tool to be at a different temperature when not in use, set both values the same. See the T code (select tool) below. In tools with multiple heaters the temperatures for them all are specified thus: R100.0:90.0:20.0 S185.0:200.0:150.0 .

See also M585 and this forum post.


1Tool offsets are applied after any X axis mapping has been performed. Therefore if for example you map X to U in your M563 command to create the tool, you should specify a U offset not an X offset. If you map X to both X and U, you can specify both offsets.

2It's usually a bad idea to put a non-zero Z value in as well unless the tools are loaded and unloaded by some sort of tool changer or are on independent carriages. When all the tools are in the machine at once they should all be positioned at the same Z height to avoid a lower tool colliding with the object while a higher tool is printing.


G10: Set workplace coordinate offset or tool offset ¶ 

This form of the G10 command is recognised by having the L parameter. Supported on the Duet 2 series and later Duets.


Ln Mode

Pnnn Tool number if L=1, coordinate system number if L=2 or L=20

X,Y,Z,U,V... Offsets

If L=1 then this sets the tool offset, as if the L parameter was not present.

If L=2 then this sets the origin of the coordinate system number specified by the P parameter (1 to 9)to the specified X, Y, X... values.

If L=20 then this is similar to L=2 except that the origin is specified relative to the current position of the tool.

G10: Retract ¶ 

This form of the G10 command isa recognised by having no parameters.


  • (no parameters in the RepRapFirmware implementation)


  • G10

Retracts filament according to settings of M207.

RepRapFirmware recognizes G10 as a command to set tool offsets and/or temperatures if the P parameter is present, and as a retraction command if it is absent.


G11: Unretract ¶ 


  • no parameters in the RepRapFirmware implementation)


  • G11

Unretracts/recovers filament according to settings of M207.


G20: Set Units to Inches ¶ 


  • G20

Units from this command onwards are in inches. Note that this is only intended to affect G0, G1 and other commands commonly found in GCode files that represent objects to print. Specifically G20 only affects: G0 to G3, G10 and G92.

So you should use metric values in config.g when configuring the printer and then change to inches with G20 at the end of it if the Gcodes you want to send to move the machine are expressed in inches.

G21: Set Units to Millimeters ¶ 


  • G21

Units from this command onwards are in millimeters. (This is the default.).


G28: Home ¶ 


  • This command can be used without any additional parameters.
  • X Flag to go back to the X axis home position
  • Y Flag to go back to the Y axis home position
  • Z Flag to go back to the Z axis home position
  • U Flag to go back to the U axis home position
  • V Flag to go back to the V axis home position
  • W Flag to go back to the W axis home position


G28 ; Home all axes

G28 XZ ; Home the X and Z axes

The X-Z parameters act only as flags. Any coordinates given are ignored. For example, G28 Z10 results in the same behavior as G28 Z. Delta printers cannot home individual axes, but must always home all three towers, so the X Y Z parameters are simply ignored if the Firmware is in Delta mode.

When the firmware receives this command the normal behaviour is to moves the specified axes (or all axes if none are given) to the endstops, backs away from each endstop by a short distance, and slowly bumps the endstop again to increase positional accuracy. This process, known as "Homing", is required to determine the position of the print carriage(s). These actions are completely configurable using the homing macros.

The macro files used to specify what actions are taken when the G28 command are:

*If all axes are homed, the file homeall.g is processed.

*For individual axes the homex.g, homey.g, homez.g, homeu.g, homev.g or homew.g file will be used.

*On Delta printers, G28 command will always home all three towers by processing the homedelta.g file, regardless of any X Y Z parameters.

Because the behaviour of G28 can be complex, it is recommended to consider the printer actions carefully before including G28 in your ending GCode. On a Cartesian or CoreXY it could result in colliding with the printed object. An alternative to move the carriage at the completion of a print is to use G0 or G1.

For Cartesian printers that use a Z probe to home Z instead of an endstop it is sensible to setup the homeall.g with the XY axes to home first, then move the carriage to a safe position –usually the middle of the bed– where it can safely probe downward to home Z. For an example see Configuring RepRapFirmware for a Cartesian printer


G29: Detailed Z-Probe ¶ 

This command uses a probe to measure the bed height at 3 or more points to determine its tilt and overall flatness. It then enables compensation so that the nozzle will remain parallel to the bed. The printer must be homed with G28 before using this command.


  • G29
  • G29 Snnn


  • S0 (default if no S parameter) Probe the bed, save the height map in a file on the SD card, and activate bed compensation. The default folder for the height map file is /sys and the default file name is heightmap.csv.
  • S1 Load the height map from file and activate bed compensation. The default folder and filename as for S0.
  • S2 Clear bed height map
  • Pfile.csv Optional file name for bed height map file to save with S0 or load with S1.


G29 ; Probe the bed and enable compensation

G29 S2 ; clear bed height map

To define the probe grid, see M557.


G30: Single Z-Probe ¶ 


  • G30 Pnnn Xnnn Ynnn Znnn Hnnn Snnn


  • Pnnn Probe point number
  • Xnnn X coordinate
  • Ynnn Y coordinate
  • Znnn Z coordinate
  • Hnnn Height correction
  • Snnn Set parameter


  • G30


  • G30 ; Probe the bed at the current XY position. When the probe is triggered, set the Z coordinate to the probe trigger height.
  • G30 S-1 ; Probe the bed at the current XY position. When the probe is triggered, do not adjust the Z coordinate.
  • G30 S-2 ; Probe the bed at the current XY position. When the probe is triggered, adjust the Z offset of the current tool to make the current position Z=0.
  • G30 P0 X20 Y50 Z-99999 ; Probe the bed at X20 Y50 and save the XY coordinates and the height error as point 0
  • G30 P3 X180 Y180 Z-99999 S4 ; Probe the bed at X180 Y180, save the XY coordinates and the height error as point 3 and calculate 4-point compensation or calibration
  • G30 P3 X180 Y180 Z-99999 S-1 ; As previous example but just report the height errors

In its simplest form probes bed at current XY location.

If a Pn field is specified the probed X, Y, and Z values are saved as point n on the bed for calculating the offset plane or for performing delta printer calibration. If X, or Y, or Z values are specified (e.g. G30 P1 X20 Y50 Z0.3) then those values are used instead of the machine's current coordinates. A Z value less than -9999.0 causes the machine to probe at the current point to get Z, rather than using the given value. If an S field is specified (e.g. G30 P1 Z0.3 S) the bed plane is computed for compensation and stored. The combination of these options allows for the machine to be moved to points using G1 commands, and then probe the bed, or for the user to position the nozzle interactively and use those coordinates. The user can also record those values and place them in a setup GCode file for automatic execution.The bed.g macro file contains a number of probe points specified as above to automate the probing and calculation of bed compensation, see G32 for more details.

The value of the S parameter specifies what computation to perform. If the value is -1 then the Z offsets of all the points probed are printed, but no calibration is done. If the value is zero or not present, then this specifies that the number of factors to be calibrated is the same as the number of points probed. Otherwise, the value indicates the number of factors to be calibrated, which must be no greater than the number of points probed. From version 1.09, the number of factors may be 3, 4 or 5 when doing auto bed compensation on a Cartesian or CoreXY printer, and 3, 4, 6 or 7 when doing auto calibration of a Delta printer.

The optional H parameter is a height correction for that probe point. It allows for the Z probe having a trigger height that varies with XY position. The nominal trigger height of the Z probe (e.g. at bed centre) is declared in the Z parameter of the G31 command in the config.g file. When you probe using G30 and the probe triggers, the firmware will assume that the nozzle is at the nominal trigger height plus the value you have in the H parameter.


G31: Set or Report Current Probe status ¶ 


  • G31 Pnnn Xnnn Ynnn Znnn Cnnn Snnn


  • Pnnn Trigger value
  • Xnnn Probe X offset1
  • Ynnn Probe Y offset1
  • Znnn Trigger Z height
  • Cnnn Temperature coefficient2
  • Snnn Calibration temperature2
  • Tnnn (RepRapFirmware 1.17 and later) Z probe type to which these parameters apply, defaults to the current Z probe type as defined by M558 P parameter


  • G31 P500 Z2.6
  • G31 X16.0 Y1.5

When used on its own this reports whether the Z probe is triggered, or gives the Z probe value in some units if the probe generates height values. If combined with a Z and P field (example: G31 P312 Z0.7) this will set the Z height to 0.7mm when the Z-probe value reaches 312 when a G28 Z0 (zero Z axis) command is sent. The machine will then move a further -0.7mm in Z to place itself at Z = 0. This allows non-contact measuring probes to approach but not touch the bed, and for the gap left to be allowed for. If the probe is a touch probe and generates a simple 0/1 off/on signal, then G31 Z0.7 will tell the RepRap machine that it is at a height of 0.7mm (as configured by Z0.7 in this example) when the probe is triggered.

If you are using the nozzle as a probe (for example with a peizo or switch that the hotend had a travel distance to trigger then remember the Z offset needs to be negative (ie the probe triggers under Z0

Separate G31 parameters may be defined for different probe types (i.e. 0+4 for switches, 1+2 for IR probes and 3 for alternative sensors). To specify which probe you are setting parameters for, send a M558 command to select the probe type before sending the G31 command, or use the T parameter.


1X and Y offsets of the Z probe relative to the print head (i.e. the position when the empty tool is selected) can be specified. This allows you to calculate your probe coordinates based on the geometry of the bed, without having to correct them for Z probe X and Y offset.

2Optional parameters 'S' (bed temperature in oC at which the specified Z parameter is correct, default is current bed temperature) and 'C' (temperature coefficient of Z parameter in mm/oC, default zero) can be set for the alternative (ultrasonic) sensor. This is useful for probes that are affected by temperature. This facility is deprecated and likely to be removed in a future version of RepRapFirmware.


G32: Probe Z and calculate Z plane ¶ 


  • S0 Default value. Transformation matrix is updated in RAM but is not stored. Z bed height not calculated.
  • S1 Transformation matrix is updated in RAM but is not stored. Printer immediately moves to Z maximum position (Z max endstop required!), and calculates new Z maximum height. You must first issue G28 to home to Z maximum position before issuing G32 Snnn for this to work correctly, or the printer height will be invalid.
  • S2 Same as S1, except transformation matrix and Z max heights are also stored.
  • S3 Transformation matrix is stored. Z bed height not calculated.



  • G32
  • G32 S2

This command is implemented as a more sophisticated form of bed leveling which uses a transformation matrix or motorized correction.

It probes the bed at 3 or more pre-defined points (see M557) and updates transformation matrix for bed levelling compensation.

The firmware executes macro file bed.g if present instead of using the M557 coordinates.

For more detail on using G32 for automatic Delta calibration see: Calibrating a delta printer


G53 Use absolute coordinates ¶ 

Supported on the Duet 2 and later Duets only.

This causes all coordinates in movement commands on the remainder of the current line of GCode to be interpreted as absolute coordinates, ignoring any coordinate offset of the workplace coordinate system currently in use. See the NIST GCode Interpreter Version 3 standard for more details.

G54 to G59.3: Select coordinate system ¶ 

Supported on the Duet 2 and later Duets only.

G54 selects coordinate system 1, G55 selects coordinate system 2 etc. up to G59 which selects coordinate system 6. G59.1 selects coordinate system 7, G59.2 selects system 8 and G59.3 selects system 9. Initially, coordinate system 1 is in use, and all coordinate systems have zero offset from the machine coordinates. To set coordinate system offsets, use the G10 command with the L2 parameter.

See the NIST GCode Interpreter Version 3 standard for more details.


G60: Save current position to slot ¶ 

Supported in firmware 1,.21 and later.


  • G60 Snn


  • Snn <nn> specifies memory slot # (0-based) to save into (default 0)

Slots 0, 1 and 2 are available. When a print is paused the coordinates are saved to slot 1 automatically, and at the start of a tool change the coordinates are saved to slot 2 automatically. Use G0 or G1 with the R0, R1 or R2 parameter to move the current tool to a saved position.


G90: Set to Absolute Positioning ¶ 

Example: G90

All coordinates from now on are absolute relative to the origin of the machine.

Note: RepRapFirmware uses M82 to set the extruder to absolute mode: extrusion is NOT set to absolute using G90


G91: Set to Relative Positioning ¶ 

Example: G91

All coordinates from now on are relative to the last position.

Note: RepRapFirmware uses M83 to set the extruder to relative mode: extrusion is NOT set to relative using G91


G92: Set Position ¶ 


  • This command can be used without any additional parameters.
  • Xnnn new X axis position
  • Ynnn new Y axis position
  • Znnn new Z axis position
  • Ennn new extruder position


  • G92 X10 E90

Allows manual specification of the axis positions by specifying the current position to the values given. This example would set the machine's X coordinate to 10, and the extrude coordinate to 90. No physical motion will occur.

In RepRapFirmware, a G92 without coordinates does nothing.


M-commands ¶ 

M0: Stop or Unconditional stop ¶ 


  • This command can be used without any additional parameters.
  • Hnnn Keep heaters on


  • M0

The firmware finishes any moves left in its buffer, then RepRapFirmware executes macro file stop.g before all motors and heaters are turned off. See also M1, M112.

The optional 'H' parameter, whose value must be non-zero keeps all heaters active. This is what Duet Web Control sends to cancel a paused print.

M1: Sleep or Conditional stop ¶ 


  • M1

The firmware finishes any moves left in its buffer, then shuts down. All motors and heaters are turned off. It can still be sent G and M codes, the first of which will wake it up again. See also M0, M112.

If Marlin is emulated in RepRapFirmware, this does the same as M25 if the code was read from a serial or Telnet connection, else the macro file sleep.g is run before all heaters and drives are turned off.

M3: Spindle On, Clockwise (CNC specific) ¶ 

Supported in RepRapFirmware version 1.20 and later when the printer mode is set to CNC (see M453).


  • Snnn Spindle RPM


  • M3 S4000

The spindle is turned on with a speed of 4000 RPM.

M4: Spindle On, Counterclockwise (CNC specific) ¶ 

Supported in RepRapFirmware version 1.20 and later when the printer mode is set to CNC (see M453).


  • Snnn Spindle RPM


  • M4 S4000

The spindle is turned on with a speed of 4000 RPM.

M5: Spindle Off (CNC specific) ¶ 

Supported in RepRapFirmware version 1.20 and later when the printer mode is set to CNC (see M453).


  • none


  • M5

The spindle motor is turned off.

M18: Disable all stepper motors ¶ 


  • This command can be used without any additional parameters.
  • X X axis
  • Y Y axis
  • Z Z axis
  • U U axis
  • V V axis
  • W W axis
  • E Extruder drive(s)


  • M18
  • M18 X E0

Disables stepper motors and allows axes to move 'freely.' Stepper motors can be disabled selectively. For example, M18 X E0:2 will disable the X, extruder 0 and extruder 2 motors. Also see M84.

M20: List SD card ¶ 


  • This command can be used without any additional parameters.
  • Snnn Output style
  • Pnnn Directory to list1


  • M20
  • M20 S2 P/gcodes/subdir

This code lists all files in the root folder or G-code directory of the SD card to the serial port.

If Marlin compatibility is enabled, a file list response is encapsulated:

Begin file list:
 Traffic cone.g
 calibration piece.g
 End file list

If RepRapFirmware emulates no firmware compatibility, a typical response looks like:

GCode files:
 "Traffic cone.g","frog.gcode","calibration piece.g"

RepRapFirmware always returns long filenames in the case in which they are stored.


1If the S2 parameter is used then the file list is returned in JSON format as a single array called "files" with each name that corresponds to a subdirectory preceded by an asterisk, and the directory is returned in variable "dir". Example:

M20 S2 P/gcodes
 {"dir":"/gcodes","files":["4-piece-1-2-3-4.gcode","Hinged_Box.gcode","Hollow_Dodecahedron_190.gcode","*Calibration pieces"]}

1Defaults to the 0:/gcodes directory, which is the directory that printable gcode files are normally stored in.

M21: Initialize SD card ¶ 


  • This command can be used without any additional parameters.
  • Pnnn SD card number (default 0)


  • M21
  • M21 P1

The specified SD card is initialized. If an SD card is loaded when the machine is switched on, this will happen by default. SD card must be initialized for the other SD functions to work.

M22: Release SD card ¶ 


  • This command can be used without any additional parameters.
  • Pnnn SD card number (default 0)


  • M22
  • M22 P1

The specified SD card is released, so further (accidental) attempts to read from it are guaranteed to fail. Helpful, but not mandatory before removing the card physically.

M23: Select SD file ¶ 


  • M23 filename.gco

The file specified as filename.gco is selected ready for printing. RepRapFirmware supports long filenames as well as 8.3 format.

M24: Start/resume SD print ¶ 


  • M24

The machine prints from the file selected with the M23 command. If the print was previously paused with M25, printing is resumed from that point. To restart a file from the beginning, use M23 to reset it, then M24.

When this command is used to resume a print that was paused, the macro file resume.g is run prior to resuming the print.

M25: Pause SD print ¶ 


  • M25

The machine pauses printing at the current position within the file. To resume printing, use M24. Do not use this code to pause the print in the currently printing G-code file, use M226 instead. M226 is intended for use in the GCode file being printed, for example to pause after a particular layer has completed. So it waits until all the moves in the queue have been completed. M25 is intended for use from a different source of GCodes (like the web interface console, PanelDue or Macro)

Prior to pausing, the macro file pause.g is run. This allows the head to be moved away from the print, filament to be retracted, etc.

M26: Set SD position ¶ 


  • Snnn File position from start of file in bytes
  • Pnnn (Optional) Proportion of the first move to be skipped, default 0.0, must be less than 1.0


  • M26 S49315

Set the file offset in bytes from the start of the SD card file selected by M23. The offset must correspond to the start of a GCode command.

M27: Report SD print status ¶ 


  • M27

Reports the number of bytes processed in this format, which can be processed by Pronterface:

SD printing byte 2134/235422

If no file is being printed, only this message is reported:

Not SD printing.

M28: Begin write to SD card ¶ 


  • M28 filename.gco

File specified by filename.gco is created (or overwritten if it exists) on the SD card and all subsequent commands sent to the machine are written to that file.

M29: Stop writing to SD card ¶ 


  • M29

File opened by M28 command is closed, and all subsequent commands sent to the machine are executed as normal.

M30: Delete a file on the SD card ¶ 


  • M30 filename.g
  • M30 "filename.g"

filename.g is deleted.

M32: Select file and start SD print ¶ 


  • M32 filename.g
  • M32 "filename.g"

It can be used when printing from SD card and does the same as M23 and M24.

M36: Return file information ¶ 


  • M36 filename.g
  • M36 "filename.g"

Returns information for the specified SD card file in JSON format. A sample response is:

{"err":0,"size":457574,"height":4.00,"layerHeight":0.25,"filament":[6556.3],"generatedBy":"Slic3r 1.1.7 on 2014-11-09 at 17:11:32"}

The "err" field is zero if successful, nonzero if the file was not found or an error occurred while processing it. The "size" field should always be present if the operation was successful. The presence or absence of other fields depends on whether the corresponding values could be found by reading the file. The "filament" field is an array of the filament lengths required from each spool. The size is in bytes, all other values are in mm. The fields may appear in any order, and additional fields may be present.

If the file name parameter is not supplied and a file on the SD card is currently being printed, then information for that file is returned including additional field "fileName". This feature is used by the web interface and by PanelDue, so that if a connection is made when a file is already being printed, the name and other information about that file can be shown.

M37: Simulation mode ¶ 


  • S1 Enter simulation mode
  • S0 Leave simulation mode
  • P"filename" (optional) Simulate printing a file from SD card


  • M37 S1
  • M37 P"MyModel.g"

Used to switch between printing mode and simulation mode. Simulation mode allows the electronics to compute an accurate printing time, taking into account the maximum speeds, accelerations etc. that are configured.

M37 S1 enters simulation mode. All G and M codes will not be acted on, but the time they would take to execute will be calculated.

M37 S0 exits simulation mode and prints the total time taken by simulated moves since entering simulation mode..

M37 with no S parameter prints the time taken by the simulation, from the time it was first entered using M37 S1, up to the current point (if simulation mode is still active) or the point that the simulation was ended (if simulation mode is no longer active).

M38: Compute SHA1 hash of target file ¶ 


  • M38 gcodes/myfile.g

Used to compute a hash of a file on the SD card and returns a hexadecimal string which is the SHA1 of the file. If the file cannot be found, then the string "Cannot find file" is returned instead.

M39: Report SD card information ¶ 

Supported in ReprapFirmware 1.21 and later.


  • Pn SD slot number, default 0
  • Sn Response format. S0 returns a plain text response, S2 returns a response in JSON format.


  • M39 ; report information for SD card 0 in plain text format
  • M39 P1 S2 ; report information for SD card 1 in JSON format

This command returns information about the SD card in the specified slot in the requested format. At least the following is returned:

  • Whether or not a usable card is present in the slot
  • The capacity of the card in bytes (if a card is present)
  • The amount of free space on the card in bytes (if a card is present)

The JSON response has the following format (this is provisional):


The capacity and free space are in bytes and the interface speed is in bytes/second.

M42: Switch I/O pin ¶ 


  • Pnnn Pin number
  • Snnn Pin value


  • M42 P7 S255

M42 switches a general purpose I/O pin. Use M42 Px Sy to set pin x to value y. The S field may be in the range 0..1 or 0..255. The pin reference is an internal firmware reference named "digital pin" which It maps on different connector pins depending the hardware.1.

See Using servos and controlling unused IO pins for all the unused pin mappings.

See also M583.


1 For Duet 0.8.5 and 0.6, along with pre 1.16 versions of RepRapFirmware see:

M80: ATX Power On ¶ 


  • M80

Turns on the ATX power supply from standby mode to fully operational mode using the power supply control pin on the External 5V header.

M81: ATX Power Off ¶ 


  • Sn n=0 turn power off immediately (default), n=1 turn power off when all thermostatic fans have turned off (RepRapFirmware 1.20 and later only)


  • M81 ; turn power off immediately
  • M81 S1 ; turn power off when everything has cooled down

Turns off the ATX power supply. Counterpart to M80.

M82: Set extruder to absolute mode ¶ 


  • M82

Makes the extruder interpret extrusion as absolute positions.

M83: Set extruder to relative mode ¶ 


  • M83

Makes the extruder interpret extrusion values as relative positions.

M84: Stop idle hold ¶ 


  • This command can be used without any additional parameters.
  • Snnn Idle Time-out
  • X,Y, E0:1.. etc


  • M84
  • M84 E0:1:2:3:4

Stop the idle hold on all axis and extruder. Be aware that by disabling idle hold during printing, you will get quality issues.

For example, "M84 S10" will idle the stepper motors after 10 seconds of inactivity.

You can disable individual motors with the standard X, Y, Z etc switches.

M92: Set axis steps per unit ¶ 


  • This command can be used without any additional parameters.
  • Xnnn Steps per mm for the X drive
  • Ynnn Steps per mm for the Y drive
  • Znnn Steps per mm for the Z drive
  • Unnn Steps per mm for the U drive
  • Vnnn Steps per mm for the V drive
  • Wnnn Steps per mm for the W drive
  • Ennn Steps per mm for the extruder drive(s)


  • M92 X80 Y80 Z80
  • M92 E420:500

Allows programming of steps per mm for motor drives. These values are reset to those set in config.g on power on, unless saved with M500. It will report the current steps/mm if you send M92 without any parameters.

Note: RepRapFirmware uses floating point maths so it is possible to use floating point numbers for steps/mm.

M98: Call Macro/Subprogram ¶ 


  • Pnnn Macro filename


  • M98 Pmymacro.g

Runs the macro in the file mymacro.g. Macro calls can be nested (ie a macro can call another macro).

The filename to include a path to a subdirectory. For relative paths, the default folder is /sys, but some implementations may check the /macros directory too. Absolute file paths are also supported starting with "0" for the internal SD card or "1" for the external SD card if fitted.

M99: Return from Macro/Subprogram ¶ 


  • M99

Returns from an M98 call, this is not required to return from the end of a macro and the macro naturally returns at the end of file.

RepRapFirmware closes the currently active macro file. If a nested macro is being run, RepRapFirmware goes up one stack level.

M104: Set Extruder Temperature ¶ 


  • Snnn Target temperature


  • M104 S190

Set the temperature of the current extruder to 190oC and return control to the host immediately (i.e. before that temperature has been reached by the extruder).

See also M109.

This is deprecated because temperatures should be set using the G10 and T commands.

M105: Get Extruder Temperature ¶ 


  • This command can be used without any additional parameters.
  • Rnnn Response sequence number1
  • Snnn Response type1


  • M105
  • M105 S2

Request the temperature of the current extruder and the build base in degrees Celsius. Reports the current and target temperatures of all active heaters.


1 Returns a JSON-formatted response if parameter S2 or S3 is specified. Additionally, parameter Rnn may be provided, where nn is the sequence number of the most recent G-code response that the client has already received. M105 S2 is equivalent to M408 S0, and M105 S3 is equivalent to M408 S2. Usage of these forms of M105 is deprecated, please use M408 instead.

M106: Fan On ¶ 


  • Pnnn Fan number (optional, defaults to 0)
  • Snnn Fan speed (0 to 255 or 0.0 to 1.0))

Extra Parameters

  • Innn Invert PWM (I1), disable fan (I-1), or normal mode (I0, default)
  • Fnnn Fan PWM frequency
  • Lnnn Set the minimum fan speed (0 to 255 or 0.0 to 1.0) when a non-zero fan speed is requested.
  • Xnnn Set the maximum fan speed (0 to 255 or 0.0 to 1.0) when a non-zero fan speed is requested. (supported in RRF >= 2.02)
  • Bnnn Blip time - fan will be run at full PWM for this number of seconds when started from standstill. Default is B0.1.
  • Hnn:nn:nn... Enable thermostatic mode and select heaters monitored. H-1 disables thermostatic mode.
  • Rnnn Restore fan speed to the value it has when the print was paused (R1) or the last time the fan speed was set and no P parameter was provided (R2).
  • Tnnn or Tnn:nn Set thermostatic mode trigger temperature, to temperature control range
  • C"name" Set custom name for this fan (supported in RRF >= 2.01)


  • M106 S127
  • M106 P1 T45 S0.7 H1:2
  • M106 P1 T40:50 H1:2
  • M106 P2 T45:65 H100:101:102

The first example turns on the default cooling fan at half speed. The second example sets the second fan to a thermostatic fan for heaters 1 and 2 (e.g. the extruder heaters in a dual-nozzle machine) such that the fan will be on at 70% PWM when either hot end is at or above 45C. The third example also sets up a thermostatic fan, but this time it runs in proportional mode. The fourth example sets up an electronics cooling fan that starts to turn on when the MCU temperature (virtual heater 100) reaches 45C and reaches full speed when the MCU temperature reaches 65C or if any TMC2660 drivers (virtual heaters 101 and 102) report that they are over-temperature

The parameter 'S' declares the PWM value (0-255 or 0-1.0). M106 S0 turns the fan off.

If an S parameter is provided but no other parameter is present, then the speeds of the print cooling fans associated with the current tool will be set (see the F parameter in the M563 command). If no tool is active then the speed of Fan 0 will be set. Either way, the speed is remembered so that it can be recalled using the R2 parameter (see below).

If no S parameter is given but the R1 parameter is used, the fan speed when the print was last paused will be set, this allows the pause.g macro to switch off the fans and have them resume when the print is resumed. If the R2 parameter is used, then the speeds of the print cooling fans associated with the current tool will be set to the remembered value (see above). R2 allows the configured fan speed to be passed between tools which is useful on multi extruder printers where the slicing software may not specify the fan speed on tool change and the tool change macros shut down fans when not in use.

The F parameter sets the fan PWM frequency, in Hz. The default is F250, which works with most fans, Try F100 or lower if you find that you can't control the speed of your fan. This parameter is ignored for fans connected to the fan outputs of a DueX2 or DueX5 because those outputs don't support variable PWM frequency.

The T and H parameters allow a fan to be configured to operate in thermostatic mode, for example to use one of the fan channels to control the hot end fan. In this mode the fan will be on with the PWM set by the S parameter (subject to a minimum of 0.5) when the temperature of any of the heaters listed in the H parameter is at or above the trigger temperature set by the T parameter, and off otherwise. Thermostatic mode can be disabled using parameter H-1.

In firmware 1.19beta6 and later, the T parameter may be of the form Taaa:bbb where aaa is the temperature at/below which the fan should be fully off and bbb is the temperature at which the fan should be fully on. The PWM will be set proportionally if the temperature is between these limits.

In firmware versions 1.19beta6 and later, fans can respond to virtual heaters (which have heater numbers 100 upwards) as well as real heaters. If a fan is configured to trigger on a virtual heater whose sensor represents TMC2660 driver over-temperature flags, then when the fan turns on it will delay the reporting of an over-temperature warning for the corresponding drivers for a few seconds, to give the fan time to cool the driver down.

The B parameter sets the time for which the fan will be operated at full PWM when started from cold, to allow low fan speeds t be used. A value of 0.1 seconds is usually sufficient.

The L parameter defines the minimum PWM value that is usable with this fan. If a lower value is commanded that is not zero, it will be rounded up to this value.

The X parameter defines the same for a maximum PWM value. If a higher value is commanded, it will be rounded down to this value.

The I parameter causes the fan output signal to be inverted if its value is greater than zero. This makes the cooling fan output suitable for feeding the PWM input of a 4-wire fan via a diode. If the parameter is present and zero, the output is not inverted. If the I parameter is negative then in RRF 1.16 and later the fan is disabled, which frees up the pin for use as a general purpose I/O pin that can be controlled using M42.

M107: Fan Off ¶ 

Deprecated in RepRapFirmware. Use M106 S0 instead.

Note that M107 will turn off the print cooling fan(s) associated with the current tool (see the F parameter in the M563 command).

M108: Cancel Heating ¶ 

Breaks out of an M109 or M190 wait-for-temperature loop, continuing the print job. Use this command with caution! If cold extrusion prevention is enabled (see M302) and the temperature is too low, this will start "printing" without extrusion. If cold extrusion prevention is disabled and the hot-end temperature is too low, the extruder may jam.

M109: Set Extruder Temperature and Wait ¶ 


  • Snnn minimum target temperature, waits until within 2.5C of target if heating
  • Rnnn accurate target temperature, waits until within 2.5C of target always
  • Tn optional tool number


  • M109 S215

Deprecated in RRF, but widely generated by slicers. To get the same behaviour, use G10 followed by M116

To better support slicers that don't select a tool when doing a single-extrusion print, RRF will always select a tool when processing M109. If the T parameter is present, that tool will be selected. If no T parameter is present and no tool is already selected, the tool with the lowest non-negative tool number will be selected (typically tool 0).

M110: Set Current Line Number ¶ 


  • Nnnn Line number


  • M110 N123

This example sets the current line number to 123. Thus the expected next line after this command will be 124.

M111: Set Debug Level ¶ 


  • Pnnn Debug module
  • Snnn Debug on/off


  • M111 S6
  • M111 P1 S1

Enable or disable debugging features for each module. If the optional 'P' parameter is not specified, debugging will be enabled for all modules. For a list of modules, send M111 S1 P15.

M112: Emergency Stop ¶ 


  • M112

Any moves in progress are immediately terminated, then RepRap shuts down. All motors and heaters are turned off. It can be started again by pressing the reset button or power cycling the board. See also M0 and M1.

M114: Get Current Position ¶ 


  • M114

This reports the current X, Y, Z, (,U, V, W if configured) and E coordinates to the host.

For example, the machine returns a string such as:

C: X:0.00 Y:0.00 Z:0.00 E:0.00

M115: Get Firmware Version and Capabilities ¶ 


  • This command can be used without any additional parameters.
  • Pnnn Electronics type


  • M115
  • M115 P2

Request the Firmware Version and Capabilities of the current microcontroller

The details are returned to the host computer as key:value pairs separated by spaces and terminated with a linefeed.:


See the M408 command for a more comprehensive report on machine capabilities.


1Used tell the firmware about the hardware on which it is running. If the P parameter is present then the integer argument specifies the hardware being used. The following are currently supported on first-generation Duets:

M115 P0 Automatic board type selection if supported, or default if not

M115 P1 Duet 0.6

M115 P2 Duet 0.7

M115 P3 Duet 0.85

M116: Wait ¶ 


  • This command can be used without any additional parameters.
  • Pnnn Tool number
  • Hnnn Heater number
  • Cnnn Chamber number


  • M116
  • M116 P1

The first example waits for all temperatures and other slowly-changing variables to arrive at their set values.

The second shows the optional 'P' parameter that is used to specify a tool number. If this parameter is present, then the system only waits for temperatures associated with that tool to arrive at their set values. This is useful during tool changes, to wait for the new tool to heat up without necessarily waiting for the old one to cool down fully.

See also M109.

Recent versions of RepRapFirmware also allow a list of the heaters to be specified using the 'H' parameter, and if the 'C' parameter is present, this will indicate that the chamber heater should be waited for.

M117: Display Message ¶ 


  • M117 Hello World

This causes the given message to be shown in the status line on an attached LCD or if no LCD is attached, this message will be reported on the web interface.

M118: Send Message to Specific Target ¶ 

Supported in RepRapFirmware 1.21 and later.


  • Pnnn Message type (0 = Generic [default], 1 = USB, 2 = PanelDue/UART, 3 = HTTP, 4 = Telnet) (optional)

* S"msg" Message to send


  • M118 S"Hello Duet"

This code may be used to send messages to a specific target. Basically it is a simple wrapper for RepRapFirmware's Platform::Message method.

Note that the implementation in RepRapFirmware always requires the S-parameter to be passed. If it is omitted, an error will be reported.

M119: Get Endstop Status ¶ 


  • M119

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

M120: Push ¶ 


  • M120

Push the state of the machine onto a stack. Called automatically when a macro file is run. It pushes the following values on the stack:

  1. Current feedrate
  2. Extruder positions
  3. Whether moves (and separately extrusion) are relative or absolute

M121: Pop ¶ 


  • M121

Recover the last state pushed onto the stack.

M122: Diagnose ¶ 


  • M122

Sending an M122 causes the RepRap to transmit diagnostic information, if debugging is enabled for the Network module, this will also print LWIP stats to the host via USB.

M135: Set PID sample interval ¶ 


  • Snnn Heat sample time in seconds


  • M135 S300

Set the PID to measure temperatures and calculate the power to send to the heaters every 300ms.

M140: Set Bed Temperature (Fast) ¶ 


  • Snnn Target temperature
  • Pnnn Bed heater index1, default 0
  • Hnnn Heater number(s)
  • Rnnn Heater number


  • M140 S55
  • M140 S65 R40

The first example sets the temperature of the build bed to 55oC and returns control to the host immediately (i.e. before that temperature has been reached by the bed). There is an optional R field that sets the bed standby temperature, e.g. to 40oC in the second example

If the absolute negative temperature (-273 or lower) is passed as target temperature, the bed heater to be switched off

M140 S-273

RepRapFirmware also provides an optional 'H' parameter to set the hot bed heater number(s). If no heated bed is present, a negative value may be specified to disable it. M140 commands with H parameters would normally be used only in the config.g file.

1 Only supported in RepRapFirmware 1.20 and later. On the Duet WiFi and Duet Ethernet you can configure up to 4 bed heaters.

M141: Set Chamber Temperature (Fast) ¶ 


  • Snnn Target temperature
  • Pnnn Chamber index1
  • Hnnn Heater number


  • M141 S30
  • M141 H0

Set the temperature of the chamber to 30oC and return control to the host immediately (i.e. before that temperature has been reached by the chamber).

1 Only supported in RepRapFirmware 1.20 and later.

M143: Maximum heater temperature ¶ 


  • H Heater number (RepRapFirmware 1.17 and later, default 1 which is normally the first hot end)
  • S Maximum temperature
  • P Heater protection instance (defaults to H parameter if omitted)1
  • X Heater to supervise (by default this is equal to the heater number, can be a virtual heater too)1
  • A Action to trigger (0: Generate heater fault [default] 1: Switch off permanently 2: Switch off temporarily)1
  • C Condition for temperature event (0: Temperature too high [default] 1: Temperature too low)1


  • M143 S275 ; set the maximum temperature of the hot-end to 275°C
  • M143 H0 S125 ; set the maximum bed temperature to 125C

The default maximum temperature for all heaters was 300°C prior to RepRapFirmware version 1.13, and 262°C from 1.13 onwards. From RepRapFirmware 1.17 onwards, the default maximum temperatures are 262C for extruders and 125C for the bed.

When the temperature of the heater exceeds this value a heater error will be triggered.

Note 1. Supported in RepRapFirmware 1.20-b11+2 and later.

Starting from this version RepRapFirmware allows more granular control over the heater subsystem. By default each heater has one heater protection instance assigned to it, which is by default configured to generate a heater fault if the maximum heater temperature is exceeded.

To control heaters via two thermistors, RepRapFirmware allows the configuration of extra heater elements whose index starts from 100. On the Duet Ethernet/WiFi there are 8 extra heater protections available (100-107).

Example: You have heater 3 mapped to a chamber heater which is supposed to be temporarily turned off when the temperature in it exceeds 65C. The thermistor for the chamber is set up as a virtual heater on channel 104 and can be viewed on the "Extra" panel on DWC (refer to M305 for further details on how to set this up). To achieve this you can configure an extra heater protection with the following gcode:

  • M143 P100 H3 X104 A2 C0 S65

M144: Bed Standby ¶ 


  • Pnnn Bed index1


  • M144

Switch the bed to its standby temperature. M140 turns it back to its active temperature; no need for any arguments for that use of M140.

1 Only supported in RepRapFirmware 1.20 and later.

M150: Set LED colours ¶ 


  • Rnnn red (0-255)
  • Unnn green (0-255)
  • Bnnn blue (0-255)
  • Ynn brightness (0-31)
  • Snnn number of LEDs in strip to set, default 30
  • Fn F1 if further commands for later LEDs in the strip follow; F0 (default) if this command programs the entire strip, or this is the last of several commands to program the strip (causes the next M150 command to start from the beginning of the strip again)


  • M150 R255 U128 B192 Y16 S100 F0 ; set 100 LEDs to the same colour

This is only supported on controllers that have an output connector for DotStar LEDs.

Range for RGB values is 0-255. The specified RGB values will be sent to the number of LEDs in the LED strip as specified by the S parameter, pushing the existing colours along the strip. To set all the LEDs the same colour, make the S parameter equal to or a little longer than the number of LEDs in the strip.

M190: Wait for bed temperature to reach target temp ¶ 


  • Snnn minimum target temperature, waits while heating
  • Pnnn Bed index1
  • Rnnn accurate target temperature, waits while heating and cooling


  • M190 S60

Set the temperature of the bed to 60C and wait for the temperature to be reached.

1 Only supported in RepRapFirmware 1.20 and later.

M191: Wait for chamber temperature to reach target temp ¶ 


  • Snnn minimum target temperature, waits while heating
  • Pnnn Chamber index1
  • Rnnn accurate target temperature, waits while heating and cooling


  • M191 P60

Set the temperature of the build chamber to 60C and wait for the temperature to be reached.

1 Only supported in RepRapFirmware 1.20 and later.

M200: Set filament diameter ¶ 


  • Daaa:bbb:ccc... Sets filament diameter to aaa for extruder 0, bbb for extruder 1 and so on. If any of aaa, bbb etc. are zero then volumetric extrusion is disabled for that extruder.
  • Daaa Sets filament diameter (or disables volumetric extrusion) for all extruders


  • M200 D0 ; disable volumetric extrusion on all extruders
  • M200 D1.75 ; set al extruder filament diameters to 1.75mm
  • M200 D1.75:3.0:1.75 ; set extruder 0 to 1.75mm, extruder 1 to 3.0mm and all remaining extruders to 1.75mm

Volumetric extrusion is an option you can set in some slicers whereby all extrusion amounts are specified in mm3 (cubic millimetres) of filament instead of mm of filament. This makes the gcode independent of the filament diameter, potentially allowing the same gcode to run on different printers. The purpose of the M200 command is to inform the firmware that the gcode input files have been sliced for volumetric extrusion, and to provide the filament diameter so that the firmware can adjust the requested extrusion amount accordingly.

Sending M200 without parameters reports the current volumetric extrusion state and (where appropriate) filament diameter for each extruder.

Note that if you use slicer-commanded retraction, the retraction amounts must be specified in mm3 too. If instead you use firmware retraction, then the firmware retraction amounts specified using the M207 command are still interpreted as mm.

This command is supported in RepRapFirmware 1.19beta10 and later.

M201: Set max acceleration ¶ 


  • Xnnn Acceleration for X axis
  • Ynnn Acceleration for Y axis
  • Znnn Acceleration for Z axis
  • Unnn Acceleration for U axis
  • Vnnn Acceleration for V axis
  • Wnnn Acceleration for W axis
  • Ennn Acceleration for extruder drives


  • M201 X1000 Y1000 Z100 E2000

Sets the acceleration that axes can do in mm/second^2 for print moves. For consistency with the rest of G Code movement this should be in mm/(minute^2), but that gives really silly numbers and one can get lost in all the zeros. So for this we use seconds.

M203: Set maximum feedrate ¶ 


  • Xnnn Maximum feedrate for X axis
  • Ynnn Maximum feedrate for Y axis
  • Znnn Maximum feedrate for Z axis
  • Unnn Maximum feedrate for U axis
  • Vnnn Maximum feedrate for V axis
  • Wnnn Maximum feedrate for W axis
  • Ennn Maximum feedrate for extruder drives


  • M203 X6000 Y6000 Z300 E10000

Sets the maximum feedrates that your machine can do in mm/min

M204: Set printing and travel accelerations ¶ 


  • Pnnn Acceleration for printing moves
  • Tnnn Acceleration for travel moves


  • M204 P500 T2000

Use M201 to set per-axis accelerations and extruder accelerations. RepRapFirmware applies the M204 accelerations to the move as a whole, and also applies the limits set by M201 to each axis and extruder.

This command is supported by firmware version 1.18RC1 and later.

M206: Offset axes ¶ 


  • Xnnn X axis offset
  • Ynnn Y axis offset
  • Znnn Z axis offset
  • Unnn U axis offset
  • Vnnn V axis offset
  • Wnnn W axis offset


  • M206 X10.0 Y10.0 Z-0.4

The values specified are added to the endstop position when the axes are referenced. The same can be achieved with a G92 right after homing. G10 achieves some of this functionality but for tools not axis.

M207: Set retract length ¶ 


  • Snnn positive length to retract, in mm
  • Rnnn positive or negative additional length to un-retract, in mm, default zero
  • Fnnn retraction feedrate, in mm/min
  • Tnnn feedrate for un-retraction if different from retraction, mm/min (RepRapFirmware 1.16 and later only)
  • Znnn additional zlift/hop


  • M207 S4.0 F2400 Z0.075

Sets the retract length used by the G10 and G11 firmware retraction and advance commands.

M208: Set axis max travel ¶ 


  • Snnn 0 = set axis maximum (default), 1 = set axis minimum
  • Xnnn X axis limit
  • Ynnn Y axis limit
  • Znnn Z axis limit


  • M208 X200 Y200 Z90 ; set axis maxima
  • M208 X-5 Y0 Z0 S1 ; set axis minima

The values specified set the software limits for axis travel in the specified direction. The axis limits you set are also the positions assumed when an endstop is triggered.

M220: Set speed factor override percentage ¶ 


  • Snnn Speed factor override percentage (0..100 or higher)


  • M220 S80

Sets the speed factor override percentage.

M221: Set extrude factor override percentage ¶ 


  • Snnn Extrude factor override percentage (0..100 or higher), default 100%
  • Dnnn Extruder drive number (RepRapFirmware only), default 0


  • M221 S70
  • M221 S95 D1

Sets extrude factor override percentage. In the case of RepRapFirmware, sets the extrusion factor percentage for the specified extruder drive only.

M226: Gcode Initiated Pause ¶ 


  • M226

Initiates a pause in the same way as if the pause button is pressed. That is, program execution is stopped and the printer waits for user interaction. M226 is intended for use in the GCode file being printed, for example to pause after a particular layer has completed. So it waits until all the moves in the queue have been completed. M25 is intended for use from a different source of GCodes (Like the web interface console, PanelDue or a Macro) so if you need to pause from those use M25 instead.

M260: i2c Send Data ¶ 

Send data over the i2c bus. Supported in RepRapFirmware 1.21 and later.


  • Ann I2C address
  • Bnn:nn:nn... Bytes to send


  • M260 A5 B65 ; Send 'A' to address 5 now
  • M260 A0x7F B0x41 ; Send 'A' to address 7F (hex)
  • M260 A0 B82:101:112:82:97:112 ; Send 'RepRap' to address 0

M261: i2c Request Data ¶ 


  • Ann I2C address
  • Bnn' How many bytes to request


  • M261 A99 B5 ; Request 5 bytes from Address 99

M280: Set servo position ¶ 

Set servo position absolute.


  • Pnnn Servo index
  • Snnn Angle or microseconds
  • I1 Invert polarity (RepRapFirmware only)


  • M280 P1 S50

S values below 200 are treated as angles, and 200 or greater as the pulse width in microseconds.

The optional I1 parameter causes the polarity of the servo pulses to be inverted compared to normal for that output pin. The I parameter is not remembered between M280 commands (unlike the I parameter in M106 commands), so if you need inverted polarity then you must include I1 in every M280 command you send.

The servo index is the same as the pin number for the M42 command. See Using servos and controlling unused IO pins for details for the DuetWifi or the table below for the 0.8.5.

Duet 0.8.5 M280 P value to Expansion Port Pin Mapping
PNameExpansion Port Pin
Use M307 H# A-1 C-1 D-1 before using these pins

M290: Baby stepping ¶ 

Supported in firmware version 1.18 and later.


  • Snnn Amount to baby step in mm. Positive values raise the head, negative values lower it.
  • Znnn Synonym for S (RepRapFirmware 1.21 and later)
  • Rn (Optional, RepRapFirmware 1.21 and later) R1 = relative (add to any existing babystep amount, the default), R0 = absolute (set babystepping offset to the specified amount)


  • M290 S0.05 ; babystep the head up 0.05mm
  • M290 R0 S0 ; clear babystepping (RepRapFirmware 1.21 and later only)

This command tells the printer to apply the specified additional offset to the Z coordinate for all future moves, and to apply the offset to moves that have already been queued if this case be done. Baby stepping is cumulative, for example after M290 S0.1 followed by M290 S-0.02, an offset of 0.08mm is used.

M290 with no parameters reports the accumulated baby stepping offset. Marlin doesn't track accumulated babysteps.

In RepRapFirmware 1.19 and earlier, the babystepping offset is reset to zero when the printer is homed or the bed is probed. In RepRapFirmware 1.21 and later, homing and bed probing don't reset babystepping, but you can reset it explicitly using M290 R0 S0.

M291: Display message and optionally wait for response ¶ 

Supported in firmware version 1.19beta7 and later.


  • P"message" The message to display, which must be enclosed in double quotation marks. If the message itself contains a double quotation mark, use two double quotation marks to represent it.
  • R"message" Optional title for the message box. Must be enclosed in double quotation marks too.
  • Sn Message box mode (see below), default 1
  • Tn Timeout in seconds, ignored if S=2 or S=3. The message will be cancelled after this amount of time, if the user does not cancel it before then. A zero or negative value means that the message does not time out (it may still be cancelled by the user). The default value is 10 seconds (this applies to modes 0 and 1 only).
  • X, Y, Zn 0 = no special action (default), 1 = display jog buttons alongside the message to allow the user to adjust the head position on the specified axis

This command provides a more flexible alternative to M117, in particular messages that time out, messages that suspend execution until the user acknowledges them, and messages that allow the user to adjust the height of the print head before acknowledging them.

Allowed message box modes are:

0. No buttons are displayed (non-blocking)
1. Only "Close" is displayed (non-blocking)
2. Only "OK" is displayed (blocking, send M292 to resume the execution)
3. "OK" and "Cancel" are displayed (blocking, send M292 to resume the execution or M292 P1 to cancel the operation in progress)

M292: Acknowledge message ¶ 


  • Pnnn Whether the current operation shall be cancelled (P=1) or continued (P=0).

This command is sent by the user interface when the user acknowledges a message that was displayed because of a M291 command with parameter S=2 or S=3. The P parameter is ignored unless M291 was called with S=3.

Supported in firmware version 1.19 and later.

M300: Play beep sound ¶ 


  • Snnn frequency in Hz
  • Pnnn duration in milliseconds


  • M300 S300 P1000

Play beep sound, use to notify events like the end of printing. If an LCD device is attached to RepRapFirmware, a sound is played via the add-on touch screen control panel. Else the web interface will play a beep sound.

M301: Set PID parameters ¶ 


  • Hnnn heater number
  • Pnnn proportional (Kp)
  • Innn integral (Ki)
  • Dnnn derivative (Kd)


  • M301 H1 P20 I0.5 D100

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

  • H: Is the heater number, and is compulsory. H0 is the bed, H1 is the first hot end, H2 the second etc.
  • P: Proportional value
  • I: Integral value
  • D: Derivative value

Note: PID parameters are computed automatically when the M307 command is used to define the heater model, or from the default heater model if no M307 command is provided. You can use M301 to override those computed PID parameters.

M302: Allow cold extrudes ¶ 


  • This command can be used without any additional parameters.
  • Pnnn Cold extrude allow state (RepRapFirmware)
  • Snnn Minimum extrusion temperature (RepRapFirmware 2.02 and later)
  • Rnnn Minimum retraction temperture (RepRapFirmware 2.02 and later)


  • M302 ; Report current state
  • M302 P1 ; Allow cold extrusion
  • M302 S120 R110 ; Allow extrusion starting from 120°C and retractions already from 110°C

This tells the printer to only 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.

The minimum temperatures for extrusion can be set using the Snnn parameter with a default value of 160°C if unset. A minimum retraction temperature can be set with the Rnnn parameter. The default for this is 90°C.

M302 with no parameters it will report the current cold extrusion state.

M303: Run heater tuning ¶ 


  • Hnnn heater number
  • Pnnn PWM to use, 0 to 1 (you should normally use 1 i.e. full power), default 1
  • Snnn target temperature


  • M303 H1 P0.4 S240 ; tune heater 1 using 40% PWM, target temperature 240C

PID Tuning refers to a control algorithm used to tune heating behaviour for hot ends and heated beds. This command computes the process model parameters (see M307), which are in turn used to calculate the PID constants. Note that the tuning algorithm will overshoot the target temperature; the amount of overshoot depends on how powerful the heater is. See Wiki:Tuning Temperature Control.

Tuning is performed asynchronously. Run M303 with no parameters to see the current tuning state or the last tuning result.

M304: Set PID parameters - Bed ¶ 


  • This command can be used without any additional parameters.
  • Pnnn proportional (Kp)
  • Innn integral (Ki)
  • Dnnn derivative (Kd)


  • M304 P1 I2 D3
  • M304 ; Report parameters

Sets Proportional, Integral and Derivative values for bed. This command is identical to M301 except that the H parameter (heater number) defaults to zero.

M305: Set temperature sensor parameters ¶ 


  • Pnnn Heater number (0, 1, 2...) or virtual heater number (100, 101, 102...)
  • S"name" Heater name (optional). Named virtual heaters are shown in Duet Web Control; anonymous virtual heaters are not.
  • Xnnn Heater ADC channel, or thermocouple or PT100 adapter channel; defaults to the same value as the P parameter
  • Tnnn (for thermistor sensors) The thermistor resistance at 25oC
  • T"c" (for MAX31856-based thermocouple sensor daughter boards) The thermocouple type letter, default K
  • Bnnn If the sensor is a thermistor, this is the Beta value. For the Steinhart-Hart thermistor model, this is the reciprocal of the B coefficient
  • Cnnn If the sensor is a thermistor, this is the Steinhart-Hart C coefficient, default 0
  • Rnnn If the sensor is a thermistor, PT100 or PT1000 sensor, this is the Series resistor value
  • Lnnn If the sensor is a thermistor, this is the ADC low offset. If it is a current loop sensor, this is the temperature when the current is 4mA.
  • Hnnn If the sensor is a thermistor, this is the ADC high offset. If it is a current loop sensor, this is the temperature when the current is 20mA.
  • Fnn (where nn is 50 or 60) If the sensor interface uses a MAX31856 thermocouple chip or MAX31865 PT100 chip, this is the local mains frequency. Readings will be timed to optimise rejection of interference at this frequency.


  • M305 P1 T100000 R1000 B4200

Sets the parameters for temperature measurement. The example above tells the firmware that for heater 1 (P parameter: 0 = heated bed, 1 = first extruder) the thermistor 25C resistance (T parameter) is 100Kohms, the thermistor series resistance (R parameter) is 1Kohms, the thermistor beta (B parameter) is 4200. All parameters other than P are optional. If only the P parameter is given, the existing values are displayed. DuetWebControl 1.19.2 and newer support optional units to be set by the S parameter in the form of "Heater name [Unit]".

RepRapFirmware also supports ADC gain and offset correction and a thermistor selection facility. Example:

M305 P1 T100000 R1000 B4200 H14 L-11 X2

The H correction affects the reading at high ADC input voltages, so it has the greatest effect at low temperatures. The L correction affects the reading at low input voltages, which correspond to high temperatures. The ADC on the Duet WiFi and Duet Ethernet is self-calibrating, so you should not need to provide any corrections when using these controllers.

The X parameter tells the firmware which temperature sensor channel to use channel, as follows:

  • Channels 0, 1... are the thermistor inputs for heaters 0, 1 etc.
  • Channels 100, 101... are MAX31855 thermocouple channels using chip selects CS1, CS2... on the SPI bus, see Connecting thermocouples.
  • Channels 150, 151... are MAX31856 thermocouple channels using chip selects CS1, CS2... on the SPI bus
  • Channels 200, 201... are MAX31865 PT100 channels using chip selects CS1, CS2... on the SPI bus, see Connecting PT100 temperature sensors.
  • Channels 300, 301... are current loop channels using chip selects CS1, CS2... on the SPI bus
  • Channels 400, 401... are DHTxx temperature and humidity channels. The DATA line of the DHTxx must be connected to CS6 (was E3 Endstop on the expansion header) on the Duet WiFi/Ethernet. Specify the sensor type (11 for DHT11, 21 for DHT21 or 22 for DHT22) via the T-parameter. e.g. M305 P102 X401 S"DHT humidity [%]"
  • Channel 1000 is the on-chip microcontroller temperature sensor
  • Channel 1001 represents the temperature warning and overheat flags on the TMC2660 drivers on the Duet Wif/Ethernet. It reads 0C when there is no warning, 100C if any driver reports over-temperature warning , and 150C if any driver reports over temperature shutdown.
  • Channel 1002 is as channel 1001 but for drivers on the DueX2 or DueX5.

If the M305 command for a real heater does not specify a sensor channel and the heater has not been configured yet, then it defaults to using the thermistor associated with that heater.

Virtual heaters 100, 101 and 102 are preconfigured to use temperature sensor channels 1000, 1001 and 1002 respectively. We suggest you use virtual heaters 103 upwards if you want to create additional virtual heaters.

If you send the following command:

M305 P101

you should get the response "Heater 101 uses TMC2660 temperature warnings sensor channel 1001". But as this virtual heater has no name, it doesn't show up in DWC. You can fix that by sending:

M305 P101 S"Drivers"

After that, if you go to the "Extra" tab in DWC (where is says Tools/Heaters/Extra), you will see "Drivers" as an entry.

M307: Set or report heating process parameters ¶ 


  • Hn Heater number (0 is usually the bed heater)
  • Annn gAin, expressed as ultimate temperature rise obtained in degC divided by the PWM fraction. For example, if G=180 then at 50% PWM the ultimate temperature rise would be 90C.
  • Cnnn dominant time Constant of the heating process in seconds
  • Dnnn Dead time in seconds
  • Innn Invert PWM signal (I0 = not inverted, I1 = invert PWM/bang-bang signal for inverted temperature control [e.g. with Peltier elements], I2 = full PWM signal inversion, I3 = both) (supported by RRF > 1.20)
  • Vnnn (optional) Power voltage at which the heater was calibrated, zero or negative means not known (supported by RRF > 1.20)

Two additional parameters help control the heating process:

  • Bn selects Bang-bang control instead of PID if non-zero. Default at power-up is 0 for extruder heaters, 1 for the bed heater.
  • Fnnn PWM frequency to use (RepRapFirmware 1.20 and later).
  • Snnn maximum PWM to be used used with this heater on a scale of 0 to 1. Default 1.0.
  • Vnnn VIN supply voltage at which the A parameter was calibrated (RepRapFirmware 1.20 and later). This allows the PID controller to compensate for changes in supply voltage. A value of zero disables compensation for changes in supply voltage.


  • M307 H0 ; report the process parameters for heater 0
  • M307 H1 A346.2 C140 D5.3 B0 S0.8 V23.8; set process parameters for heater 1, use PID, and limit heater 1 PWM to 80%

Each heater and its corresponding load may be approximated as a first order process with dead time, which is characterised by the gain, time constant and dead time parameters. The model can used to calculate optimum PID parameters (including using different values for the heating or cooling phase and the steady state phase), to better detect heater faults, and to calculate feed-forward terms to better respond to changes in the load. Normally these model parameters are found by auto tuning - see M303 and Wiki:Tuning Temperature Control.

For those platforms that provide power voltage monitoring, the calibration voltage setting allows the heating controller to adjust the power automatically in response to changes in the power supply voltage. For example, if a bed or chamber heater is turned on or off, this may cause the power supply voltage to change a little, which if not corrected for would change the extruder heater power.

RepRapFirmware 1.16 and later allow the PID controller for a heater to be disabled by setting the A, C and D parameters to -1. This frees up the corresponding heater control pin for use as a general purpose I/O pin to use with the M42 or M280 command.

M350: Set microstepping mode ¶ 


  • M350 Xnn Ynn Znn Enn Inn


  • Not all parameters need to be used, but at least ''one'' should be used. As with other commands, RepRapFirmware reports the current settings if no parameters are used.
  • Xnn Set stepping mode for the X axis
  • Ynn Set stepping mode for the Y axis
  • Znn Set stepping mode for the Z axis
  • Enn Set stepping mode for Extruder 0 (use Enn:nn:nn etc. for multiple extruders)
  • Inn Enable (nn=1) or disable (nn=0) microstep interpolation mode for the specified drivers, if they support it. The Duet 2 WiFi/Ethernet support interpolation (to x256 microstepping) only when configured for x16 microstepping. The Duet 2 Maestro supports interpolation at all microstep settings.
  • Snn Set chopper mode: 0 = constant off time, 1 = random off time, 2 = spread cycle, 3 - stealth chop. the Duet 2 Wifi/Ethernet supports modes 0, 1 and 2. The Duet 2 Maestro supports modes 2 and 3. If this parameter is not provided, the default will be used.

Modes (nn)

  • 1 = full step
  • 2 = half step
  • 4 = quarter step
  • 8 = 1/8 step
  • 16 = 1/16 step
  • 32 = 1/32 step
  • 64 = 1/64 step
  • 128 = 1/128 step
  • 256 = 1/256 step


  • M350 Z1 (set the Z-axis' driver to use full steps)
  • M350 E4:4:4 (set extruders 0-2 to use quarter steps)

When M350 is processed, the steps/mm will be adjusted automatically to allow for any changes in microstepping. Therefore you can either:

a) Set Steps/mm correctly for the default 1/16 microstepping, then set the microstepping to the desired amount using M350:

M92 X80 Y80 Z400 ; set axis steps/mm
M92 E420:430 ; set extruder 0 and 1 steps/mm
M350 X128 Y128 Z128 E128:128 ; set microstepping


b) Set the microstepping using M350 and then set the correct steps/mm for that microstepping amount:

M350 X128 Y128 Z128 E128:128 ; set microstepping
M92 X640 Y640 Z3200 ; set axis steps/mm @128 microstepping
M92 E3360:3440 ; set extruder 0 and 1 steps/mm

Assuming that in the first example the microstepping was initially at the default x16, both the above examples result in the same steps/mm settings.

Note: microstep interpolation is available on the TMC2660 drivers used on the Duet WiFi and Duet Ethernet, but only when microstepping is set to 16. In other configurations, specifying I1 has no effect.

M374: Save height map ¶ 

Saves the height map.


  • P"filename" (Name of the file to save to


  • M374
  • M374 P"MyAlternateHeightMap.csv"

This saves the grid parameters and height map into the specified file, or the default file heightmap.csv if no filename was specified. To load the height map automatically at startup, use command G29 S1 or M375 in the config.g file.

The G29 S0 command automatically saves the height map to file, therefore you do not need to use M374 after G29 S0.

M375: Load height map ¶ 

Loads the grid matrix file


  • P"filename"


  • M375
  • M375 P"MyAlternateHeightMap.csv"

Without parameters loads default grid (sys/heightmap.csv), and with specified filename attempts to load the specified grid. If not available will not modify the current grid.

In RepRapFirmware this command is equivalent to the G29 S1 command.

M376: Set bed compensation taper ¶ 


  • Hnnn Height (mm) over which to taper off the bed compensation


  • M376 H10

This command specifies that bed compensation should be tapered linearly over the specified height, so that full bed compensation is applied at Z=0 and no bed compensation is applied when Z is at or above that height. If H is zero or negative then no tapering is applied, so compensation is performed throughout the entire print.

RepRapFirmware does not adjust the extrusion factor to account for the layer height varying when tapered bed compensation is used. Therefore it is recommended that the taper height be set to at least 20x the maximum error in the height map, so that the maximum amount of the resulting over- or under- extrusion is limited to 5%.

M400: Wait for current moves to finish ¶ 


  • M400

Finishes all current moves and and thus clears the buffer. That's identical to G4 P0.

M401: Deploy z-probe ¶ 

Example: M401

This runs macro file sys/deployprobe.g.

M402: Retract z-probe ¶ 

Example: M402

This runs macro file sys/retractprobe.g.

M404: Filament width and nozzle diameter ¶ 


  • Nnnn Filament width (in mm)
  • Dnnn Nozzle diameter (in mm)


  • M404 N1.75
  • M404 N3.0 D1.0

Enter the nominal filament width (3mm, 1.75mm) or will display nominal filament width without parameters.

The 'D' parameter is used to properly detect the first layer height when files are parsed or a new print is being started.

The values of this command are currently only used for the print monitor.

M408: Report JSON-style response ¶ 


  • Snnn Response type
  • Rnnn Response sequence number


  • M408 S0

Report a JSON-style response by specifying the desired type using the 'S' parameter.

The following response types are supported:

  • Type 0 is a short-form response, similar to the response used by older versions of the web interface.
  • Type 1 is like type 0 except that static values are also included.
  • Type 2 is similar to the response provided by the web server for Duet Web Control.
  • Type 3 is an extended version of type 2 which includes some additional parameters that aren't expected to change very frequently.
  • Type 4 is an extended version of type 2 which may be used to poll for current printer statistics.
  • Type 5 reports the current machine configuration.

Here is an example of a typical type 0 response:


"sfactor":100.00, "efactor":[100.00,100.00],"tool":1,"probe":"535","fanPercent":[75.0,0.0],"fanRPM":0,"homed":[0,0,0],"fraction_printed":0.572}

The response is set as a single line with a newline character at the end. The meaning of the fields is:

status: I=idle, P=printing from SD card, S=stopped (i.e. needs a reset), C=running config file (i.e starting up), A=paused, D=pausing, R=resuming from a pause, B=busy (e.g. running a macro), F=performing firmware update

heaters: current heater temperatures, numbered as per the machine (typically, heater 0 is the bed)

active: active temperatures of the heaters

standby: standby temperatures of the heaters

hstat: status of the heaters, 0=off, 1=standby, 2=active, 3=heater fault. Heater 0 is normally the bed heater, heaters 1, 2.. are the extruder heaters.

pos: the X, Y and Z (and U, V, W if present) axis positions of the current tool (if a tool is selected), or of the print head reference point if no tool is selected

extr: the positions of the extruders

sfactor: the current speed factor (see M220 command)

efactor: the current extrusion factors (see M221 command), one value per extruder

tool: the selected tool number. A negative number typically means no tool selected.

probe: the Z-probe reading

fanPercent: the speeds of the controllable fans, in percent of maximum

fanRPM: the print cooling fan RPM

homed: the homed status of the X, Y and Z axes (and U, V, W if they exist), or towers on a delta. 0=axis has not been homed so position is not reliable, 1=axis has been homed so position is reliable.

fraction_printed: the fraction of the file currently being printed that has been read and at least partially processed.

message: the message to be displayed on the screen (only present if there is a message to display)

timesLeft: an array of the estimated remaining print times (in seconds) calculated by different methods. These are currently based on the proportion of the file read,

the proportion of the total filament consumed, and the proportion of the total layers already printed. Only present if a print from SD card is in progress.

seq: the sequence number of the most recent non-trivial G-code response or error message. Only present if the R parameter was provided and the current sequence number is greater than that.

resp: the most recent non-trivial G-code response or error message. Only present if the R parameter was provided and the current sequence number is greater.

The type 1 response comprises these fields plus some additional ones that do not generally change and therefore do not need to be fetched as often. The extra fields include:

myName: the name of the printer

firmwareName: the name of the firmware, e.g. "RepRapFirmware" or "Smoothieware"

geometry: one of "cartesian", "delta", "corexy, "corexz" etc.

axes: the number of axes

volumes: the number of SD card slots available

numTools: the number of available tools numbered contiguously starting from 0

The fields may be in any order in the response. Other implementations may omit fields and/or add additional fields.

For a more detailed comparison of type 2 - 5, see

PanelDue currently uses only M408 S0 and M408 S1.

M450: Report Printer Mode ¶ 


  • M450

Printers can be used for different task by exchanging the toolhead. Depending on the tool, a different behavior of some commands can be expected. This command reports the current working mode. Possible responses are:




The default at power up is FFF.

M451: Select FFF Printer Mode ¶ 


  • none


  • M451

Switches to Fused Filament Fabrication mode for filament printing.

M452: Select Laser Printer Mode ¶ 


  • Pnnn Logical pin number used to control the laser
  • Rnnn The value of the S parameter in M3 commands that corresponds to full laser power, default 255
  • Fnnn The PWM frequency used to drive the laser


  • M452 P2 R255 F200 ; switch to laser mode using the heater 2 (E1 heater) output pins to control the laser

Switches to laser mode. This mode enables handling of a laser pin and makes sure that the laser is only activated during G1 moves if laser was enabled or E is increasing. G0 moves should never enable the laser. M3/M5 can be used to enable/disable the laser for moves. Logical pin numbers for the P parameter are as defined for the M42 and M208 commands. If a heater or fan output is used to control the laser, you must disable the corresponding heater (see M307) or fan (see M106) first.

M453: Select CNC Printer Mode ¶ 


  • Pfff:rrr Logical pin numbers used to drive the spindle motor in clockwise and counterclockwise directions. Omit the ":rrr" part if the spindle turns clockwise only.
  • Rnnn Spindle RPM that is achieved at full PWM. Used to convert the S parameter in M3 and M4 commands to a PWM value.
  • Fnnn (optional) The PWM frequency to use


  • M453 P2 R5000 ; switch to CNC mode using heater 2 (E1 heater) pins to control the spindle motor

Switches to CNC mode. In this mode M3/M4/M5 control the pins defined for the milling device. By default, no output is assigned to the spindle motor. Logical pin numbers for the P parameters are as defined for the M42 and M208 commands. If you wish to assign a heater or fan output to control the spindle motor as in the above example, you must first disable the corresponding heater (see M307) or fan (see M106).

M500: Store parameters ¶ 


  • M500

Save current parameters to the sys/config-override.g on the SD card. (similar to other firmware's storing to EEPROM). Implemented in RepRapFirmware 1.17 and later. The parameters stored are:

  • M307 auto tune results
  • PID parameters, if you used M301 to override the auto tune PID settings
  • Delta printer M665 and M666 settings
  • G31 trigger height, trigger value and X and Y offsets for each possible Z probe type

Ensure that M501 is at the end of config.g in order for the values in config-override.g to be loaded on startup.

M501: Read stored parameters ¶ 


  • None


  • M501

Set the active parameters to those stored in sys/config-override.g on the SD card. This command should be included near the end of the config.g file so that the stored parameters will be loaded at startup. It can also be used to revert parameters to the values stored in config-override.g after experimenting with them.

M502: Revert stored parameters ¶ 


  • M502

This command resets all tunable parameters to their values, as set in config.g. This doesn't reset any parameters stored in the sys/config-override.g, so it must be followed with M500 if you want to do that.

M503: Print settings ¶ 


  • M503

This command asks the firmware to reply with the current print settings stored in sys/config.g. The reply output includes the G-Code commands to produce each setting. For example, the Steps Per Unit values are displayed as an M92 command.

Note that the output may be truncated if it is too long. M503 does not include values stored in config-override.g.

M540: Set MAC address ¶ 


  • Pnnn The MAC address


  • M540 P0xBE:0xEF:0xDE:0xAD:0xFE:0xED

Sets the of the printer. This should be done before any other network commands. The MAC address is six one-byte hexadecimal numbers separated by colons. The 0x prefix is optional.

All devices running on the same network shall all have different MAC addresses. For your printers, changing the last digit is sufficient.

Note on the DuetWifi the MAC address is unique and set on the Wifi Module so this command has no effect. The default MAC address on a DuetEthernet is generated from the unique processor ID so there is normally no need to change it.

M550: Set Name ¶ 


  • Pnnn Machine name


  • M550 PGodzilla

Sets the name of the printer to (in this case) Godzilla. The name can be any string of printable characters except ';', which still means start comment.

M551: Set Password ¶ 


  • Pnnn Password


  • M551 Pmy-very-secret-word

The code 'P' is not part of the password. Note that as this is sent in clear it does not (nor is it intended to) offer a security. But on machines that are (say) on a network, it might prevent idle messing about. The password can contain any printable characters except ';', which still means start comment.

if the specified password differs from the default one (i.e. reprap), the user will be asked to enter it when a connection is established.

M552: Set IP address, enable/disable network interface ¶ 

Parameters for Duet Ethernet and 06/085

  • Pnnn IP address, means acquire an IP address using DHCP
  • Snnn 0 = disable networking, 1 = enable networking
  • Rnnn (optional, RepRapFirmware 1.17 and earlier only) HTTP port, default 80

Parameters for Duet WiFi

  • P"ssid" (optional, RepRapFirmware 1.20 and later) SSID of network to connect to. The SSID and password must already have been registered using M587. If this parameter is not present, the Duet WiFi will try to connect to the strongest network that is broadcasting its SSID and whose SSID has been registered using M587.
  • Snnn 0 = disable networking, 1 = enable networking as a client, 2 = enable networking as an access point , -1 = disable WiFi module

Example (Duet Ethernet)

  • M552 S1 P192.168.1.14

Sets the IP address of the machine to (in this case) If the S parameter is not present then the enable/disable state of the network interface is not changed.

Example (Duet WiFi)

  • M552 S1 P"MyNetwork"

M552 with no parameters reports the current network state and IP address.

In firmware 1.18 and later the HTTP port address is set using the M586 command, so the R parameter of this command is no longer supported.

On the Duet WiFi running firmware 1.19 and later, the IP address is set in the M587 command when you configure the access point details.

M553: Set Netmask ¶ 


  • Pnnn Net mask


  • M553 P255.255.255.0

Sets the network mask of the RepRap machine to (in this case) A restart may be required before the new network mask is used. If no 'P' field is specified, this echoes the existing network mask configured.

DuetWifiFirmware versions 1.18 and earlier do not support setting the network mask manually.

M554: Set Gateway ¶ 


  • Pnnn Gateway


  • M554 P192.168.1.1

Sets the Gateway IP address of the RepRap machine to (in this case) A restart may be required before the new gateway IP address is used. If no 'P' field is specified, this echoes the existing Gateway IP address configured.

DuetWifiFirmware versions 1.18 and earlier do not support setting the gateway address.

M555: Set compatibility ¶ 


  • Pnnn Emulation type


  • M555 P1

Set the firmware to a mode where its input and (especially) output behaves similar to other established firmware. The value of the 'P' argument is:


Currently, only RepRapFirmware and Marlin emulations are supported.

M556: Axis skew compensation ¶ 


  • Snnn Height of the measured distances
  • Xnnn Deviation in X direction
  • Ynnn Deviation in Y direction
  • Znnn Deviation in Z direction


  • M556 S100 X0.7 Y-0.2 Z0.6
Block Image

This tells software the tangents of the angles between the axes of the machine obtained by printing then measuring a test part. The S parameter (100 here) is the length of a triangle along each axis in mm. The X, Y and Z figures are the number of millimeters of the short side of the triangle that represents how out of true a pair of axes is. The X figure is the error between X and Y, the Y figure is the error between Y and Z, and the Z figure is the error between X and Z. Positive values indicate that the angle between the axis pair is obtuse, negative acute.

Printable parts for calibrating the deviation from orthogonality can be found at

M557: Set Z probe point or define probing grid ¶ 

Parameters to define G29 probe grid (all values in mm)

  • Xaaa:bbb Minimum and maximum X coordinates to probe
  • Yaaa:bbb Minimum and maximum Y coordinates to probe
  • Raaa Radius to probe
  • Saaa Probe point spacing (RepRapFirmware 1.19beta10 and later also support Saaa:bbb)


  • M557 X0:200 Y0:220 S20
  • M557 R150 S15

Parameters to define G32 probe points (Cartesian/CoreXY printers only, deprecated and not supported in firmware 1.18 and later)

  • Pnnn Probe point number
  • Xnnn X coordinate
  • Ynnn Y coordinate


  • M557 P1 X30 Y40.5

Set the points at which the bed will be probed to compensate for its plane being slightly out of horizontal.

The first form defines the grid for G29 bed probing. For Cartesian printers, specify minimum and maximum X and Y values to probe and the probing interval. For Delta printers, specify the probing radius. If you define both, the probing area will be the intersection of the rectangular area and the circle. There is a firmware-dependent maximum number of probe points supported. Currently this is 121 on the Duet 06/085 (enough for a 11x11 grid) and 441 for the Duet WiFi and Duet Ethernet (enough for a 21x21 grid)

The second form defines the points for for G32 bed probing. The P value is the index of the point (indices start at 0) and the X and Y values are the position to move extruder 0 to to probe the bed. An implementation should allow a minimum of three points (P0, P1 and P2). This just records the point coordinates; it does not actually do the probing. See G32. Defining the probe points in this way is deprecated in RepRapFirmware, you should define them in a bed.g file instead.

M558: Set Z probe type ¶ 


  • Pnnn Z probe type
  • Fnnn Feed rate (i.e. probing speed, mm/min)
  • Hnnn Dive height (mm)
  • Innn Invert (I1) or do not invert (I0, default) the Z probe reading (RepRapFirmware 1.16 and later)
  • Rnnn Z probe recovery time after triggering, default zero (seconds) (RepRapFirmware 1.17 and later)
  • Tnnn Travel speed to and between probe points (mm/min)
  • Annn Maximum number of times to probe each point, default 1
  • Snnn Tolerance when probing multiple times, default 0.03mm
  • Bn If 1, turn off bed heater while probing, default (B0) leaves heater on. (RepRapFirmware 1.21RC2 and later)

Obsolete parameters

  • Xnnn If nonzero, use probe for homing X axis (RRF 1.19 and earlier)
  • Ynnn If nonzero, use probe for homing Y axis (RRF 1.19 and earlier)
  • Znnn If nonzero, use probe for homing Z axis (RRF 1.19 and earlier)


  • M558 P1 X0 Y0 Z1 F500 T5000 H3

The H parameter defines the Z probe dive height, which is the height above the trigger height from which probing starts. The default is 3mm or 5mm depending on firmware version. You may wish to increase it during initial calibration.

A Z probe may be a switch, an IR proximity sensor, or some other device. This selects which to use:

  • P0 indicates that no Z probe is present. Whenever Z probing is commanded, you will be prompted to jog the Z axis until the nozzle is just touching the bed and then signal completion.
  • P1 specifies an unmodulated or smart IR probe, or any other probe type that emulates one (probe output is an analog signal that rises with decreasing nozzle height above the bed). If there is a control signal to the probe, it is driven high when the probe type is P1.
  • P2 specifies a simple modulated IR probe, where the modulation is commanded directly by the main board firmware using the control signal to the probe.
  • P3 is similar to P1 but drives the control signal to the probe low. This may be used to switch between different Z probes.
  • P4 selects a switch for bed probing (on the Duet, this must be connected to the E0 endstop pins).
  • P5 (from RepRapFirmware 1.14) selects a switch by default (normally closed) for bed probing between the In and Gnd pins of the Z-probe connector (Duet 0.8.5 and Duet WiFi).
  • P6 is as P4 but the switch is connected to an alternative connector (on the Duet series, the E1 endstop connector).
  • P7 (from RepRapFirmware 1.20) selects a switch (by default normally closed) connected to the Z endstop input.
  • P8 (from RepRapFirmware 1.20) is as P5 but is unfiltered, for faster response time.
  • P9 (from RepRapFirmware 1.21RC2) is as P5 but for a BLTouch probe that needs to be retracted and redeployed between probe points.
  • P10 means use Z motor stall detection as the Z probe trigger.

In RepRapFirmware versions 1.20beta4 and earlier, the X, Y and Z parameters specify whether each axis uses the Z probe as a substitute homing switch or not. If the parameter is nonzero, the Z probe is used for homing that axis. If the parameter is zero, the endstop switch for that axis is used for homing instead. In firmware 1.20beta6 and later, use the S parameter in the M574 command instead to indicate whether you are using a homing switch or a Z probe for homing X and Y.

The A and S parameters control multiple probing. Probing is repeated until two consecutive probe attempts produce results that differ by no more than the S parameter; then the average of those two results is used. However, if the number of attempts specified by the A parameter is reached without getting two consecutive results within tolerance of each other, no further probe attempts are made and the average result of all the attempts is used.

Related commands: G29, G30, G31, G32, M401, M402.

M559: Upload configuration file ¶ 


  • Pfilename. File name to upload to, default is config.g. If the filename does not include a path, the default is /sys.
  • Snnn File size for binary transfer. If not present, the transfer is terminated by a M29 command
  • Cnnn CRC-32 of the file (optional)


  • M559

Was used by the original web interface to upload a configuration file. Can now be used to upload any file.

M560: Upload web page file ¶ 


  • As for M559 except the default filename is reprap.htm and the default path is /www. If the S parameter is absent then the file data is terminated by a special string as described below.


  • M560

Was used by the original web interface to upload a file that is the control page. Now deprecated. After sending M560 the file (usually an HTML file) should be sent, terminated by the string :

<!-- **EoF** -->

Clearly that string cannot exist in the body of the file, but can be put on the end to facilitate this process.

M561: Set Identity Transform ¶ 


  • M561

This cancels any bed-plane fitting as the result of probing (or anything else) and returns the machine to moving in the user's coordinate system.

M562: Reset temperature fault ¶ 


  • Pnnn Heater number


  • M562 P2

Reset a temperature fault on heater/sensor 2. If the heater has switched off and locked because it has detected a fault, this will reset the fault condition and allow you to use the heater again. Obviously to be used with caution. If the fault persists it will lock out again after you have issued this command. P0 is the bed; P1 the first extruder, and so on.

In firmware 1.20 and later, M562 with no parameters will clear a heater fault on all heaters

M563: Define or remove a tool ¶ 


  • Pnnn Tool number
  • S"name"'' Tool name (optional)
  • Dnnn Extruder drive(s)
  • Hnnn Heater(s)
  • Fnnn Fan(s) to map fan 0 to (RepRapFirmware 1.16 and later)
  • Xnnn Axis or axes to map X movement to (RepRapFirmware 1.16 and later)
  • Ynnn Axis or axes to map Y movement to (RepRapFirmware 1.19 and later)
  • Lnnn Drive to use for filament mapping. By default RRF will use the first and only extruder drive if this parameter is not specified (supported by RRF >= 2.02)


  • M563 P0 D0:2:3 H1:3 ; create a tool using extruder drives 0, 2 and 3 and heaters 1 and 3
  • M563 P1 D1 H2 X3 ; create a tool using extruder drive 1 and heater 2 with X movement mapped to the U axis
  • M563 P2 D0:1 H1:2 X0:3 F0:2 ; create a tool using extruder drives 0 and 1, heaters 1 and 2, with X movement mapped to both X and U axes and fan 0 mapped to fans 0 and 2

* M563 P3 D0 H1 S"Chocolate extruder" ; create a named tool using extruder drive 0 and heater 1


Tools are usually (though not necessarily) extruders.

P The 'P' field specifies the tool number. Tool numbers can have any positive integer value and 0.

D The 'D' field specifies the drive(s) used by the tool - in the first example drives 0, 2 and 3. Drive 0 is the first drive in the machine after the movement drives (usually X, Y and Z). If there is no 'D' field the tool has no drives. Tools are driven using multiple values in the 'E' field of G1 commands, each controlling the corresponding drive in the 'D' field above, as follows:

G1 X90.6 Y13.8 E2.24:2.24:15.89
G1 X70.6 E0:0:42.4

The first line moves straight to the point (90.6, 13.8) extruding a total of 2.24mm of filament from both drives 0 and 2 and 15.98mm of filament from drive 3. The second line moves back 20mm in X extruding 42.4mm of filament from drive 3.

Alternatively, if the slicer does not support generating G1 commands with multiple values for the extrusion amount, the M567 command can be used to define a tool mix ratio.

The 'D' field number corresponds to the 'E' parameter defined in the M584 command. '0' means first 'E' driver in M584 and so on.

H The 'H' field specifies the tool's heaters - in the first example heaters 1 and 3. Heater 0 is usually the hot bed (if any) so the first extruder heater is usually 1. If there is no H field the tool has no heaters.

Normally an M563 command is immediately followed by a G10 command to set the tool's offsets and temperatures.

It is permissible for different tools to share some (or all) of their drives and heaters. So, for example, you can define two tools with identical hardware, but that just operate at different temperatures.

F The print cooling fan of tool 0 defaults to F0. mapping is only required in machines that have more than one tool, or are not using fan 0 as the print cooling fan on tool 0.

X, Y The X and Y mapping option is used to create tools on machines with multiple independent X and/or Y carriages. The additional carriages are set up as axes U, V etc. (see M584) and the X mapping option in M563 defines which carriage or carriages are used.

If you use the M563 command with a P value for a tool that has already been defined, that tool is redefined using the new values you provide.

S As shown in the example above the S parameter can be used to give a tool a name. RepRapFirmware supports an additional form of the M563 command. The command:

M563 S1

means add 1 (the value of the S parameter) to all tool numbers found in the remainder of the current input stream (e.g. the current file if the command is read from a file on the SD card), or until a new M563 command of this form is executed. The purpose of this is to provide compatibility between systems in which tool numbers start at 1, and programs such as slic3r that assume tools are numbered from zero.

RepRapFirmware allows the deletion of existing tools if M563 is called in this way:

M563 P1 D-1 H-1

M564: Limit axes ¶ 


  • Hnnn H1 = forbid movement of axes that have not been homed, H0 = allow movement of axes that have not been homed (firmware 1.21 and later)
  • Snnn S1 = limit movement within axis boundaries, S0 = allow movement outside boundaries


  • M564 S0 H0

Allow moves outside the print volume and before homing, or not. If the S parameter is 0, then you can send G codes to drive the RepRap outside its normal working volume, and it will attempt to do so. Likewise if the H parameter is zero you can move the head or bed along axes that have not been homed. The default behaviour is S1 H1. On some types of printer (e.g. Delta and SCARA), movement before homing may be prohibited regardless of the H parameter.

M566: Set allowable instantaneous speed change ¶ 


  • Xnnn Maximum instantaneous speed change of the X axis (mm/min)
  • Ynnn Maximum instantaneous speed change of the Y axis
  • Znnn Maximum instantaneous speed change of the Z axis
  • Ennn Maximum instantaneous speed change of the extruder drives


  • M566 X600 Y600 Z50 E600

Sets the maximum allowable speed change (sometimes called 'jerk speed') of each motor when changing direction.

The model files and gcode files used by repraps generally render circles and other curves shapes as a sequence of straight line segments. If the motors were not allowed any instantaneous speed change, they would have to come to a stop at the junction between each pair of line segments. By allowing a certain amount of instantaneous speed change, printing speed can be maintained when the angle between the two line segments is small enough.

If you set these X and Y values too low, then the printer will be slow at printing curves. If they are too high then the printer may be noisy when cornering and you may suffer ringing and other print artefacts, or even missed steps.

When mesh bed compensation is used, movement may be jerky if the allowed Z jerk is too low, because the Z speed needs to change abruptly as the head moves between squares in the mesh.

M567: Set tool mix ratios ¶ 


  • Pnnn Tool number
  • Ennn Mix ratios


  • M567 P2 E0.1:0.2:0.1:0.6

This example sets the mix ratio for tool 2 (the P value). When mixing is then turned on (see M568), only single E values need to be sent on a G1 command (any extra E values will be ignored, but are not illegal):

G1 X20 E1.3

This will move to X=20 extruding a total length of filament of 1.3mm. The first drive of tool 2 will extrude 0.1*1.3mm, the second 0.2*1.3mm and so on. The ratios don't have to add up to 1.0 - the calculation done is as just described. But it is normally sensible if they do, otherwise under or over extrusion would occur.

WARNING: Currently the firmware will allow to set a mixing ratio where every extruder will drive at 100% - in case of a setup where several extruders feed the same hotend (like Diamond Hotends) this can lead to dangerously high pressures that could damage the printer.

See also M568.

M568: Turn off/on tool mix ratios ¶ 

Deprecated: from firmware 1.19 onwards, this command is no longer required or supported. If a G1 command for the tool provides just one E value, then the mix ratio defined by M567 will always be used.


  • Pnnn Tool number
  • Snnn Whether mix ratios should be activated


  • M568 P2 S0

Turn on/off automatic mix ratios for tool 2. If the S parameter is 0 mixing is turned off; if it is non-zero it is turned on.

After turning off command G1 instructions must send as many E values as the tool has drives:

G1 X20 E0.2:0.4:0.166:0.3

The off state is the default.

M569: Set motor driver direction, enable polarity and step pulse timing ¶ 


  • Pnnn Motor driver number
  • Snnn Direction of movement of the motor(s) attached to this driver: 0 = backwards, 1 = forwards (default 1)
  • Rnnn Driver enable polarity: 0 = active low, 1 = active high, -1 = driver is always disabled and is not monitored (default 0)
  • Tnnn (firmware 1.14 and later) Minimum driver step pulse width and interval in microseconds
  • Taa:bb:cc:dd (firmware 1.21 and later) Minimum driver step pulse width, step pulse interval, direction setup time and direction hold time, in microseconds
  • Dnn (firmware 2.0 and later, only applies to TMC2660 and TMC22xx stepper drivers) Driver mode: 0=constant off time, 1=random off time, 2=spread cycle, 3=stealthChop or stealthChop2
  • Fnn (firmware 2.02 and later) Off-time in the chopper control register, 1 to 15
  • Cnnnn (firmware 2.0 and later, only applies to TMC2660 and TMC22xx stepper drivers) Lowest 17 bits of the chopper control register value


  • M569 P0 S0 ; reverse the direction of the motor attached to driver 0
  • M569 P5 R1 T2.5:2.5:5:0 ; driver 5 requires an active high enable, 2.5us minimum step pulse, 2.5us minimum step interval, 5us DIR setup time and no hold time


If no T parameter is given, then the step pulse width and interval are guaranteed to be suitable for the on-board drivers only. RepRapFirmware only remembers the highest T parameters seen in any M569 command, and applies that value to all drivers for which any nonzero T parameter was specified. Therefore if you reduce the T parameters, you must restart the firmware for the change to take effect.

Some versions of RepRapFirmware prior to 1.14 also provided XYZ and E parameters to allow the mapping from axes and extruders to stepper driver numbers to be changed. From 1.14 onward, this functionality is provided by M584 instead.

M570: Configure heater fault detection ¶ 

Parameters for RepRapFirmware 1.14 and earlier

  • Snnn Heater timeout (in seconds)


  • M570 S120

After a heater has been switched on, wait 120 seconds for it to get close to the set temperature. If it takes longer than this, raise a heater fault.

Parameters for RepRapFirmware 1.15e and later

  • Hnnn Heater number
  • Pnnn Time in seconds for which a temperature anomaly must persist on this heater before raising a heater fault (default 5 seconds)
  • Tnnn Permitted temperature excursion from the setpoint for this heater (default 15C)
  • Snnn Timeout in minutes for print to be cancelled after heater fault (Firmware 1.20 and later).


  • M570 H1 P4 T15

Warning! Heating fault detection is provided to reduce the risk of starting a fire if a dangerous fault occurs, for example if the heater cartridge or thermistor falls out of the heater block. You should carefully consider sensible values for the detection time or permitted temperature excursion, setting them to incorrectly will reduce the protection. Also note that this protection should not be relied upon exclusively. Protection against fire should be provided external to the operation of the firmware as well (fuses, fire detection, do not print unattended etc)

M571: Set output on extrude ¶ 


  • Snnn Output value
  • Fnnn Output PWM frequency (RepRapFirmware 1.17 and later)
  • Pnnn Logical pin number (RepRapFirmware 1.17 and later), defaults to the FAN0 output in firmware 1.19 and earlier until M571 with a P parameter has been seen


  • M571 P3 F200
  • M571 S0.5

This turns the controlled pin output on whenever extrusion is being done, and turns it off when the extrusion is finished. The output could control a fan or a stirrer or anything else that needs to work just when extrusion is happening. It also can be used to control a laser beam. The S parameter sets the value of the PWM to the output. 0.0 is off; 1.0 is fully on.

In RepRapFirmware 1.17 and later you can use the P parameter to change the pin used and you can also set the PWM frequency. Pin numbers are the same as in the M42 and M280 commands. The pin you specify must not be in use for anything else, so if it is normally used as a heater you must disable the heater first using M307, or if it is used for a fan you must disable the fan using M106 with the I-1 parameter.

RepRapFirmware 1.20 and later do not default to using the FAN0 output, so you must send M571 with a P parameter at least once to define the pin that you wish to use.

M572: Set or report extruder pressure advance ¶ 


  • Dnnn Extruder number
  • Snnn Pressure advance amount (in seconds)


  • M572 D0 S0.1 ; set extruder 0 pressure advance to 0.1 seconds
  • M572 D0:1:2 S0.2 ; set extruder 0, 1 and 2 pressure advance to 0.2 seconds (RepRapFirmware 1.20 and later)

This sets the pressure advance coefficient (S parameter) for the specified extruder (D parameter). Supported by RepRapFirmware-dc42, -ch and -dn.

Pressure advance causes the extruder drive position to be advanced or retarded during printing moves by an additional amount proportional to the rate of extrusion. At the end of a move when the extrusion rate is decreasing, this may result in the extruder drive moving backwards (i.e. retracting). Therefore, if you enable this feature, you may need to reduce the amount of retraction you use in your slicing program to avoid over-retraction.

For Bowden extruders, an S value between 0.1 and 0.25 usually gives the best print quality. Direct extruders need smaller values, for example 0.05. Mixing hot ends need larger values.

M573: Report heater PWM ¶ 


  • Pnnn Heater number


  • M573 P1

This gives a running average (usually taken over about five seconds) of the PWM to the heater specified by the P field. If you know the voltage of the supply and the resistance of the heater this allows you to work out the power going to the heater. Scale: 0 to 1.

M574: Set endstop configuration ¶ 


  • Xnnn Switch type for X axis
  • Ynnn Switch type for Y axis
  • Znnn Switch type for Z axis
  • E Select extruder endstops to define active high or low (RepRapFirmware 1.16 and earlier only)
  • Snnn Endstop type: 0 = active low endstop input, 1 = active high endstop input, 2 = Z probe, 3 = motor load detection


  • M574 X1 Y2 Z0 S1 ; X endstop at low end, Y endstop at high end, no Z endstop, all active high

This defines the type of endstop switch or opto sensor that the printer has for each axis: 0 = none, 1 = low end, 2 = high end. The optional S parameter defines whether the endstop input is active high (S1, the default) or low (S0). A normally-closed endstop switch wired in the usual way produces an active high output (S1).

This is intended for use with boards that provide a single endstop input for each axis that may be used for either a high or a low end endstop, such as the Duet. On delta printers, the XYZ parameters refer to the towers and the endstops should normally all be high end (i.e. at the top of the towers).

In RepRapFirmware 1.16 and earlier, the M574 command with E parameter is used to specify whether a Z probe connected to the E0 endstop input produces an active high (S1) or active low (S0) output. In RepRapFirmware 1.17 and later, use the I parameter of the M558 command instead.

The S2 and S3 options are supported in firmware 1.20beta6 and later.

M575: Set serial comms parameters ¶ 


  • Pnnn Serial channel number
  • Bnnn Baud rate
  • Snnn Whether checksums should be used


  • M575 P1 B57600 S1

This sets the communications parameters of the serial comms channel specified by the P parameter. P0 specifies the main serial interface (typically a USB port, or serial-over-USB), while P1 specifies an auxiliary serial port (for example, the port used to connect a PanelDue). The B parameter is the required baud rate (this parameter is typically ignored if the port is a true USB port). The S parameter is a bitmap of features. The lowest bit, if set, specifies that only commands that include a valid checksum should be accepted from this comms channel.

M577: Wait until endstop is triggered ¶ 


  • Snnn Desired endstop level
  • Xnnn Select X axis endstop
  • Ynnn Select Y axis endstop
  • Znnn Select Z axis endstop
  • Ennn Select extruder drive endstop


  • M577 E0 S1

Wait for an endstop switch to be pressed. The example above will wait until the first extruder endstop is triggered.

The following trigger types may be used using the 'S' parameter:

0: Endstop not hit

1: Low endstop hit

2: High endstop hit

3: Near endstop (only Z probe)

M578: Fire inkjet bits ¶ 

This command is not enabled unless the SUPPORT_INKJET feature is enabled when the firmware is built.


  • Pnnn Inkjet head number
  • Snnn Bit pattern


  • M578 P3 S5

This fires inkjet head 3 (the P field) using the bit pattern specified by the S field. The example shown would fire bits 101. If the P parameter is ommitted inkjet 0 is assumed.

This is a version of the M700 command used by

An alternative way of controlling inkjets would be to use the P parameter on the G1 command, in conjunction with the M670 command.

M579: Scale Cartesian axes ¶ 


  • Xnnn Scale factor for X axis
  • Ynnn Scale factor for Y axis
  • Znnn Scale factor for Z axis


  • M579 X1.0127 Y0.998

On a Cartesian RepRap you can get prints exactly the right size by tweaking the axis steps/mm using the M92 G Code above. But this does not work so easily for Delta and other RepRaps for which there is cross-talk between the axes. This command allows you to adjust the X, Y, and Z axis scales directly. So, if you print a part for which the Y length should be 100mm and measure it and find that it is 100.3mm long then you set Y0.997 (= 100/100.3).

M580: Select Roland ¶ 

This M-code is not available by default. To enable it change the value of SUPPORT_ROLAND in the Pins_*.h file from 0 to 1 and recompile the firmware


  • Rnnn Whether Roland mode should be activated
  • Pnnn Initial text to send to the Roland controller


  • M580 R1 PVS4;!VZ2;!MC1;

This is not really anything to do with RepRap, but it is convenient. The are very widely available in hackerspaces and maker groups, but annoyingly they don't speak G Codes. As all RepRap firmware includes a G-Code interpreter, it is often easy to add functions to convert G Codes to M580 selects a Roland device for output if the R field is 1, and returns to native mode if the R field is 0. The optional P string is sent to the Roland if R is 1. It is permissible to call this repeatedly with R set to 1 and different strings in the P field to communicate directly with a Roland.

M581: Configure external trigger ¶ 


  • Tnn Logical trigger number to associate the endstop input(s) with, from zero up to a firmware-specific maximum (e.g. 9 for RepRapFirmware)
  • X, Y, Z, E Selects endstop input(s) to monitor
  • P Reserved, may be used in future to allow general I/O pins to cause triggers
  • S Whether trigger occurs on a rising edge of that input (S1, default), falling edge (S0), or ignores that input (S-1). By default, all triggers ignore all inputs.
  • C Condition: whether to trigger at any time (C0, default) or only when printing a file from SD card (C1)


  • M581 E1:2 S1 T2 C1 ; invoke trigger 2 when a rising edge is detected on the E1 or E2 endstop input and a file is being printed from SD card

When M581 is executed, if the T parameter is present but the other parameters are omitted, the trigger inputs and edge polarities for that trigger number are reported. Otherwise, the specified inputs and their polarities are added to the conditions that cause that trigger. Using S-1 with no X Y Z or E parameters sets the trigger back to ignoring all inputs.

Trigger number 0 causes an emergency stop as if M112 had been received. Trigger number 1 causes the print to be paused as if M25 had been received. Any trigger number # greater then 1 causes the macro file sys/trigger#.g to be executed. Polling for further trigger conditions is suspended until the trigger macro file has been completed. RepRapFirmware does not wait for all queued moves to be completed before executing the macro, so you may wish to use the M400 command at the start of your macro file. If several triggers are pending, the one with the lowest trigger number takes priority.

M582: Check external trigger ¶ 


  • T Trigger number to poll


  • M582 T2 ; check levels of inputs that give rise to trigger #2

Triggers set up by the M581 command are normally activated only when the specified inputs change state. This command provides a way of causing the trigger to be executed if the input is at a certain level. For each of the inputs associated with the trigger, the trigger condition will be checked as if the input had just changed from the opposite state to the current state.

For example, if you use M581 to support an out-of-filament sensor, then M582 allows you to check for out-of-filament just before starting a print.

M583: Wait for pin ¶ 

soon to be implemented


  • Pnnn Pin number
  • Sn State to wait for (0 or 1) or analogue tolerance
  • Rnnn Analogue value to wait for (between 0.0 and 1.0)


  • M583 P5 S0 ; Wait for Pin 5 to become 0

This allows you, for example, to turn on a DC motor (see the M42 command) then wait until a switch connected to Pin Pnnn gives the value Sn.

If the R field is present, then the system waits until the value on analogue Pnnn is reached. In this case the S value is used as a tolerance, so M583 P8 R0.7 S0.01 would

wait until the analogue value on Pin 8 was between 0.69 and 0.71.

M584: Set drive mapping ¶ 


  • Xnnn Driver number(s) for X motor(s)
  • Ynnn Driver number(s) for Y motor(s)
  • Znnn Driver number(s) for Z motor(s)
  • U, V, W, A, B, Cnnn Driver number(s) for additional axes U, V, W, A, B and C (UVW available in RepRapFirmware 1.16 and later; UVWABC available in RepRapFirmware 1.19 and later)
  • Ennn Driver number(s) for E motor(s)
  • Pnnn Number of visible axes, defaults to the total number of axes configured.


  • M584 X0 Y1 Z2:3 E4:5:6 ; Driver 0 controls the X motor, 1 controls Y, 2 and 3 control Z motors, 4 and 5 control E motors

Assigning a drive using M584 does not remove its old assignment. Therefore, if you assign a drive that defaults to being an extruder drive, you should also assign the extruder drives explicitly as in the above example. Failure to do so may result in unexpected behaviour.

You can use M584 to create additional axes - for example, to represent additional carriages on a machine with multiple independent X carriages. In 1.20 and later firmware you can create new axes in any order. In earlier firmware versions, additional axes must be created in the order UVWABC. You can hide some of the last axes you create using the P parameter. Hidden axes have no homing buttons or jog controls in the user interface.

On the Duet WiFi and Duet Ethernet, if you configure multiple drivers for an axis, either all of them must be TMC2660 drivers on the Duet or a Duet expansion board, or none of them must be. This is to facilitate dynamic microstepping and other features of the TMC2660.

The M584 command must come before the M350 and M906 commands in your config,g file and also before all other commands that refer to any new axes you create e.g. M92, M201, M203, M208 and M566.

M585: Probe Tool ¶ 

Supported in RRF 1.20beta2 and later.

In machines with at least one tool probe this code allows to update the current tool's offset by driving it into a given endstop.

This code works similarily to G1 .. S1 except that it sets the current tool's offset instead of the machine position and that a custom endstop number can be used.


  • Xnnn - Probe tool in X direction where nnn specifies the expected distance between the trigger point of your endstop switch and the starting point
  • Ynnn - Probe tool in Y direction where nnn specifies the expected distance between the trigger point of your endstop switch and the starting point
  • Znnn - Probe tool in Z direction where nnn specifies the expected distance between the trigger point of your endstop switch and the starting point
  • U,V,W,A,B,Cnnn - As for X,Y,Z above
  • Ennn - Custom endstop number to use (optional). This must be the drive number of the according endstop (i.e. X=0, Y=1, Z=2, E0=3 etc.)
  • Lnnn - Trigger level of the custom endstop (optional, 0 = active-low, 1 = active-high). This requires the 'E' parameter to be present (supported in RRF > 2.0)
  • Fnnn - Requested feedrate of the probing move. If this parameter is omitted, the last set feedrate is used
  • Snnn - Direction of the probing move. S=0 (default) means travel fowards (towards the axis maximum), S=1 means go backwards (towards the axis minimum)
  • Rnnn - Probing radius, i.e. the relative movement amount from the current position (optional, if used the S parameter is ignored) [requires RRF 1.20beta8 or later]

Note that you can only specify one axis per M585 call and that XYZ are not the only possible axes for this code (UVWABC would be valid as well).

The values of the XYZ parameters are the absolute distances between the position at which the endstop is actually triggered and your own start position. It is mandatory to measure this distance once before M585 can be used reliably. An example: Say you wish to probe the tool offset on the X axis. If the trigger position of your endstop is at X=210 and you want to drive your tool from X=190 into the endstop switch, you need to specify -20 as your X parameter because you expect to travel 20mm towards the endstop switch and need to correct this factor. If you drive the tool backwards (e.g. from X=210 to X=190), the correction factor should be 20.

In case you are using different switches for tool probing, RepRapFirmware allows you to use a custom endstop, but note that they need to be connected active-high if any of the extruder endstops are used. If a different endstop than the axis endstop is used, the drive number of the matching endstop can be specified via the optional E parameter (e.g. E4 for the E1 endstop).

In principle the following workflow should be performed for each axis using a macro file:

  • Reset the axis tool offset (G10 Pxx X0 Y0 Z0)
  • Select your tool (Txx)
  • Move the tool to your starting position (G1 X?? Y?? Z?? F3000)
  • Drive the tool into the endstop, stop there and apply the new tool offset with the given correction factor (M585 XYZ?? F1000 E??)
  • Call G10 Pxx with your tool number to get the corrected tool offset or call M500 (supported in RRF 1.20beta3 and later) to store the probed tool offsets on the SD card

You may wish to enhance this workflow depending on your own requirements and endstop configuration.

M586: Configure network protocols ¶ 


  • Pnn Protocol: 0 = HTTP or HTTPS, 1 = FTP or SFTP, 2 = Telnet or SSH (which of the two choices depends on the T parameter)
  • Snn 0 = disable this protocol, 1 = enable this protocol
  • Rnn TCP port number to use for the specified protocol. Ignored unless S = 1. If this parameter is not provided then the default port for that protocol and TLS setting is used.
  • Tnn 0 = don't use TLS, 1 = use TLS. Ignored unless S = 1. If this parameter is not provided, then TLS will be used if the firmware supports it and a security certificate has been configured. If T1 is given but the firmware does not support TLS or no certificate is available, then the protocol will not be enabled and an error message will be returned.

M586 with no S parameter reports the current support for the available protocols.

RepRapFirmware 1.18 and later enable only HTTP (or HTTPS if supported) protocol by default. If you wish to enable FTP and/or Telnet, enable them using this command once or twice in config.g.

M587: Add WiFi host network to remembered list, or list remembered networks ¶ 


  • S"ccc" Network SSID
  • P"ccc" Network password
  • Inn.nn.nn.nn (optional) IP address to use when connected to this network. If zero or not specified then an IP address will be acquired via DHCP.
  • Jnn.nn.nn.nn (optional) Gateway IP address to use when connected to this network.
  • Knn.nn.nn.nn (optional) Netmask to use when connected to this network

If a password or SSID includes space or semicolon characters then it must be enclosed in double quotation marks. For security, do not use this command in the config.g file, or if you do then remove it after running it once so that the network password is not visible in the file.

Many programs used to send GCodes convert all characters to uppercase. In firmware 1.19.2 and later, you can use a single-quote character to indicate that the following character should be changed to lower case. For example, M587 S"ABC" P"P'A'S'SW'O'R'D" would specify that the password is PassWord. Use two single quote characters to represent one actual single quote character in the password.

M587 with no parameters lists all the remembered SSIDs, but not the remembered passwords.

Note: on the Duet WiFi, the M587 command will fail if the WiFi module has not yet been taken out of reset. If the WiFi module has not been started yet, send M552 S0 to put it in idle mode before sending M587.

M588: Forget WiFi host network ¶ 


  • S"ccc" Network SSID to remove from the remembered list

The specified SSID will be removed from the remembered list and the associated password cleared out of EEPROM. If the SSID is given as "*" then all remembered networks will be forgotten.

M589: Configure access point parameters ¶ 


  • S"ccc" The SSID that the WiFi interface should use when it is commanded to run as an access point
  • P"ccc" The WiFi password
  • Inn.nn.nn.nn The IP address to use
  • Cnn The WiFi channel to use (optional)

Note: WPA2 security will be used by default.

M591: Configure filament sensing ¶ 

This configures filament sensing for the specified extruder. The sensor may be a simple filament presence detector, or a device that measures movement of filament, or both. The action on a filament error is to pause the print and advise you that there has been a filament error. Note that filament monitoring in RRF is only active when printing from SD card.

Parameters (firmware 1.21 and later)

  • Dnn Extruder drive number (0, 1, 2...),
  • Pnn Type of sensor: 0=none, 1=simple sensor (high signal when filament present), 2=simple sensor (low signal when filament present), 3=Duet3D rotating magnet sensor, 4=Duet3D rotating magnet sensor with microswitch, 5 = Duet3D laser sensor, 6 = Duet3D laser sensor with microswitch, 7 = pulse-generating sensor
  • Cnn Which input the filament sensor is connected to. On Duet electronics: 0=X endstop input, 1=Y endstop input, 2=Z endstop input, 3=E0 endstop input etc. If you have a DueX2 or DueX5 in your system, note that C5 thru C9 (the endstop inputs on the DueX) cannot be used for filament monitors, but C10 and C11 (the endstop inputs on the CONN_LCD connector) can.
  • Sn 0 = disable filament monitoring (default), 1 = enable filament monitoring when printing from SD card. Supported for all filament sensor types in firmwares 1.21.1 and in 2.0 and later. In firmware 1.21 this parameter is not supported for sensor types 1 and 2. Filament monitors accumulate calibration data (where applicable) even when filament monitoring is disabled.

Additional parameters for Duet3D laser filament monitor

  • Raa:bb Allow the filament movement reported by the sensor to be between aa% and bb% of the commanded values; if it is outside these values and filament monitoring is enabled, the print will be paused
  • Enn minimum extrusion length before a commanded/measured comparison is done, default 3mm

Additional parameters for Duet3D rotating magnet filament monitor

  • Lnn Filament movement per complete rotation of the sense wheel, in mm
  • R, E As for Duet3D laser filament monitor

Additional parameters for a pulse generating filament monitor

  • Lnn Filament movement per pulse in mm
  • R, E As for Duet3D laser filament monitor


M591 D0 P3 C3 S1 R70:130 L24.8 E3.0   ; Duet3D rotating magnet sensor for extruder drive 0 is connected to E0 endstop input, enabled, sensitivity 24.8mm.rev, 70% to 130% tolerance, 3mm detection length

M591 D0    ; display filament sensor parameters for extruder drive 0

Parameters (firmware 1.20 and earlier)

  • Dnn Extruder drive number (0, 1, 2...),
  • Pnn Type of sensor: 0=none, 1=simple sensor (high signal when filament present), 2=simple sensor (low signal when filament present), 3=Duet3D rotating magnet sensor, 4=Duet3D rotating magnet sensor with microswitch
  • Cnn Which input the filament sensor is connected to. On Duet electronics: 0=X endstop input, 1=Y endstop input, 2=Z endstop input, 3=E0 endstop input etc.

Additional parameters for Duet3D rotating magnet filament monitor

  • Snn Sensitivity, in mm of filament movement per complete rotation of the sense wheel.
  • Rnn Tolerance as a percentage of the commanded extrusion amount. A negative value puts the firmware in calibration mode.
  • Enn minimum extrusion length before a commanded/measured comparison is done, default 3mm


* M591 D0 P5 C3  R70:140 E3.0 S1   ; Duet3D rotating magnet sensor for extruder drive 0 is connected to E0 endstop input, sensitivity 1.05, tolerance 70% to 140%, 3mm detection length
* M591 D1 ; display filament sensor parameters for extruder drive 1


M592: Configure nonlinear extrusion ¶ 


  • Dnn Extruder drive number (0, 1, 2...)
  • Annn A coefficient in the extrusion formula, default zero
  • Bnnn B coefficient in the extrusion formula, default zero
  • Lnnn Upper limit of the nonlinear extrusion compensation, default 0.2
  • T nnn Reserved for future use, for the temperature at which these values are valid


M592 D0 A0.01 B0.0005 ; set parameters for extruder drive 0

M592 D0 ; report parameters for drive 0

Most extruder drives use toothed shafts to grip the filament and drive it through the hot end. As the extrusion speed increases, so does the back pressure from the hot end, and the increased back pressure causes the amount of filament extruded per step taken by the extruder stepper motor to reduce. This may be because at high back pressures, each tooth compresses and skates over the surface of the filament for longer before it manages to bite. See forum post,80... and the graph at,fi... for an example.

Nonlinear extrusion is an experimental feature in RepRapFirmware to compensate for this effect. The amount of extrusion requested is multiplied by (1 + min(L, A*v + B*v^2)) where v is the requested extrusion speed (calculated from the actual speed at which the move will take place) in mm/sec.

Nonlinear extrusion is not applied to extruder-only movements such as retractions and filament loading.

M593: Configure Dynamic Acceleration Adjustment ¶ 


  • Fnnn Frequency of ringing to cancel in Hz. Zero or negative values disable the feature.
  • Lnnn Minimum acceleration allowed. The current default is 10mm/sec^2. It is unlikely that you will need to change this value.


M593 F40.5  ; cancel ringing at 40.5Hz

This is an experimental feature in RepRapFirmware 2.01. By default, Dynamic Acceleration Adjustment (DAA) is disabled. If it is enabled, then acceleration and deceleration rates will be adjusted per-move to cancel out ringing at the specified frequency. Acceleration limits set by M201 and M204 will still be honoured when DAA is enabled.

DAA is most useful to avoid exciting low-frequency ringing, for which S-curve acceleration is ineffective and may make the ringing worse. High-frequency ringing would be better countered by using S-curve acceleration.

To measure the ringing frequency, take a print that exhibits ringing on the perimeters (for example a cube), preferably printed single-wall or external-perimeters-first. Divide the speed at which the outer perimeter was printed (in mm/sec) by the distance between adjacent ringing peaks (in mm). When measuring the distance between peaks, ignore peaks close to the corner where the ringing started (these peaks will be spaced more closely) because the print head will have been accelerating in that area.

Cartesian and CoreXY printers will typically have different frequencies of ringing for the X and Y axes. In this case it is is usually best to aim to cancel the lower ringing frequency. If the frequencies are not much different, in a moving-bed cartesian printer you can reduce the higher ringing frequency by adding mass to that axis. Note that X axis ringing causes artefacts predominantly on the Y face of the test cube, and vice versa.

M665: Set delta configuration ¶ 


  • Lnnn Diagonal rod length
  • Rnnn Delta radius
  • Bnnn Safe printing radius
  • Hnnn Nozzle height above the bed when homed after allowing for endstop corrections
  • Xnnn X tower position correction1
  • Ynnn Y tower position correction1
  • Znnn Z tower position correction1


  • M665 L250 R160 S200 (Marlin)
  • M665 L250 R160 B80 H240 X0 Y0 Z0 (RepRapFirmware)

Set the delta calibration variables


1X, Y and Z tower angular offsets from the ideal (i.e. equilateral triangle) positions, in degrees, measured anti-clockwise looking down on the printer.

M666: Set delta endstop adjustment ¶ 


  • Xnnn X axis endstop adjustment
  • Ynnn Y axis endstop adjustment
  • Znnn Z axis endstop adjustment
  • Annn X bed tilt in percent1
  • Bnnn Y bed tilt in percent1


  • M666 X-0.1 Y+0.2 Z0

Sets delta endstops adjustments.

Positive endstop adjustments move the head closer to the bed when it is near the corresponding tower. Endstop corrections are expressed in mm.

1RepRapFirmware 1.16 and later.

M667: Select CoreXY mode ¶ 


  • Snnn CoreXY mode
  • Xnnn X axis scale factor
  • Ynnn Y axis scale factor
  • Znnn Z axis scale factor


  • M667 S1

M667 S0 selects Cartesian mode (unless the printer is configured as a delta using the M665 command). Forward motion of the X motor moves the head in the +X direction. Similarly for the Y motor and Y axis, and the Z motor and Z axis. This is the default state of the firmware on power up.

M667 S1 selects CoreXY mode. Forward movement of the X motor moves the head in the +X and +Y directions. In firmware 1.19 and later, forward movement of the Y motor moves the head in the +X and -Y directions.

M667 S2 selects CoreXZ mode. Forward movement of the X motor moves the head in the +X and +Z directions. In firmware 1.19 and later, forward movement of the Z motor moves the head in the -X and +Z directions.

Additional parameters X, Y and Z may be given to specify factors to scale the motor movements by for the corresponding axes. For example, to specify a CoreXZ machine in which the Z axis moves 1/3 of the distance of the X axis for the same motor movement, use M667 S2 Z3. The default scaling factor after power up is 1.0 for all axes.

To change the motor directions, see the M569 command.

M669: Set kinematics type and kinematics parameters ¶ 


  • Knnn Kinematics type: 0 = Cartesian, 1 = CoreXY, 2 = CoreXZ, 3 = linear delta, 4 = serial SCARA, 5 = CoreXYU, 6 = Hangprinter, 7 = polar, 8 = CoreXYUV, 9 = reserved for linear delta with extra Z axis

Selects the specified kinematics, then uses the other parameters to configure it. If the K parameter is missing then the other parameters are used to update the configuration data for the current kinematics. If no parameters are given then the current kinematics and configuration parameters are reported

Parameters for serial SCARA kinematics

  • Pnnn Proximal arm length (mm)
  • Dnnn Distal arm length (mm)
  • Annn:nnn Proximal arm joint movement minimum and maximum angles, in degrees anticlockwise seen from above relative to the X axis
  • Bnnn:nnn Proximal-to-distal arm joint movement minimum and maximum angles, in degrees anticlockwise seen from above relative to both arms in line
  • Cnnn:nnn:nnn Crosstalk factors. The first component is the proximal motor steps to equivalent distal steps factor, the second is the proximal motor steps to equivalent Z motor steps factor, and the third component is the distal motor steps to equivalent Z motor steps factor.
  • Snnn Segments per second if smooth XY motion is approximated by means of segmentation
  • Tnnn Minimum segment length (mm) if smooth XY motion is approximated by means of segmentation
  • Xnnn X offset of bed origin from proximal joint
  • Ynnn Y offset of bed origin from proximal joint


M669 K4 P300 D250 A-90:90 B-135:135 C0:0:0 S100 X300 Y0

The minimum and maximum arm angles are also the arm angles assumed by the firmware when the homing switches are triggered. The P, D, A and B parameters are mandatory. The C, X and Y parameters default to zero, and the segmentation parameters default to firmware-dependent values.

M670: Set IO port bit mapping ¶ 


  • Pnn:nn:nn... List of logical port numbers that bits 0, 1, 2... control
  • Tnnn port switching time advance in milliseconds

RepRapFirmware 1.19 and later provides an optional P parameter on the G1 command to allow I/O ports to be set to specified states for the duration of the move. The argument to the P parameter is a bitmap giving the required state of each port. The M670 command specifies the mapping between the bits of that argument and logical port numbers. Optionally, the T parameter can be used to advance the I/O port switching a short time before the corresponding move begins.

M671: Define positions of Z leadscrews or bed levelling screws ¶ 


  • Xnn:nn:nn... List of between 2 and 4 X coordinates of the leadscrews that drive the Z axis or the bed levelling screws
  • Ynn:nn:nn... List of between 2 and 4 Y coordinates of the leadscrews that drive the Z axis or the bed levelling screws
  • Snn Maximum correction to apply to each leadscrew in mm (optional, default 1.0)
  • Pnnn Pitch of the bed levelling screws (not used when bed levelling using independently-driven leadscrews). Defaults to 0.5mm which is correct for M3 bed levelling screws.
  • Fnn Fudge factor, default 1.0


  • M671 X-15.0:100.0:215.0 Y220.0:-20.0:220.0 ; Z leadscrews are at (-15,220), (100,-20) and (215,220)

Informs the firmware of the positions of the leadscrews used to raise/lower the bed or gantry. When this command is used to define the leadscrew positions, the numbers of X and Y coordinates must both be equal to the number of drivers used for the Z axis (see the M584 command). This allows the firmware to perform bed levelling by adjusting the leadscrew motors individually after bed probing. See the G32 command.

For machines without multiple independently-driven Z leadscrews, this command can also be used to define the positions of the bed levelling screws instead. Then bed probing can be used to calculate and display the adjustment required to each screw to level the bed. The thread pitch (P parameter) is used to translate the height adjustment needed to the number of turns of the levelling screws.

For printers that print directly onto a desktop and have levelling feet, this command can be used to define the coordinates of the levelling feet, so that bed probing can be used to calculate and display the adjustments needed to the feet. In this case the displayed corrections must be reversed. For example, "0.2 turn down" means the bed needs to be lowered or the printer raised by 0.2 turn lower at that screw position.

The firmware algorithm assumes perfect gimbal joints between the bed and the leadscrews, so that the bed is completely free to adopt the plane (or the twisted plane if there are 4 leadscrews) defined by the leadscrews. In real printers this is rarely the case and the corrections are insufficient to level the bed, so multiple G32 commands need to be sent if the bed is a long way off level. The F parameter allows for the corrections calculated by the firmware to be multiplied by a factor so as to achieve faster convergence in this situation.

Note: the M671 command in config.g must come after any command to change the kinematics, for example M667 or M669.

M672: Program Z probe ¶ 


  • Snn:nn:nn... Sequence of 8-bit unsigned values to send to the currently-selected Z probe


  • M672 S105:50:205

This command is for sending configuration data to programmable Z probes such as the Duet3D delta effector, for example to set the sensitivity. The specified command bytes are sent to the probe. The Duet3D probe stores the configuration data in non-volatile memory, so there is no need to send this command every time the probe is used.

For the Duet3d smart effector:

*To program the sensor, send command M672 S105:aaa:bbb replacing aaa by the desired sensitivity and bbb by 255 - aaa. The green LED will flash 4 times if the command is accepted. When you subsequently power up the effector, the green LED will flash three times instead of twice to indicate that a custom sensitivity is being used.

*To revert to factory settings, send command M672 S131:131. The green LED will flash 5 times if the command is accepted. When you subsequently power up the effector, the green LED will flash twice to indicate that default settings are being used.

See the Smart effector and carriage adapters for delta printer documentation for more details.

M673: Align plane on rotary axis ¶ 


  • U,V,W,A,B,C Rotary axis name on which the plane is mounted
  • Pnnn Factor to multiply the correction amount with (defaults to 1)


  • M673 A

This code is intended to align a plane that is mounted on a rotary axis. This code is intended to align a plane that is mounted on a rotary axis. To make use of this code it is required to take two probe points via G30 P first.

Supported in RepRapFirmware 2.02 and later.

M701: Load filament ¶ 


  • This command can be used without any additional parameters.
  • Snn Filament to load


  • M701 S"PLA"

RepRapFirmware 1.19 and later implements a filament management mechanism to load and unload different materials.

This code may be used to load a material for the active tool, however be aware that this code will work only for tools that have exactly one extruder assigned.

When called the firmware does the following:

1) Run the macro file "load.g" in the subdirectory of the given material (e.g. /filaments/PLA/load.g)

2) Change the filament name of the associated tool, so it can be reported back to Duet Web Control

If this code is called without any parameters, RepRapFirmware will report the name of the loaded filament (if any).

M702: Unload filament ¶ 


  • This command can be used without any additional parameters.


  • M702

In contrast to M701 this code is intended to unload the previously loaded filament from the selected tool. RepRapFirmware will do the following when called:

1) Run the macro file "unload.g" in the subdirectory of the given material (e.g. /filaments/PLA/unload.g)

2) Change the filament name of the current tool, so it can be reported back to Duet Web Control

M703: Configure filament ¶ 


  • This command can be used without any additional parameters.


  • M703

After assigning a filament to a tool, this command may be used to run /filaments/<filament name>/config.g to set parameters like temperatures, extrusion factor, retract distance. If no filament is loaded, the code completes without a warning.

If the filaments feature is used, it is recommended to put this code into tpost*.g to ensure the right filament parameters are set. Supported in RepRapFirmware 2.02 and newer.

M750: Enable 3D scanner extension ¶ 



This code may be used as an OEM extension to enable scanner functionality in the firmware. After a regular start of RepRapFirmware, the 3D scan extension is disabled by default, but if additional scanner components are attached, this code may be used to enable certain OEM functions.

M751: Register 3D scanner extension over USB ¶ 



When a 3D scanner board is attached to the USB port, this code is used to turn on communication between the 3D printing and the scanner board. If the USB connection is removed while the 3D scanner configuration is active, the firmware will disable it again and restore the default communication parameters.

M752: Start 3D scan ¶ 


  • Snnn: Length/degrees of the scan
  • Rnnn: Resolution (new in RRF 2.0) [optional, defaults to 100]
  • Nnnn: Scanner mode (new in RRF 2.0) [optional, 0=Linear (default), 1=Rotary]
  • Pnnn: Filename for the scan


M752 S300 Pmyscan

Instruct the attached 3D scanner to initiate a new 3D scan and to upload it to the board's SD card (i.e. in the "scans" directory). Before the SCAN command is sent to the scanner, the macro file "scan_pre.g" is executed and when the scan has finished, the macro file "scan_post.g" is run. Be aware that both files must exist to avoid error messages.

M753: Cancel current 3D scanner action ¶ 



Instruct the attached 3D scanner to cancel the current operation. Cancelling uploads is not supported.

M754: Calibrate 3D scanner ¶ 


  • Nnnn: Scanner mode (new in RRF 2.0) [optional, 0=Linear (default), 1=Rotary]



Calibrates the attached 3D scanner. Before the calibration is performed by the external scanner, "calibrate_pre.g" is run and when it is complete, "calibrate_post.g" is executed.

M755: Set alignment mode for 3D scanner ¶ 


  • Pnnn Whether to turn on (> 0) or off (<= 0) the alignment feature


M755 P1

M755 P0

Sends the ALIGN ON/OFF command the attached 3D scanner. Some devices turn on a laser when this command is received. If the 'P' parameter is missing, equal to, or less than 0, the alignment feature is turned off. Depending on whether the alignment is turned on or off, either align_on.g or align_off.g is executed before the ALIGN command is sent to the scanner.

M756: Shutdown 3D scanner ¶ 



Sends the SHUTDOWN command the attached 3D scanner.

M905: Set local date and time ¶ 

Supported in RepRapFirmware version 1.16 and later.


  • Pnnn Current date in the format YYYY-MM-DD
  • Snnn Current time in the format HH:MM:SS


  • M905 P2016-10-26 S00:23:12

Updates the machine's local date and time or reports them if no parameters are specified. The time should be specified in 24-hours format as in "13:45" instead of 1:45PM.

M906: Set motor currents ¶ 


  • Xnnn X drive motor current1
  • Ynnn Y drive motor current1
  • Znnn Z drive motor current1
  • Ennn E drive(s) motor current(s)1
  • Innn Motor current idle factor (0..100)2


  • M906 X300 Y500 Z200 E350:350

Sets the currents to send to the stepper motors for each axis. The values are in milliamps.


1Current setting on the Duet 2 series is done in steps of 100mA and will be rounded down.

2This is the percentage of normal that the motor currents should be reduced to when the printer becomes idle but the motors have not been switched off. The default value is 30% and will always be at least 100mA - starting from RRF 2.02 setting it to 0 will disable the steppers after timeout like M18|M84 do.

M911: Configure auto save on loss of power ¶ 

Firmware 1.20 and later:


  • Saaa Auto save threshold in volts. The print will be stopped automatically and resume parameters saved if the voltage falls below this value. Set to around 1V to 2V lower than the voltage that appears at the Duet VIN terminals at full load. A negative or zero value disables auto save.
  • Raaa Resume threshold in volts. Must be greater than the auto save voltage. Set to a high value to disable auto resume.
  • P"command string" G-Code commands to run when the print is stopped.


  • M911 S19.8 R22.0 P"M913 X0 Y0 G91 M83 G1 Z3 E-5 F1000"

When the supply voltage falls below the auto save threshold while a print from SD card is in progress, all heaters will be turned off, printing will be stopped immediately (probably in the middle of a move), the position saved, and the specified command string executed. You should typically do the following in the command string:

*If possible, use M913 to reduce the motor current in order to conserve power. For example, on most printers except deltas you can probably set the X and Y motor currents to zero.

*Retract a little filament and raise the head a little. Ideally the retraction should happen first, but depending on the power reserve when low voltage is detected, it may be best to do both simultaneously.

M911 with no parameters displays the current enable/disable state, and the threshold voltages if enabled.

Firmware 1.19:


  • Saaa:bbb:ccc Shutdown threshold (aaa), pause threshold (bbb) and resume threshold (ccc) all in volts, with aaa < bbb < ccc


  • M911 S12.0:19.5:22.0

Enables auto-pause if the power voltage drops below the pause threshold. The firmware records the current state of the print so that it can be resumed when power is restored and executes the pause procedure to attempt to park the print head using the residual energy in the power supply capacitors. If the supply voltage continues to drop below the shutdown threshold, the firmware disables all heaters and motors and goes into the shutdown state until either the voltage exceeds the resume threshold or the board is reset. In either case, it may be possible to resume the paused print. If the supply voltage does not fall below the shutdown threshold but recovers and exceeds the resume threshold, then the print is resumed automatically.

If any of the three values is zero or negative, or the three values are not in ascending order, then auto-save is disabled.

M911 with no parameters displays the current enable/disable state, and the threshold voltages if enabled.

M912: Set electronics temperature monitor adjustment ¶ 


  • Pnnn Temperature monitor channel, default 0
  • Snnn Value to be added to the temperature reading in degC


M912 P0 S10.5

Many microcontrollers used to control 3D printers have built-in temperature monitors, but they normally need to be calibrated for temperature reading offset. The S parameter specifies the value that should be added to the raw temperature reading to provide a more accurate result.

M913: Set motor percentage of normal current ¶ 


  • X, Y, Z, E Percentage of normal current to use for the specified axis or extruder motor(s)


M913 X50 Y50 Z50 ; set X Y Z motors to 50% of their normal current

M913 E30:30 ; set extruders 0 and 1 to 30% of their normal current

This allows motor currents to be set to a specified percentage of their normal values as set by M906. It can be used (for example) to reduce motor current during course homing, to make homing quieter or to reduce the risk of damage to endstops, and to reduce current while loading filament to guard against the possibility of feeding too much filament. Use M913 again with the appropriate parameters set to 100 to restore the normal currents.

M914: Set/Get Expansion Voltage Level Translator ¶ 

This command is supported in the Alligator build of RepRapFirmware only.


  • Sn Expansion voltage signal level, n must be 3 or 5


M914 S5 ; set expansion signal level to 5V

M914 ; report expansion signal voltage level

M915: Configure motor stall detection ¶ 


  • Pnnn:nnn:... Drive number(s) to configure
  • X,Y,Z,U,V,W,A,B,C Axes to configure (alternative to using the P parameter)
  • Snnn Stall detection threshold (-64 to +63, values below -10 not recommended)
  • Fn Stall detection filter mode, 1 = filtered (one reading per 4 full steps), 0 = unfiltered (default, 1 reading per full step)
  • Hnnn (optional) Minimum motor full steps per second for stall detection to be considered reliable, default 200
  • Tnnn (optional) Coolstep control register, 16-bit unsigned integer
  • Rn Action to take on detecting a stall from any of these drivers: 0 = no action (default), 1 = just log it, 2 = pause print, 3 = pause print, execute /sys/rehome.g, and resume print


  • M915 P0:2:3 S10 F1 R0
  • M915 X Y S5 R2

This sets the stall detection parameters and optionally the low-load current reduction parameters for TMC2660, TMC2130 or similar driver chips. Use either the P parameter to specify which driver number(s) you want to configure, or the axis names of the axes that those motors drive (the parameters will then be applied to all the drivers associated with any of those axes).

If any of the S, F, T and R parameters are absent, the previous values for those parameters associated with the specified drivers will continue to be used. If all the parameters are absent, the existing settings for the specified drive(s) will be reported.

See the Trinamic TMC2660 and TMC2130 datasheets for more information about the operation and limitations of motor stall detection.

M916: Resume print after power failure ¶ 

Supported in firmware 1.20 beta 2 and later.


  • none


  • M916

If the last print was not completed and resume information has been saved (either because the print was paused or because of a power failure), then the heater temperatures, tool selection, head position, mix ratio, mesh bed compensation height map etc. are restored from the saved values and printing is resumed.

RepRapFirmware also requires macro file /sys/resurrect-prologue.g to be present on the SD card before you can use M916. This file is executed after the heater temperatures have been set, but before waiting for them to reach the assigned temperatures. You should put commands in this file to home the printer as best as you can without disturbing the print on the bed. To wait for the heaters to reach operating temperature first, use command M116 at the start of the file.

Version 1.19 of RepRapFirmware does not support M916 but you can achieve the same effect using command M98 P/sys/resurrect.g.

M917: Set motor standstill current reduction ¶ 

Supported in firmware 1.20 beta 7 and later.


  • X,Y,Z,E Percentage of normal current to use when the motor is standing still or moving slowly, default 100


  • M917 X70 Y70 Z80 E70:70

Some motor drivers (e.g. TMC2660) allow higher motor currents to be used while the motor is moving. This command sets the percentage of the current set by M906 that is to be used when the motor is stationary but not idle, or moving very slowly.

Standstill current reduction is not the same as idle current reduction. The standstill current must be high enough to produce accurate motion at low speeds. The idle current needs only to be high enough to hold the motor position well enough so that when the current is restored to normal, the position is the same as it was before the current was reduced to idle.

M929: Start/stop event logging to SD card ¶ 


  • P"filename" The name of the file to log to. Only used if the S1 parameter is present. A default filename will be used if this parameter is missing.
  • Sn S1 = start logging, S0 = stop logging


  • M929 P"eventlog.txt" S1 ; start logging to file eventlog.txt
  • M929 S0 ; stop logging

When event logging is enabled, important events such as power up, start/finish printing and (if possible) power down will be logged to the SD card. Each log entry is a single line of text, starting with the date and time if available, or the elapsed time since power up if not. If the log file already exists, new log entries will be appended to the existing file.

Caution: do not rename or delete the current log file while logging is enabled!

M997: Perform in-application firmware update ¶ 


  • Snnn Firmware module number(s), default 0


  • M997 S0:1 - update firmware modules 0 and 1

This command triggers a firmware update if the necessary files are present on the SD card. In RepRapFirmware on the Duet series, module numbers are as follows:

0 - main firmware, filename sys/RepRapFirmware.bin (Duet) or sys/DuetWiFiFirmware (Duet WiFi). File sys/iap.bin (Duet) or sys/iap4e.bin (Duet WiFi) must also be present.

1 - web server firmware, filename sys/DuetWiFiServer.bin (Duet WiFi only)

2 - web server file system, filename sys/DuetWebControl.bin (needed only when using RepRapFirmware 1.18 series and earlier for Duet WiFi)

3 - put the WiFi module into bootloader mode, so that firmware can be uploaded directly via its serial port

M998: Request resend of line ¶ 


  • Pnnn Line number


  • M998 P34

Request a resend of line 34. In some implementations the input-handling code overwrites the incoming G Code with this when it detects, for example, a checksum error. Then it leaves it up to the GCode interpreter to request the resend.

M999: Restart ¶ 


  • This command can be used without any additional parameters.
  • Pnnn Reset flags1


  • M999

Restarts the firmware using a software reset.


1This also puts the board into firmware upload mode (as if the Erase button had been pressed) if parameter PERASE is present.


T: Select Tool ¶ 


  • nnn: Tool number to select. A negative number deselects all tools.
  • R1: Select the tool that was active when the print was last paused (firmware 1.20 and later)
  • Pnnn: Bitmap of all the macros to be run (dc42 build 1.19 or later and ch fork 1.17b or later)
  • Tool number


  • T0 ; select tool 0
  • T R1 ; select the tool that was active last time the print was paused
  • T ; report the current tool number

Select tool number 1 as the active tool. will also set all other tools as inactive.

The sequence followed is:

  1. Set the current tool to its standby temperatures specified by G10 (see above),
  2. Set the new tool to its operating temperatures specified by G10 and wait for all temperatures to stabilise,
  3. Apply any X, Y, Z offset for the new tool specified by G10,
  4. Use the new tool.

Selecting a non-existent tool (100, say) just does Step 1 above1. That is to say it leaves all tools in their standby state. You can, of course, use the G10 command beforehand to set that standby temperature to anything you like.

There are normally three specified tool change macros (any of which can contain no commands if desired) that execute in this order:

  1. Actions to do with the old tool before it is released - macro name: tfreeN.g where N is the tool number;
  2. (Old tool is released);
  3. Actions to do with the new tool before it is selected - macro name: tpreN.g where N is the tool number;
  4. (New tool is selected); and
  5. Actions to do with the new tool after it is selected - macro name: tpostN.g where N is the tool number.

With such implementations there is no wait for temperature stabilisation. That can be achieved by an M116 in any of the macros, of course. However be aware that recent RepRapFirmware versions does NOT run any tool change macros if the axes are not homed.

After a reset tools will not start heating until they are selected. You can either put them all at their standby temperature by selecting them in turn, or leave them off so they only come on if/when you first use them. The M0, M1 and M112 commands turn them all off. You can, of course, turn them all off with the M1 command, then turn some back on again. Don't forget also to turn on the heated bed (if any) if you use that trick.

Tool numbering starts at 0 by default however M563 allows the user to specify tool numbers, so with them you can have tools 17, 99 and 203 if you want. Negative numbers are not allowed.


1 Selecting a non-existent tool also removes any X/Y/Z offset applied for the old tool.

2 Under special circumstances, the execution of those macro files may not be desired. RepRapFirmware 1.19 or later supports an optional P parameter to specify which macros shall be run. If it is absent then all of the macros above will be run, else you can pass a bitmap of all the macros to be executed. The bitmap of this value consists of tfree=1, tpre=2 and tpost=4.

Note that you may wish to include a move to a parking position 'within the tfreeN.g gcode macro in order to allow the new extruder to reach temperature while not in contact with the print.


G-Code Background Information ¶ 

Codes for print head movements follow the, so RepRapFirmware should be usable for CNC milling and similar applications but be aware of the G-Codes not implemented. See also on

For more information and background, along with the master list of all RepRap G-Codes check the

For the technically minded, G-Code line endings are Unix Line Endings (\n), but will accept Windows Line Endings (\r\n), so you should not need to worry about converting between the two, but it is best practice to use Unix Line Endings where possible.

Replies from the RepRap machine to the host computer ¶ 

All communication is in printable ASCII characters. Messages sent back

to the host computer are terminated by a newline and look like this:

xx [line number to resend] [T:93.2 B:22.9] [C: X:9.2 Y:125.4 Z:3.7 E:1902.5] [Some debugging or other information may be here]

xx can be one of:




ok means that no error has been detected.

rs means resend, and is followed by the line number to resend.

!! means that a hardware fault has been detected. The RepRap machine will

shut down immediately after it has sent this message.

The T: and B: values are the temperature of the currently-selected extruder

and the bed respectively, and are only sent in response to M105. If such temperatures don't exist (for example for an extruder that works at room temperature and doesn't have a sensor) then a value below absolute zero (-273oC) is returned.

C: means that coordinates follow. Those are the X: Y: etc values. These are only

sent in response to M114 and M117.

The RepRap machine may also send lines that look like this:

// This is some debugging or other information on a line on its own. It may be sent at any time.

Such lines will always be preceded by //.

On the latest version of Pronterface and Octoprint (1.2.0+) a special comment of the form:

// action:command

is allowed to be sent from the firmware, the command can currently be pause, resume or disconnect which will execute those commands on the host.

As this is also a comment other hosts will just ignore these commands.

The most common response is simply:


When the machine boots up it sends the string


once to the host before sending anything else. This should not be replaced or augmented

by version numbers and the like. M115 (see above) requests those.

All this means that every line sent by RepRap to the host computer except the start line has a two-character prefix (one of ok, rs, !! or //). The machine should never send a line without such a prefix.


RepRapFirmware responds to some commands with a reply string in JSON format, terminated by a newline. This allows later firmware revisions to include additional information without confusing clients (e.g. PanelDue) that do not expect it, and to make responses self-describing so that the client will not be confused if responses are delayed or lost. The commands affected are:

  • M20 S2
  • M36
  • M408

Slicer Start and End G-Codes ¶ 

Slicers will optionally add G-Code scripts to the beginning and end of their output file to perform specified actions before and/or after a print such as z-probing the build-area, heating/cooling the bed and hotend, performing ooze free "nozzle wipe" startup routine, switching system power on/off, and even "ejecting" parts. For general information and examples (not specific to RepRapFirmware) there is more info on the and pages.


Add Comment

View Statistics:

Past 24 Hours: 228

Past 7 Days: 1,566

Past 30 Days: 6,613

All Time: 36,019