This page gives RepRapFirmware’s device and pin assignment, height following
settings, CAN bus, accelerometer, event, phase stepping, update and restart codes,
the T command and what the dictionary says about replies, from the
Duet3D G-code dictionary as read on 3 December 2026. RRF means RepRapFirmware, and
version numbers are its versions.
M950: create devices and assign pins
(RRF 3) Each command creates or changes one device, named by exactly one of these letters.
| Parameter | Device |
|---|---|
H | Heater |
F | Fan |
J (3.01) | Input pin |
P or S | Output or servo port; numbers are shared, so each must be unique. A servo port differs in default PWM frequency |
R (3.3) | Spindle |
D (3.4, Duet 3 MB6HC) | SD card slot; only 1 |
E (3.5) | LED strip |
| Parameter | Meaning |
|---|---|
C"pins" | Pin names; ! inverts, ^ enables the pull-up (some pins have a permanent one), in either order; nil frees the pin. A CAN address at the start applies to every pin listed |
Q | PWM frequency in Hz, 1 to 65535 from 3.5 (0 to 65535 before); default 500 for outputs, 250 for fans and heaters; heaters at most 1000. For LED strips the clock frequency, four times the bit rate: NeoPixel default 3200000 from 3.7 (2500000 before), DotStar 1000000 |
T | Heater: temperature sensor made with M308, required. LED strip: type, 0 DotStar, 1 RGB NeoPixel (default), 2 RGBW NeoPixel. Spindle (3.6): 0 (default) enable and direction inputs, 1 forward and reverse inputs |
B (3.7) | Heater: ambient temperature sensor, such as the chamber’s for a tool heater |
L | Spindle: max or min:max RPM at maximum and zero PWM; default 60 and 10000 |
K (3.5) | Spindle: PWM values 0 to 1 as max, max:min or max:min:idle. Fan: tacho pulses per turn, default 2, 0.5 to 20 (to 200 from 3.6). LED strip (3.5.3): colour order 0 BGR, 1 BRG, 2 RGB, 3 RBG, 4 GBR, 5 GRB, default 0 for DotStar and 5 for NeoPixel (NeoPixel from 3.7) |
U (3.5) | LED strip: most LEDs, default 60 |
With C or Q the pins or frequency are set; otherwise
the device is reported (spindles from 3.6).
M950 H1 C"out1" Q100 T1
M950 H1 C"3.out0+out2" Q100 T1
M950 F0 C"!1.out3+out3.tach" Q450
M950 J1 C"!io4.in"
M950 P0 C"io4.out"
M950 R0 C"out3" L12000
M950 D1 C"spi.cs0+spi.cs2"
M950 E0 C"led" T2
- Several pins are joined with
+. A heater may have several ports (3.4); a fan one, or two with the tacho second; a spindle one to three: speed PWM, on/off and forward/reverse, or withT1speed PWM, forward and reverse; an SD slot chip select and card detect. - From 3.7 a
Jinput may be virtual:fmn.switch(filament present on extruder n’s monitor),fmn.motion(movement within 0.5 s) orproben (Z probe triggered);!inverts. - Order in
config.g: after theM308sensor, and before anything that uses the device (M307,M563,M106,M150). - LED strips use memory; on tool boards, 1XD or with several strips set
Uto the real number. On the MB6HC and MB6XD the dedicated LED port takes at most 240 RGBW or 320 RGB NeoPixels at present. Up to 3.6 those boards swapped the DotStar colours ofK3andK5.
M951: height following settings
(RRF 3; from 3.7 on MB6HC and MB6XD only) Parameters of the PID loop that
moves Z from a sensor, used with M594.
| Parameter | Meaning |
|---|---|
H | Sensor number |
P | Proportional factor, mm per sensor unit |
I | Integral factor, mm per sensor unit per second |
D | Derivative factor, mm per sensor unit per second of change |
F | Correction frequency in Hz, default 5 |
Zmin:max | Permitted Z range |
P, I and D are all positive if raising Z
raises the reading, all negative if it lowers it.
M952 and M954: CAN addresses
| M952 parameter | Meaning |
|---|---|
B | Board to change, 1 to 125; 0 sets the main board’s bit rate (up to 3.7.0) |
A | New address, 1 to 125, effective after the board restarts |
S | Bit rate in kbit/s (1000 bits), default 1000 |
T | Sample point as a fraction of the bit time, default 0.78 from 3.6.2, 0.75 before; only with S |
J | Maximum jump as a fraction of the bit time: 0.25 to 3.6.1, 0.22 in 3.6.2 and 3.6.3, 1 − T from 3.7; only with S |
M952 B121 A20
M952 B20 S500
All boards on a bus use one rate: 1000 suits up to 40 m of cable, 500 up to
80 m, 250 up to 160 m, and other rates are not advised. Change each expansion
board first (it then drops out of contact and may need disconnecting), and the
main board last, with M953 from 3.7.1.
M954 Aaddress (3.4, Duet 3) turns the board running it
into a CAN expansion board with that address, normally as the only line of
config.g. Up to 3.6 it stops sending time sync and answers as an
expansion board; from 3.7 it waits for time sync before setting the fast data
rate. Some diagnostic codes such as M111 and M122 still
work over USB.
M953: CAN bus timing
| Parameter (3.7) | Meaning |
|---|---|
I (3.7.1) | Bus as numbered on the board; default CAN1, the main one. I0 is CAN0, on MB6HC and MB6XD only |
C (3.7.1, with I0) | CAN0 mode: 0 off (default), 1 second CAN-FD bus, 2 classic CAN, as for ODrive controllers |
S | Arbitration rate in kbit/s: 1000 (default; 250 for classic CAN0), 500 or 250 |
R (MB6HC, MB6XD) | Data phase multiplier 1, 2, 3, 4, 6 or 8; 1 turns bit rate switching off. Give it in every M953; not for classic CAN0 |
T, J | Arbitration phase sample point and maximum jump, as fractions; not normally used |
U, K (with R) | The same for the data phase |
M953 S1000 R4
M953 I0 C2
- Without parameters it reports every bus;
M953 I0only CAN0. Timing for a disabled CAN0 is rejected. - CAN1 is the RJ11 connector and CAN0 the two-pin AUX_CAN (on some revisions also pins 2 and 5 of the RJ11).
- Addresses must be unique across both buses. With both in FD mode, a command to a board not yet heard waits 1 s and fails. Messages from a board on the other bus than first seen are ignored with a warning; fix and restart.
- Changing an FD bus restarts expansion boards that have run over 5 s or
been configured, so put
M953near the start ofconfig.g.
M959: CAN connection supervision
(3.7) B board address, 1 to 126; T timeout in
seconds, at least 3, default 10. M959 B121 reports one board,
M959 all. The main board raises expansion-timeout after
half the timeout without a status report. A board that had time sync and loses
it for the whole timeout switches its heaters off. On return it announces itself
and expansion-reconnect is raised, with param.P 0
after a reset, 1 with configuration intact, 3 intact but with heaters switched
off; setpoints are not restored. The board forgets T at reset, so
set it in config.g.
M959 B121 T30
M955: configure an accelerometer
(3.4, partly 3.3)
| Parameter | Meaning |
|---|---|
P | Required. From 3.7 a number 0 to 9; up to 3.6 the device, 0 on the main board or board.device |
C"…" | From 3.7 required to configure: address and chip select and interrupt pins for SPI (3.spi.cs1+spi.cs0) or I2C (121.i2c.lis; 120.i2c.lis3dh on a SAMMYC21); nil removes. Up to 3.6 only the two main board pins |
I | Orientation, two digits: which machine direction the chip’s Z axis faces, then its X axis; 0 +X, 1 +Y, 2 +Z, 4 −X, 5 −Y, 6 −Z. Default 20, aligned |
S | Sample rate in Hz |
R | Resolution in bits, typically 8, 10 or 12 |
Q (3.3) | SPI clock, default 2000000 Hz |
M955 P0 C"spi.cs1+spi.cs0" I10
M955 P121.0 I10
With P alone it reports, including the rate and resolution really
chosen: the resolution is held to at most R (or the sensor’s
minimum) and a supported rate near S picked. From 3.7 each board has
one accelerometer, and I, S and R apply
only with C.
M956: record accelerometer samples
| Parameter | Meaning |
|---|---|
P | Accelerometer, as for M955; required |
S | Number of samples, required |
X Y Z | Axes; all three if none, and always for a LIS2DW (3.5) |
A | Required; 0 start now (the only value so far) |
F"name.csv" (3.4) | File in 0:/sys/accelerometer; otherwise named from date and time |
M956 P0 A0 S2000
From 3.7 only one accelerometer records at a time.
M957: raise an event
(3.4) Runs the handler of an event or trigger as if it had happened, mainly to test it.
| Parameter | Meaning |
|---|---|
E"type" | heater-fault, driver-error, filament-error, driver-warning, driver-stall, expansion-timeout, expansion-reconnect, and (3.7) board-temperature-warning and board-over-temperature. 3.4.0 needs underscores for the hyphens; later versions accept both |
D | Device: driver, heater or extruder, according to type |
B | CAN address it should seem to come from |
P | Extra data, such as fault subtype or driver status |
S"text" | Text for the message |
M957 E"heater_fault" D1 B2
M970 to M970.3: phase stepping
(3.6 on MB6HC main board drivers; CAN drivers from 3.7) Drives motor phases directly in place of step and direction.
| Command | Parameters |
|---|---|
M970 | X Y Z E 1 phase stepping, 0 step and direction; none reports |
M970.1 | X Y Z E velocity constant for current scaling, default 1000 (speed alone gives full current at 1920 full steps/s; higher reaches it sooner) |
M970.2 | X Y Z E acceleration constant, default 50000 (full current at 288000 full steps/s²) |
M970.3 (3.7) | Waveform correction: P driver, S harmonic 1 to 16, J size 0 to 90 degrees (0 removes), O phase 0 to 360, default 0. P alone reports |
M970 X1 Y0 Z0 E1:0
M970.1 X1000.0 Y2000.0 Z1000.0 E1000.0:1000.0
M970.3 P0.0 S2 J1.5 O200
M970follows anyM584for the axis; from 3.7 changing an axis’s drivers returns it to step and direction. An axis cannot mix local and CAN drivers.- Current never exceeds
M906and never falls below theM917fraction of it. Stall detection is unavailable. - From 3.7 it also works on 3HC boards, MB6HC in expansion mode, and 1HCL, M23CL and INDX drivers in open loop mode; Mini 5+ and MB6XD main boards use it to set up attached boards. Duet 2 never has it.
M970.3waits for motion to stop, allows four harmonics per driver and is lost at reset. On the closed loop boards it also acts in closed loop modes, except while tuning. For step and direction useM569.2.
M997, M998 and M999: update, resend and restart
| M997 parameter | Meaning |
|---|---|
S | Modules, colon-separated: 0 main firmware (default), 1 WiFi module, 2 DSF packages (3.5, SBC), 3 bootloader of CAN board B, 4 PanelDue (3.2) |
B | CAN address of the board (3.0, Duet 3), default 0, the main board |
P"file" (3.3) | File to use, a name in 0:/firmware or a full path; one module only, ignored with S3 |
F"feed" (3.5, SBC) | Package feed with S2: stable (default), unstable, or either with -x.y |
V"version" (3.5, SBC) | Install that DSF and RRF combination; not with F |
M997
M997 B121
M997 S1 P"0:/sys/DuetWiFiServer.bin"
M997 S2 V"3.6.3"
Update files live in 0:/sys up to 3.2.2 and
0:/firmware from 3.3. The main firmware also needs the board’s
in-application programmer file, and 3.7 needs its own. Up to 3.6,
M997 S3 without B put the WiFi module into bootloader
mode.
M998 P34 asks the host to resend line 34; input handling may
substitute it for a line that fails its checksum.
M999 restarts the firmware; B a CAN board (default
0), P"ERASE" enters firmware upload mode. In SBC mode
B-1 reboots the computer (DSF 3.3) and P"OFF" shuts it
down (3.5), with the DuetPi management plugin.
T: select a tool
| Form | Meaning |
|---|---|
Tn | Select tool n, 0 to 49; a negative number deselects all |
T | Report the current tool |
R (1.20) | T R1 selects the tool active at the last pause; R0 to R5 the tool of that G60 restore point |
P (1.19) | Macros to run, as a sum: 1 tfree, 2 tpre, 4 tpost; 0 none, absent all |
T as parameter (3.4) | T T{state.currentTool + 1} takes the number from an expression |
T0
T-1 P0
T R1
Selecting the active tool does nothing. Otherwise:
- The position is saved to restore point 2.
tfreeold.gruns.- The old tool is deselected and its heaters go to standby.
tprenew.gruns.- The new tool’s heaters go to active temperature.
tpostnew.gruns, normally withM116in it.- The new tool’s offsets apply, and it is in use.
- Offsets apply while a tool is current: in
tfreeandtpost, not intpre. - A number with no tool does only the first two steps and removes the old offset.
- Before 3.3 the macros ran only with all axes homed. From 3.3 selecting or deselecting a tool with a spindle stops the spindle.
- After a reset tools stay cold until selected.
Line endings and replies
Lines end in line feed; carriage return and line feed is accepted too. The
dictionary describes the general RepRap reply protocol, in which each line from
the machine starts with ok, rs (resend, with a line
number), !! (hardware fault) or // (information),
apart from a single start at boot, and notes that RRF does not send
start, !! or // action: lines and sends
rs only for M998. T: and B:
temperatures answer M105 (below −273 where there is no sensor), and
C: introduces coordinates.
M20 S2, M36, M409 and, up to 3.6,
M408 reply with one line of JSON.
Slicers may add their own scripts at the start and end of a file; the dictionary does not prescribe them.
Sources
- G-code dictionary – Duet3D’s documentation of RepRapFirmware’s commands, published under a Creative Commons attribution share-alike licence; this page is written in our own words