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.
What is presently listed in this page is not the exhaustive list of G-codes interpreted by RepRap Firmware, only the G-Codes which are specific (yet). 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.
Contents
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 - Hardware drive reference defaults are 0:X; 1:Y; 2:Z; 3:E0; 4:E1; 5:E2; 6:E3; 7:E4; 8:E5
- Rn - enable value - for different hardware needing positive or negative signal to be enabled - M569
- Bnnn - Safe printing radius (M665), baud rate (M575)
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.
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 dependant - 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 -
- M582: Check external trigger Check pin status associated with a trigger - NEW -
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
- M906: Set motor currents - digital potentiometers for steppers
- M574: Set endstop configuration
- M572: Set or report extruder elasticity compensation
- M575: Set serial comms parameters - Presently used by PanelDue for communication with the Duet
Web control (DWC)
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 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
- 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)
- M105: Get Extruder Temperature
- M106: Fan On - RRF use it to configure controllable fans
- M135: Set PID sample interval
- M141: Set Chamber Temperature (Fast) - in RRF also define the chamber heater
- M207: Set retract length RRF add unretract length parameter - NEW -
- M208: Set axis max travel Used for unretract length in other firmware
- M301: Set PID parameters RRF add PID band, PWM scaling and other parameters
- M302: Allow cold extrudes add cancelling of the command
- M305: Set thermistor and ADC parameters add external thermocouple (using SPI)
- M665: Set delta configuration Add height, maximum usable radius and column angular position
- M561: Set Identity Transform - reset the transformation from calibration
Useful G-codes
- G31: Set or Report Current Probe status Also allow probe offset definition
- G32: Probe Z and calculate Z plane
- M206 Set home offset. Could be used to adjust head above bed during printing. M206 Z0.1 move up by 0.1mm