RepRap Firmware G-Codes

From RepRap
Jump to: navigation, search

The RepRap Firmware (abbreviated RRF) does use more G-codes than other firmwares notably because all configuration is done with G-Codes. Another reason is that it does have extended functionalities.

This page list G-codes interpreted by RepRap Firmware. This list cover DC42 and Chrishamm fork, which are more complete than the original version. Some G-Codes are common between RepRap Firmware and other firmwares, but with extended syntax or specific interpretation. They are listed in a specific paragraph.

With RepRap firmware, everything is G-code

The RepRap Firmware philosophy is that every operation is done with G-code, notably all configuration, which is mainly stored in config.g file, called at board start-up. A set of standard or specifically crafted G-codes macros is written for all commons printer operation.

All G-codes or macros could be send to the board while operating the printer, allowing instant feed-back for any configuration modification. As interactive modifications are lost at next board start-up, the successfully tested G-Codes shall be manually introduced in the configuration file.

This interactive configuration makes the printer tuning easier than with other firmware.

Typical parameters

Most commands (M or G) are associated with parameters, typically Pnnn, Paaa or Xnnn. It shall be noted that the parameter qualifying letter is NOT part of the parameter, e.g. parameter PMyName is "MyName".

Commonly used parameter qualifiers are :

  • Pnnn or Paaa - Main parameter
  • Rnnn - other parameter
  • Snnn - other parameter, also often used to modify command behaviour (S0~S9)
  • Tnnn - typically Tool number, trigger number for M581 and M582
  • Xnnn, Ynnn, Znnn - parameter associated with an axis
  • Fnnn - feedrate
  • Hnnn or Hn:n:n - Height or Heater/sensor number
  • En or En:n:n - Parameter associated with extruder 0,1, etc. to 5
  • Dn or Dn:n:n - Extruder drive -For extruders E0 correspond to drive 0, E1 to drive 1 (M563)
  • Rn - enable value - for different hardware needing positive or negative signal to be enabled - M569
  • Bnnn - Safe printing radius (M665), baud rate (M575)
  • Wnnn - Maximum value of accumulated Integral - M301 & M304

Sometimes a "-1" value is used to cancel a command.

It shall be noted that Extruder number, Tool number, Heater number and Drive number are separated entities which need to be associated one with the other. There are default associations between drives and movement/extruder axis.

Note that internal firmware drive reference are : 0:X; 1:Y; 2:Z; 3:E0; 4:E1; 5:E2; 6:E3; 7:E4; 8:E5 as used in M569 and when linking end stops pins to drives.

Printing files G-codes are analysed by web interface for layer count. Excluding specific g-code (typically at start or end) from this analysis can be done while writing a comment starting with ";E" or "; E".

Default values

Most configuration G-codes have default values, and if the default are acceptable, you don't need to enter the G-Code, so config.g could be for some printers very simple.

However, sometimes the default values got modified in firmware update, so it is wise to explicitly define all your parameters, to avoid troubles while updating and also to document them. Some default values (DC42 fork rev 1.11):

  • PID parameters (M301) for hotend heater : P10 I0.1 D100 T0.4 W180 B30
  • Bed control default is bang-bang (P-1)(M304), other parameters: I5 D500 T2.7 W255 B5 -for PID control, you may start with P85
  • PWM frequency 10Hz for Bed and Chamber heaters (SSR compatible) and ?? Hz for Hotend heaters - not adjustable
  • Thermistors - all- (M305): T100000 B4138 R1000 L0 H0 X3
  • Steps/mm (M92): X200 Y200 Z200 E304.5:304.5:420:420:420:420
  • Maximum feedrates mm/min (M203): X25000 Y25000 Z25000 E8000:8000:1200:1200:1200:1200
  • Accelerations mm/s^2 (M201): X500 Y500 Z20 E250:250:250:250:250:250 - for comparison gravity acceleration is 9810 mm/s^2
  • Maximum jerk rates mm/min (M566): X1200 Y1200 Z800 E500:500:120:120:120:120
  • Time allowed to get to temperature on hotend heaters (M570): 150 seconds.
  • Filament (M404) width: 1.75mm, nozzle diameter: 0.50mm
  • Controllable fans (M106): Fan0, NOT inverted, 500Hz. Fan1, NOT inverted, 500Hz, thermostatic mode, 45°C.
  • Maximum hot-end temperature (M143): 260°C since DC42 v1.12, formerly 300°C. - MODIFIED -

Codes specific to RepRap Firmware

Macros and physical interfacing


Ethernet communication

Miscellaneous Configuration

Web control (DWC)

Firmware configuration

Reporting - also used by DWC


Miscellaneous commands

Specialised machines

G-codes with specific or extended syntax

Movement and geometry



Non specific G-codes





Physical interface


Useful G-codes

  • M206 Set home offset. Could be used to adjust head above bed during printing. M206 Z0.1 move up by 0.1mm




In addition to site licence GFDL1.2, this page is also released under license CC BY-SA 4.0