Clone wiki

5DPrint Firmware / M Code

M18


Disable steppers until next move. Same as M84.

M20


List all SD card files under the root directory.

F: Flags for displaying, 0 for displaying filename only, 1 for displaying file size, 2 for displaying directory

Example:

M20 ; List files under root directory

M21 ; List files with file size

M21


Initialize SD card. SD card must be initialized before being used.

M22


SD card is released and can be physically removed.

M23


The file specified is selected ready for printing.

Example:

M23 filename.g ; Selects filename.g as the print file

M24


Start/resume SD print

M25


Pause SD print

M27


Report SD print status

M28


Start SD write from host to SD card. Any subsequent command sent from the host will be written to the SD card.

The SD card write process will only stop when M29 is called.

Example:

M28 filename.g ; filename.g is created (or overwritten if it exists) on the SD card

M29


Stop SD write

M30


Delete file from SD

Example:

M30 filename.g ; Delete filename.g on SD card

M31


Enable / Disable autoprint from SD card

For more information about autoprint, please refer to the autoprint page

E: 0 to enable autoprint, 1 to disable autoprint

Example:

M31 E1 ; Enable autoprint

M31 E0 ; Disable autoprint

M80


Turn on Power Supply

M81


Turn off Power Supply

M82


Set E codes absolute (default)

M83


Set E codes relative while in Absolute Coordinates (G90) mode

M84


Disable steppers until next move. Same as M18.

M85


Set an inactivity timeout, after which the steppers and heaters will be disabled.

S: Seconds to specify an inactivity timeout, 0 to disable the timeout

Example:

M85 S1 ; Enable a 1 second inactivity timeout

M85 S0 ; Disable the timeout

M92


Set axis_steps_per_unit - same syntax as G92

Example:

M92 X1 Y2 Z3 E4

M93


Show axis steps per unit

M104


Set extruder target temp

S: Extruder target temperature

Example:

M104 S230 ; Set extruder target temperature to 230C

M105


Read current temp

M106


Fan on

S: Speed of the Fan motor. Ranges from 0 to 255

Example:

M106 S125 ; Set duty cycle of fan to 50%

M107


Fan off

M109


Wait for extruder current temp to reach target temp.

S: Extruder target temperature

Example:

M109 S230 ; Wait for extruder target temperature to reach 230C

M112


Emergency Stop. Any moves in progress are immediately terminated. All motors and heaters are turned off.

M114


Display current position

M115


Get firmware version and capabilities string

M119


Show Endstopper State

M140


Set bed target temperature

S: Bed target temperature

Example:

M140 S120 ; Set bed target temperature to 120C

M190


Wait for bed current temp to reach target temp

S: Bed target temperature

Example:

M190 S120 ; Wait for bed target temperature to reach 120C

M201


Set maximum acceleration for print moves

X,Y,Z,E: (units/s^2)

Example:

M201 X1 Y2 Z3 E4 ; Set maximum acceleration for X,Y,Z,E axes

M202


Set maximum feed rate that your machine can sustain

X,Y,Z,E: (mm/sec)

Example:

M203 X1 Y2 Z3 E4 ; Set maximum feed rate for X,Y,Z,E axes

M203


Set temperture monitor

S: For repetier host, 0 for returning extruder temperature, 1 for returning bed temperature, temperature is reported every 0.25 seconds

P: For 5D host, interval in seconds for regular temperature report

5DPrint Example:

M203 P1 ; Sets the regular temperature reporting to every 1 second

Repetier Host Example:

M203 S0 ; Set temperature monitor to return hot end's temperature

M203 S1 ; Set temperature monitor to return bed's temperature

M204


Set default acceleration for extrusion

S: Extrude filament acceleration in mm/sec^2

T: Retract filament acceleration in mm/sec^2

Example:

M204 S1 ; Set extrude acceleration to 1

M204 T1 ; Set retract acceleration to 1

M205


Advanced settings

S: minimum feed rate T: minimum travel speed X: maximum xy jerk Z: maximum Z jerk

M206


Set additional homing offset

X,Y,Z: Coordinates

Example:

