You are on page 1of 7

RepRap Firmware G-Codes - RepRap https://reprap.

org/wiki/RepRap_Firmware_G-Codes

RepRap Firmware G-Codes


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 (https://github.com/dc42/Rep
RapFirmware/tree/dev/Release) and Chrishamm (https://github.com/chrishamm/RepRapFirmware/tree/dev/
Release) 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.

Contents
1 With RepRap firmware, everything is G-code
2 Typical parameters
3 Default values
4 Codes specific to RepRap Firmware
4.1 Macros and physical interfacing
4.2 Heaters
4.3 Ethernet communication
4.4 Miscellaneous Configuration
4.5 Web control (DWC)
4.6 Firmware configuration
4.7 Reporting - also used by DWC
4.8 Geometry
4.9 Miscellaneous commands
4.10 Specialised machines
5 G-codes with specific or extended syntax
5.1 Movement and geometry
5.2 Heating
5.3 Miscellaneous
6 Non specific G-codes
6.1 Movement
6.2 Operation
6.3 Probing
6.4 Printing
6.5 Physical interface
6.6 Heating
6.7 Useful G-codes
6.8 Configuration
6.9 Report
6.10 Miscellaneous

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.

1 de 7 21/12/2020 18:52
RepRap Firmware G-Codes - RepRap https://reprap.org/wiki/RepRap_Firmware_G-Codes

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

2 de 7 21/12/2020 18:52
RepRap Firmware G-Codes - RepRap https://reprap.org/wiki/RepRap_Firmware_G-Codes

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

M98: Call Macro/Subprogram


M99: Return from Macro/Subprogram
M42: Switch I/O pin Change status of a pin. Hardware-dependent - also used by other firmware.
M571: Set output on extrude - Activate a pin while extruding
M577: Wait until endstop is triggered
M581: Configure external trigger Run macro, pause or stop from a pin state change. See expansion
connector pinout - New (1.13) -
M582: Check external trigger Check pin status associated with a trigger - New (1.13) -

Heaters

M135: Set PID sample interval


M143: Maximum hot-end temperature - NEW -
M144: Stand By Your Bed
M570: Set heater timeout - common to all tools
M562: Reset temperature fault
M563: Define or remove a tool

Ethernet communication

M540: Set MAC address - all printers on same network shall have different MAC addresses
M550: Set Name - Name for web page call and for FTP
M551: Set Password - For FTP and Web Control/firmware exchange
M552: Set IP address - Optional
M553: Set Netmask - if IP address defined
M554: Set Gateway - if IP address defined

Miscellaneous Configuration

M555: Set compatibility - G-code style compatibility


M558: Set Z probe type
M566: Set allowable instantaneous speed change - 'jerk' values: speed change while cornering
M569: Set axis direction and enable values - Change stepper directions without replug
M584: Set drive mapping NEW (1.14) Was handled by M569 before.
M906: Set motor currents - digital potentiometers for steppers
M574: Set endstop configuration for X,Y,Z,En. See also M558: Set Z probe type
M572: Set or report extruder elasticity compensation
M575: Set serial comms parameters - Presently used by PanelDue for communication with the Duet
M911: Set power monitor threshold voltages NEW (1.14) Supply voltage required for proper board

3 de 7 21/12/2020 18:52
RepRap Firmware G-Codes - RepRap https://reprap.org/wiki/RepRap_Firmware_G-Codes

operation.
M912: Set electronics temperature monitor adjustment NEW (1.14) Offset added to reported
processor temperature to have accurate value.
M913: Set motor percentage of normal current NEW (1.14) Temporary stepper current modification
in % (for stalling against mechanical stops)

Web control (DWC)

M560: Upload web page file


M998: Request resend of line

Firmware configuration

M559: Upload configuration file


M997: Perform in-application firmware update - NEW - firmware update without USB connection

Reporting - also used by DWC

M36: Return file information Return information about a file on the SD card - JSON (https://en.wikip
edia.org/wiki/JSON) format
M122: Diagnose
M573: Report heater PWM
M408: Report JSON-style response - Return printer status data
M503: Print settings - Display config.g content

Geometry

M208: Set axis max travel


M556: Axis compensation - X/Y angular correction
M564: Limit axes
M579: Scale Cartesian axes - X/Y/Z scale compensation for deltas
M667: Select CoreXY mode
M668: Set Z-offset compensations polynomial - in development ?

Miscellaneous commands

M37: Simulation mode - Run a print simulation for time estimation : slow

Specialised machines

M567: Set tool mix ratios


M568: Turn off/on tool mix ratios
M578: Fire inkjet bits
M580: Select Roland

G-codes with specific or extended syntax


