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.
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. Some default values (DC42 fork rev 1.11):
- Default PID parameters ( M301) for a hotend heater : P10 I0.1 D100 T0.4 W180 B30
- Default control Bang-bang for bed (P-1),else : I5 D500 T2.7 W255 B5 - using PID, you may start with P=85
- PWM frequency 10Hz for Bed and Chamber heaters and ?? 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 (M203): X25000 Y25000 Z25000 E8000:8000:1200:1200:1200:1200
- Accelerations (M201): X500 Y500 Z20 E250:250:250:250:250:250
- Maximum jerk rates (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
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 - In progress -
- M582: Check external trigger Check pin status associated with a trigger - In Progress -
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
Non specific G-codes
Movement
- G-code#G0_.26_G1:_Move
- G-code#G11:_Unretract
- G-code#G21:_Set_Units_to_Millimeters
- G-code#G28:_Move_to_Origin_.28Home.29
- G-code#G90:_Set_to_Absolute_Positioning
- G-code#G91:_Set_to_Relative_Positioning
- G-code#G92:_Set_Position
http://reprap.org/wiki/G-code#M82:_Set_extruder_to_absolute_mode http://reprap.org/wiki/G-code#M83:_Set_extruder_to_relative_mode http://reprap.org/wiki/G-code#M114:_Get_Current_Position
Operation
- G-code#M0:_Stop_or_Unconditional_stop
- G-code#M3:_Spindle_On.2C_Clockwise_.28CNC_specific.29
- G-code#M18:_Disable_all_stepper_motors
http://reprap.org/wiki/G-code#M84:_Stop_idle_hold http://reprap.org/wiki/G-code#M80:_ATX_Power_On http://reprap.org/wiki/G-code#M81:_ATX_Power_Off http://reprap.org/wiki/G-code#M107:_Fan_Off http://reprap.org/wiki/G-code#M112:_Emergency_Stop http://reprap.org/wiki/G-code#M116:_Wait http://reprap.org/wiki/G-code#M400:_Wait_for_current_moves_to_finish http://reprap.org/wiki/G-code#M220:_Set_speed_factor_override_percentage http://reprap.org/wiki/G-code#M221:_Set_extrude_factor_override_percentage
probing
- G-code#G30:_Single_Z-Probe
- G31: Set or Report Current Probe status Also allow probe offset definition
- G32: Probe Z and calculate Z plane
Printing
- G-code#M20:_List_SD_card
- G-code#M23:_Select_SD_file
- G-code#M24:_Start.2Fresume_SD_print
- G-code#M25:_Pause_SD_print
- G-code#M26:_Set_SD_position
- [[G-code#M27:_Report_SD_print_status
- [[G-code#M28:_Begin_write_to_SD_card
- [[G-code#M29:_Stop_writing_to_SD_card
- [[G-code#M30:_Delete_a_file_on_the_SD_card
- [[G-code#M32:_Select_file_and_start_SD_print
http://reprap.org/wiki/G-code#M226:_Gcode_Initiated_Pause http://reprap.org/wiki/G-code#M302:_Allow_cold_extrudes
Physical interface
http://reprap.org/wiki/G-code#M119:_Get_Endstop_Status http://reprap.org/wiki/G-code#M300:_Play_beep_sound
Heating
http://reprap.org/wiki/G-code#M104:_Set_Extruder_Temperature http://reprap.org/wiki/G-code#M105:_Get_Extruder_Temperature http://reprap.org/wiki/G-code#M109:_Set_Extruder_Temperature_and_Wait http://reprap.org/wiki/G-code#M140:_Set_Bed_Temperature_.28Fast.29 http://reprap.org/wiki/G-code#M141:_Set_Chamber_Temperature_.28Fast.29 http://reprap.org/wiki/G-code#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
http://reprap.org/wiki/G-code#M201:_Set_max_printing_acceleration http://reprap.org/wiki/G-code#M203:_Set_maximum_feedrate
http://reprap.org/wiki/G-code#M304:_Set_PID_parameters_-_Bed http://reprap.org/wiki/G-code#M350:_Set_microstepping_mode http://reprap.org/wiki/G-code#M404:_Filament_width_and_nozzle_diameter
Report
http://reprap.org/wiki/G-code#M206:
Miscellaneous
http://reprap.org/wiki/G-code#M110:_Set_Current_Line_Number http://reprap.org/wiki/G-code#M111:_Set_Debug_Level http://reprap.org/wiki/G-code#M115:_Get_Firmware_Version_and_Capabilities http://reprap.org/wiki/G-code#M117:_Display_Message http://reprap.org/wiki/G-code#M120:_Push http://reprap.org/wiki/G-code#M121:_Pop