M220 X1 Y2 Z3 ; Set additional homing offset to (1,2,3)

M220


Set feed multiply factor

S: multiply factor (from 20 to 200)

Example:

M220 S100 ; Set feed multiply factor to 100

M221


Set extruder multiply factor

S: multiply factor (from 40 to 200)

Example:

M221 S100 ; Set extruder multiply factor to 100

M226


Pause print

P: Pause flag, 0 to resume print, 1 to pause print after current block, -255 to discard plan buffer and resume operation

Example:

M226 P1 ; Pause print after current block has finished

M226 P0 ; Resume print

M226 P-255 ; discard plan buffer contents and resume normal operation

M300


Play beep sound

F: Frequency in Hz(from 100 Hz to 5000 Hz)

P: Period in milliseconds (from 0 to 2000 ms)

Example:

M300 F4000 P1000 ; Play a 4 kHz tone for 1 s

M301


Set PID parameters for the temperature control

P: Proportional value I: Integral value D: Derivative value

Example:

M301 P1 I2 D3 ; Set the P,I,D value to 1,2,3

M302


Enable / Disable Cold Extrudes

P: 0 to disable cold extrude, 1 to enable cold extrude

Example:

M302 P1 ; Enable cold extrudes

M302 P0 ; Disable cold extrudes

M303


PID relay autotune

S: target temperature, default target temperature is 200°C

C: Number of cycles for autotune, default is 5 cycles

F: Control type, default is 0

  • 0: Classic PID
  • 1: Some overshoot
  • 2: No overshoot
  • 3: Return all PID results listed above

Example:

M303 S200 ; PID Autotune at 200°C

M303 F3 ; Return all PID results

M303 C10 ; Perform 10 PID Autotune cycles

M305


Set hot bed maximum duty cycle

S: Stage 1 or 2, Stage 1 is before 70C, while Stage 2 is after 70C

D: Duty cycle of hot bed, from 0% to 100%

Example:

M305 S1 D70 ; Set hot bed maximum duty cycle to 70% before 70C

M305 S2 D85 ; Set hot bed maximum duty cycle to 85% after 70C

M400


Finish all moves left in the buffer

M500


Store parameters in EEPROM

Refer to the EEPROM page for more information.

M501


Read parameters from EEPROM to current session

Refer to the EEPROM page for more information.

M502


Revert to the default "factory settings

Refer to the EEPROM page for more information.

M503


Display EEPROM settings through EEPROM

Refer to the EEPROM page for more information.

M603


Show Free Ram memory

M604


Show Timer 1 COMPA ISR Execution Time Debug Info

M605


Reset Timer 1 COMPA ISR Execution Time Min / Max Values

M606


Show CPU loading information

M607


Reset Peak and Average CPU load values

M608


Show Firmware Version Info

M609


Show last reset flags

M610


Set Extruder Heater Max Current

P: Max current level, from 0% to 100%

Example:

M610 P90 ; Set Extruder Heater Max Current to to 90%

M852


Enter Boot Loader Command

F: Passcode for entering bootloader mode, which is 3464

Example:

M852 F3464 ; Enter bootloader mode

M906


Set current limits for stepper motors

X, Y, Z, E: Max current limit for particular axis (mA)

S: Current sense resistance for motor drivers, Only 100 or 120 is allowed (m Ohm)

Example:

M906 X1600 Y1600 Z1600 E1600 ; Set X, Y, Z, E current limit to 1600 mA

M906 S100 ; Set current sense resistance to 100 m Ohm

M907


Set microstep settings for stepper motors

X,Y,Z,E: 1 for full step, 2 for half step, 4 for quarter step, 16 for sixteenth step

Example:

M907 X16 Y16 Z16 E16

M908


Set GPIO pins with Pin configuration shown below.

(Only applicable to 5DPrint D8 Driver Board)

|---------------------------------------|

|---9-------7---5---3---1---5V------| ISP 6-pin

|---GND---8---6---4---2---GND---| ISP 6-pin

|---------------------------------------|

P: Pin

S: 1 to drive high, 0 to drive low

Example:

M908 P1 S1 ; Set Pin 1 of GPIO pins to 1

Updated