Movement and geometry

G0 & G1: Move - Flags are used to bypass endstops or move carriage on delta
G10: Tool Offset Define standby and operating tool temperature / Retract if no parameter, see M207
(NEW)
M207: Set retract length RRF add unretract length parameter - NEW -

4 de 7 21/12/2020 18:52
RepRap Firmware G-Codes - RepRap https://reprap.org/wiki/RepRap_Firmware_G-Codes

M208: Set axis max travel Used for unretract length in other firmware
M665: Set delta configuration Add height, maximum usable radius and column angular position

Heating

M105: Get Extruder Temperature


M135: Set PID sample interval
M141: Set Chamber Temperature (Fast) - in RRF also define the chamber heater
M301: Set PID parameters RRF add PID band, PWM scaling and other parameters
M305: Set thermistor and ADC parameters add external thermocouple (using SPI (https://en.wikipedi
a.org/wiki/Serial_Peripheral_Interface_Bus))

Miscellaneous

M106: Fan On - RRF add configuration. Fan1 configured in thermostatic mode by default. Deactivate
with "M106 P1 H-1".
M302: Allow cold extrudes add cancelling of the command
M561: Set Identity Transform - reset the transformation from calibration

Non specific G-codes


Movement

G11: Unretract Used while Firmware retraction is configured in your slicer, along G10
G28: Move to Origin (Home) run macro home.g or homedelta.g
G90: Set to Absolute Positioning
G91: Set to Relative Positioning
G92: Set Position Define actual position to be defined coordinates (zero if no parameters)
M82: Set extruder to absolute mode
M83: Set extruder to relative mode To be preferred for reliability
M114: Get Current Position

Operation

G4: Dwell G4 Pnn wait for nn miliseconds


M0: Stop or Unconditional stop
M3: Spindle On, Clockwise (CNC_specific)
M18: Disable all stepper motors
M84: Stop idle hold
M80: ATX Power On
M81: ATX Power Off
M107: Fan Off
M112: Emergency Stop
M116: Wait
M400: Wait for current moves to finish
M220: Set speed factor override percentage
M221: Set extrude factor override percentage
M999: Restart after being stopped by error

Probing

G30: Single Z-Probe


G31: Set or Report Current Probe status Also allow probe offset definition

5 de 7 21/12/2020 18:52
RepRap Firmware G-Codes - RepRap https://reprap.org/wiki/RepRap_Firmware_G-Codes

G32: Probe Z and calculate Z plane


M557: Set Z probe point
M561: Set Identity Transform

Printing

M20: List SD card


M23: Select SD file
M24: Start/resume SD print
M25: Pause SD print
M26: Set SD position
M27: Report SD print status
M28: Begin write to SD card
M29: Stop writing to SD card
M30: Delete a file on the SD card
M32: Select file and start SD print
M226: Gcode Initiated Pause
M302: Allow cold extrudes

Physical interface

M42: Switch I/O pin


M119: Get Endstop Status
M300: Play beep sound On PanelDue or DWC
M117: Display Message

Heating

M104: Set Extruder Temperature


M105: Get Extruder Temperature
M109: Set Extruder Temperature and Wait
M140: Set Bed Temperature (Fast)
M141: Set_Chamber Temperature (Fast)
M190: Wait for bed temperature to reach target temp

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

Configuration

G21: Set Units to Millimeters


M201: Set max printing_acceleration
M203: Set maximum feedrate
M206: Set home offset
M304: Set PID parameters - Bed PID parameters for Bed - equivalent to M301 H0
M350: Set microstepping mode
M404: Filament width and nozzle diameter
M502: Revert to the default "factory_settings."
M666: Set delta endstop adjustment

Report

6 de 7 21/12/2020 18:52
RepRap Firmware G-Codes - RepRap https://reprap.org/wiki/RepRap_Firmware_G-Codes

M503: Print settings


M115: Get Firmware Version and Capabilities
M407: Display filament diameter

Miscellaneous

M110: Set Current Line Number


M111: Set Debug Level
M120: Push
M121: Pop
M500: Store parameters in EEPROM
M501: Read parameters from EEPROM

In addition to site licence GFDL1.2 (https://www.gnu.org/licenses/old-licenses/fdl-1.2.html), this page is also released under
license CC BY-SA 4.0 (https://creativecommons.org/licenses/by-sa/4.0/)

Retrieved from "https://reprap.org/mediawiki/index.php?title=RepRap_Firmware_G-Codes&oldid=184978"

This page was last edited on 18 February 2019, at 17:26.


Content is available under GNU Free Documentation License unless otherwise noted.

7 de 7 21/12/2020 18:52

You might also like