Important! These instructions relate to RRF3.0 and to some extent to later versions of RRF3 however they are not kept up to date. Please refer to the Gcode Dictionary and use the RepRapFirmware configuration tool to migrate from RRF2 to RRF3
Overview
RepRapFirmware 3 is the next generation version of RepRapFirmware for Duet 2 WiFi/Ethernet/Maestro, Duet 3, and some other 32-bit motion control electronics. There are significant configuration differences from version 2, so upgrading from RRF 2.x to RRF 3.x is not plug-and-play.
RRF3.x uses the GPIO concept extensively. GPIO (General-Purpose Input/Output) is an digital signal pin on a circuit board or processor that can act as an Input or Output, as controlled by the Firmware. GPOUT = output, GPIN = input.
RRF3 uses these programmable pins to allow much greater flexibility and enhanced expansion for the future. The configuration files must define the uses of these pins first, then their assignments
The primary benefits of RRF 3 are:
- RRF 3 uses pin names instead of logical pin numbers.
- With RRF 3 you can choose how devices are mapped to input and output pins. For example, you can connect fans to heater ports and heaters to fan ports.
- RRF 3 supports multiple endstop switches on axes (one per motor) natively. You no longer need to split axes during homing.
- RRF 3 allows any fan to have an associated tacho input.
- RRF 3 supports multiple tool probes. As well as a standard Z probe, you can define additional probes for use with the M585 command.
- RRF 3 supports the large amount of expansion available with Duet 3 boards.
The primary configuration differences compared to RRF 2 are:
- Logical pin numbers are no longer used in M42 and M280. GPIO pin numbers replace them. Before using M42 or M280, the GPIO pin must have been assigned using M950.
- Endstop numbers are no longer used in M591. Pin names replace them.
- M585 now uses either an axis endstop or a probe
- The frequency and pin inversion status of fans and heaters can no longer be set in M106 or M307. These functions are moved to M950.
- RRF 3 allows sensors to be defined independently of heaters. Sensors are now configured using the new M308 command, this replaces M305 used in earlier versions of RRF. When defining a heater, you must specify the sensor that it uses to control temperature. The association between heaters and sensors is defined using M950.
- RRF 3.0 and earlier only: On Duet 2 boards, only 3 fans, 3 endstop inputs and 2 extruder drives are configured by default. Any additional devices (for examples, all heaters, and any fans or extruder drives connected to a DueX expansion board) must be configured explicitly using M950 and/or M574. By contrast on Duet 3 boards there are no pre-configured heater ports, fan ports, or endstop inputs. You must assign the heater, fan and endstop switch ports you require using M950 and M574.
- All RRF versions from 3.01beta1 onwards have no pre-configured devices, on all Duet boards.
RRF3 always uses a real time operating system (RTOS). It does not support legacy version 0.6 or 0.8.5 Duets.
Getting RRF 3
The latest releases are on github here:
https://github.com/Duet3D/RepRapFirmware...
Do read the whole of this guide to understand the configuration changes required if migrating from RRF2.
Note: it is not possible to upgrade a Duet WiFi, Ethernet or Maestro directly from firmware 1.x or 2.x to 3.01 or later. You must upgrade to firmware 3.0 as an intermediate step.
Summary of what you need to do to convert your configuration and other files
Heaters and temperature sensors
- You must convert your M305 commands to equivalent M308 commands to define the temperature sensors you use.
- You must add M950 commands to define the heaters you use, and associate them with temperature sensors. These M950 commands should come later in config,g than the M308 commands that create the temperature sensors, but before any M307 or M301 command that refer to that heater number.
- If your machine has a bed heater, you must add a M140 command to declare which heater is your bed heater, unless your config.g file already has one. Normally this will be M140 H0.
Fans
- You must add M950 commands to define the fans you use. [RRF 3.0 on Duet 2 series created fans by default, but 3.01 and later do not.]
Z probe
- You must declare the input pin used by the Z probe (and the modulation/programming pin, if needed) in your M558 command.
- If you are using a BLTouch (or use M280 and/or M42 for any other reason), you must create a GPIO port for it using M950 and change your M280 commands in deployprobe.g and retractprobe.g to address that port
Endstops and homing files
- You must declare the endstop pins for all axes using M574 commands, one command per axis that has endstops. If you were creating additional axes in order to using multiple endstop switches on a single axis, one per motor, you are recommended to use the built-in support for homing the motors individually instead.
- If you use G1 S1 and/or G1 S2 commands in your homing files, you should change them to use G1 H1 or G1 H2 commands instead.
GPIO and servos
- If you are using M42 or M280 to control spare outputs, or you are reading spare inputs using M577 or M581, you must set up those pins as GPOUT or GPIN pins using M950 and change the M42/M280/M577/M581 commands to use the GPOUT or GPIN port numbers that you created.
Filament monitors
- You must change the M591 commands to specify the pin name instead of the logical pin number
Tools
- If you use any tool numbers greater than 49 in your M563 commands then you must renumber them to be in the range 0-49.
Changes to existing G- and M-commands
G1
In RRF 2 you can use either the S or H parameter to specify a special move (e.g. S1 or H1 for a homing move), except that if the machine is in Laser mode then you must use H. In RRF 3, support for using S to specify a special move will soon be withdrawn; therefore you must use H instead.
G31
- The T parameter is removed.
- New parameter K selects the Z probe number. If there is no K parameter then Z probe 0 is used.
- New parameter H selects the sensor number to use for temperature compensation when the C and S parameters are used
If you have only one Z probe then you should not need to change your G31 commands.
M36
Quotation marks around the filename are mandatory.
M42
- Before you can use M42 you must create a GPIO port using M950. Then in the M42 command, the P parameter is the GPIO port number, not the logical pin number. Duet 2 supports up to 10 GPIO ports, numbered 0 to 9. No GPIO ports are allocated by default.
- The F and I parameters are no longer supported in M42. Instead, you can use the Q parameters in M950 to set the PWM frequency when you create the GPIO port, and you can invert the pin by using ! at the start of the pin name in the M950 command. However, inverting the pin may not be needed, because the firmware knows which pins have hardware inversion.
Example - old code:
M42 P3 I1 S0.5 F500 ; set Heater 3 pin to 50% PWM at 500Hz
New code:
M950 P0 C"exp.heater3" Q500 ; allocate GPIO port 0 to heater3 on expansion connector, 500Hz ... M42 P0 S0.5 ; set 50% PWM on GPIO port 0
M98
Quotation marks around the filename are mandatory.
M106
- The A, F and I parameters are no longer supported. Instead, specify the corresponding features (pin name, optional PWM frequency, and optional pin inversion) in the M950 command when you create the fan.
- When setting up a fan to be thermostatic, the H parameter is no longer a heater number, instead it is the sensor number to use
- If you were using the PB6 tacho input, you must declare this in a M950 command for the fan concerned.
Example - old code:
M106 P2 I1 F25000 ; fan 2 is a 4-wire PWM fan so invert it and use high PWM frequency
New code:
M950 F2 C"!Fan2+exp.pb6" Q25000 ; fan 2 is a 4-wire PWM fan so invert it, use high PWM frequency, tacho connected to PB6 on expansion connector
M115
On Duet 3 only this command takes an optional B (board number) parameter which is the CAN address of the board to be queried, default 0 (i.e. main board).
M122
On Duet 3 only this command takes an optional B (board number) parameter which is the CAN address of the board to be queried, default 0 (i.e. main board).
M143
In RRF 2 the optional P parameter of the M143 command is the number of the global heater protection element instance, and it defaults to the heater number (H parameter). Valid values are 0..(MaxHeaters-1) and 100..(MaxHeaters-1). The optional X parameter is the number of a heater or virtual heater whose sensor is used to monitor the heater.
In RRF 3.01-RC2 and later the optional P parameter is the number of the monitor for that particular heater. Valid values are 0..2 and the default is 0. The optional T parameter is the number of the sensor used to monitor the heater.
M280
- Before you can use M280 you must create a GPIO port using M950. Then in the M280 command, the P parameter is the GPIO port number, not the logical pin number. Duet 2 supports up to 10 GPIO ports, numbers 0 to 9. No GPIO ports are allocated by default.
- The I parameter is no longer supported in M280. Instead, specify an inverted pin name in M950 when you create the GPIO port.
Example - old code:
M280 P3 I1 S80 ; set Heater 3 pin to 80deg servo position, inverted
New code:
M950 S0 C"exp.heater3" ; assign GPIO port 0 to heater3 on expansion connector, servo mode ... M280 P0 S80 ; set 80deg servo position on GPIO port 0
M291
When using Duet 3 with attached SBC, currently only non-blocking calls are supported in DuetSoftwareFramework.
i.e.
M291 S2
and
M291 S3
only work if issued to the serial console.
M305
Prior to RRF3, every temperature sensor belongs to a heater. For sensors with no controllable heater (e.g. the MCU temperature sensor) you have to create a "virtual heater" in order to be able to use the sensor.
In RRF3, sensors are created and configured independently from heaters, using the M308 command. When creating a heater using M950, you tell it which sensor to use. You must create the sensor before you refer to it in a M950 command. M305 is not used. There are no virtual heaters.
Therefore, when converting to RepRapFirmware 3 you must replace each M305 command by a similar M308 command, which must be earlier in config.g than any M950 command that uses it.
You must also use M950 to define each heater that you use, because there are no default heaters.
Example - old code:
M305 P0 T100000 B3950 ; bed heater uses a B3950 thermistor M305 P1 T100000 B4725 C7.06e-8 ; E0 heater uses E3D thermistor
New code:
M308 S0 P"bed_temp" Y"thermistor" T100000 B3950 ; define bed temperature sensor M308 S1 P"e0_temp" Y"thermistor" T100000 B4725 C7.06e-8 ; define E0 temperature sensor M950 H0 C"bed_heat" T0 ; heater 0 uses the bed_heat pin, sensor 0 M950 H1 C"e0_heat" T1 ; heater 1 uses the e0_heat pin and sensor 1 M140 H0 ; the bed heater is heater 0
PT100 example - old code
M305 P1 S"T0" X200 R395 W2
New code
M308 S1 P"spi.cs1" Y"rtd-max31865" R395 F50 M950 H1 C"e0_heat" T1 ; heater 1 uses the e0_heat pin and sensor 1
M307
- The F parameter is no longer supported. Use the M950 Q parameter to set the PWM frequency in the M950 command that you use to define the heater .
- The I2 parameter is no longer supported, and I3 does the same as I1. You can invert the output in the M950 command instead.
- You can no longer disable a heater using M307 A-1 C-1 D-1. To use the pin for something else, don't create a heater on that pin.
Example - old code:
M307 H0 F100 ; change heater 0 PWM frequency to 100Hz M307 H2 A-1 C-1 D-1 ; disable heater 2 so we can use its pin to drive a fan
New code:
M950 H0 C"bed_heat" Q100 T0 ; heater 0 uses the bed_heat pin, sensor 0, PWM frequency 100Hz ; No need to disable heater 2 because we didn't define it in the first place
M452
- The P and I parameters are removed. Use the C parameter to select the laser control pin instead.
Example - old code:
M452 P3 I1 F100 ; laser uses heater3 pin, PWM frequency 100Hz
New code:
M452 C"exp.heater3" F100 ; laser uses heater3 pin, PWM frequency 100Hz
M453
- The P and I parameters are removed. Use the C parameter to select the spindle control pins instead.
Example - old code:
M453 P3:4 I1 F100 ; spindle forward/reverse on heater 3&4 pins, PWM frequency 100Hz
New code:
M453 C"exp.heater3+exp.heater4" F100 ; spindle forward/reverse on heater 3&4 pins, PWM frequency 100Hz
M500
Not yet supported in combination with SBC / Raspberry Pi
M501
Not yet supported in combination with SBC / Raspberry Pi
M550
Quotation marks around the machine name are mandatory.
M551
Quotation marks around the password are mandatory.
M558
- New optional parameter K selects the Z probe number. If there is no K parameter then Z probe 0 is used. You can ignore this parameter if you have only one Z probe.
- New parameter C specifies the input pin and the optional modulation pin. This parameter is mandatory, except for probe type 0 (no manual probing) and 10 (Z motor stall detection). A leading '!' character inverts the input or output. A leading '^' character enables the pullup resistor. The '^' and '!' characters may be placed in either order.
- Z probe types 4 (switch connected to E0 endstop input), 6 (switch connected to E1 endstop input) and 7 (switch connected to Z endstop input) are no longer supported. Instead, use type 5 (filtered digital) or 8 (unfiltered digital) and use the C parameter to specify the input. Note, if your Z probe is connected to the Z endstop input, on Duet 2 boards that input is by default pre-assigned to be used by the Z endstop, so you must free it up first.
- Only one Type 2 probe can be configured, and if using Duet 3 + expansion or tool boards, it must be connected to the Duet 3 main board.
- The pullup resistor on the Z probe input is not enabled unless you ask for it by prefixing the pin name with the ^ character. Note, BLTouch version 3 and some other types of Z probe need the pullup resistor enabled.
Example 1 - old code:
M558 P4 H5 F120 T3000 ; Z probe connected to E0 endstop input
New code:
M558 P5 C"e0stop" H5 F120 T3000 ; Z probe connected to E0 endstop input
Example 2 - old code:
M558 P7 H5 F120 T3000 ; Z probe connected to Z endstop input
New code:
M574 Z0 P"nil" ; no Z endstop switch, free up Z endstop input M558 P5 C"zstop" H5 F120 T3000 ; Z probe connected to Z endstop input
Example 3 (BLTouch on Duet Maestro) - old code:
M558 P9 H5 F120 T3000 ; BLTouch connected to Z probe IN pin ... M280 P64 S10 ; send control signal to BLTouch through Z probe MOD pin
New code:
M558 P9 C"^zprobe.in" H5 F120 T3000 ; BLTouch connected to Z probe IN pin, free up MOD pin M950 S0 C"zprobe.mod" ; servo/gpio 0 is Z probe MOD pin ... M280 P0 S10 ; send control signal to BLTouch through servo/gpio 0
Example 4 (BLTouch on Duet WiFi) - old code:
M558 P9 H5 F120 T3000 ; BLTouch connected to Z probe IN pin M307 H3 A-1 C-1 D-1 ; free up heater 3 to use as BLTouch servo pin ... M280 P3 S10 I1 ; send control signal to BLTouch through heater 3 pin
New code:
M558 P9 C"^zprobe.in" H5 F120 T3000 ; BLTouch connected to Z probe IN pin M950 S0 C"exp.heater3" ; create servo/gpio 0 on heater 3 pin on expansion connector ... M280 P0 S10 ; send control signal to BLTouch through servo/gpio 0
M563
In order to avoid the serialised object model getting very large, the P parameter (tool number) may not exceed 49.
M571
- The P parameter is now a pin name, not a logical pin number.
Example - old code:
M571 P3 S1.0
New code:
M571 P"heater3" S1.0
M574
- Endstop type S0 (active low switch) is no longer supported in M574 commands. Instead, use type S1 and invert the input by prefixing the pin name with '!'.
- Use a separate M574 command for each axis.
- New parameter P gives the pin name(s) for the endstop(s) for the specified axis. If the number of pins matches the number of motors assigned to that axis, motors will be stopped individually when their endstop switches trigger.
- New endstop type S4 means use motor stall detection (like S3) but if there are multiple motors, stop each one individually as it stalls. S3 means use motor stall detection but as in RRF 2 stop all relevant motors when the first one stalls.
Example - old code:
M574 X1 Y1 Z1 U2 S1 ; active high endstop switches, XYZ at min, U at max
New code:
M574 X1 S1 P"xstop" ; X min active high endstop switch M574 Y1 S1 P"ystop" ; Y min active high endstop switch M574 Z1 S1 P"zstop" ; Z min active high endstop switch M574 U2 S1 P"e0stop" ; U max active high endstop switch
M577
- Instead of using XYZE parameters to specify which endstops to monitor, use the P parameter to specify one or more pin names. The pin(s) do not need to be exclusively used by M577; for example, it is permitted to specify the name of a pin that has already been declared as used by an endstop switch in a M574 command.
- The S parameter is removed. The command waits for a high input level. To wait for a low input level, invert the pin name.
Example - old code:
M577 X E0 S0 ; wait until the X and E0 endstop inputs are both low
New code:
M577 P"!xstop+!e0stop" ; wait until the X and E0 endstop inputs are both low
M581
- Instead of using XYZE parameters to specify which endstops to monitor, use the P parameter to specify one or more pin names. The pin(s) do not need to be exclusively used by M581; for example, it is permitted to specify the name of a pin that has already been declared as used by an endstop switch in a M574 command.
- in RRF 3.01RC1 and earlier M581 did not behave the same way. See the detailed documentation for M581 or (preferably) update your firmware to 3.1.1 or later
Parameters
- P Specify one or more input pin numbers that you created using M950 with the J parameter
- Tnn Logical trigger number to associate the input(s) with, from zero up to a firmware-specific maximum
- S Whether trigger occurs on an inactive-to-active edge of that input (S1, default), active-to-inactive edge (S0), or ignores that input (S-1). By default, all triggers ignore all inputs.
- R Condition: whether to trigger at any time (R0, default) or only when printing a file from SD card (R1). In RRF 3.01-RC2 to 3.01-RC10 inclusive this parameter was C instead of R, but that clashed with a possible C axis.
Example
- M581 P0:3 S1 T2 R1 ; invoke trigger 2 when an inactive-to-active edge is detected on input 0 or input 3 and a file is being printed from SD card
- M581 T2 R-1 ; don't invoke trigger 2 on any input change any more
Notes
- When M581 is executed, if the T parameter is present but the other parameters are omitted, the trigger inputs and edge polarities for that trigger number are reported. Otherwise, the specified inputs and their polarities are added to the conditions that cause that trigger.
- Trigger number 0 causes an emergency stop as if M112 had been received. Trigger number 1 causes the print to be paused as if M25 had been received. Any trigger number # greater than 1 causes the macro file sys/trigger#.g to be executed. Polling for further trigger conditions is suspended until the trigger macro file has been completed. RepRapFirmware does not wait for all queued moves to be completed before executing the macro, so you may wish to use the M400 command at the start of your macro file. If several triggers are pending, the one with the lowest trigger number takes priority.
Example - old code:
M581 E1:2 S1 T2 C1 ; invoke trigger 2 when a rising edge is detected on the E1 or E2 endstop input and a file is being printed from SD card
New code:
M581 P"e0stop+e1stop" T2 C1 ; invoke trigger 2 when a rising edge is detected on the E1 or E2 endstop input and a file is being printed from SD card
M584
M584 works the same way as in RRF2, with exception that on Duet 3 the driver on expansion boards are assigned with <board address>.<driver number>.
e.g
M584 X0 Y1 Z2 E3:4:1.0:1.1
The "0" index for the main board is implicit, this is equivalent to the previous example:
M584 X0.0 Y0.1 Z0.2 E0.3:0.4:1.0:1.1
M585
- You can use M585 to probe until a regular axis endstop is triggered as before.
- The E and L parameters are removed, instead there is a new P parameter that specifies a probe number. If you want to probe until a custom input is triggered, use M558 to configure an additional probe that uses that pin, then refer to that probe in your M585 command.
Example - old code:
M585 X100 F600 E3 L1 S0 ; probe X until E0_stop goes low
New code:
M558 K1 P4 C"!e0_stop" ; create probe #1 for use with M585, active low ... M585 X100 F600 P1 S0 ; probe X until probe #1 is triggered
M591
- The C parameter is now the pin name, not the endstop number.
Example - old code:
M591 P3 C3 S1 ; filament monitor connected to E0_stop
New code:
M591 P3 C"e0_stop" S1 ; filament monitor connected to E0_stop
M670
- The P parameter is removed. Use the new C parameter to specify the pin names to be used.
Example - old code:
M670 T5 P220:221:222
New code:
M670 T5 C"sx1509b.0+sx1509b.1+sx1509b.2"
M997
On Duet 3 only this command takes an optional B (board number) parameter which is the CAN address of the board to be updated, default 0 (i.e. main board).
M999
On Duet 3 only this command takes an optional B (board number) parameter which is the CAN address of the board that you want to reset, default 0 (i.e. main board).
New commands
M308: Create or modify sensor, or report sensor parameters
This command creates a sensor, or modifies an existing sensor, or reports the parameters of an existing sensor. It replaces the M305 command of RepRapFirmware 2.
In earlier versions of RepRapFirmware, sensors only existed in combination with heaters, which necessitated the concept of a "virtual heater" to represent a sensor with no associated heater (e.g. MCU temperature sensor). RepRapFirmware 3 allows sensors to be defined independently of heaters. The association between heaters and sensors is defined using M950.
Many of the parameters to M308 are the same as for the old M305 command, however there are some significant differences:
- The X (sensor channel) parameter is replaced by the sensor type name (Y parameter) and port name (P parameter);
- [in builds dated 2019-07-23 and later] The thermocouple type (a single-character string) is parameter K instead of T
- [in builds dated 2019-07-23 and later] The low and high limits of a Linear Analog sensor are defined by parameters B and C instead of L and H
M308 can be used in the following ways:
M308 Snn Y"type" [other parameters] ; delete sensor nn if it exists, create a new one with default settings, and configure it using the other parameters. At least the pin name must also be provided, unless the sensor doesn't use a pin (e.g. MCU temperature sensor).
M308 Snn ; report the settings of sensor nn
M308 A"name" ; report the settings of the first sensor named "name"
M308 Snn [any other parameters except Y] ; amend the settings of sensor nn. On Duet 3, this form may not be used to move the sensor port from one board to another.
Common Parameters
Sn
Sensor number. For each sensor you create, choose a unique number in the range 0 to the maximum permitted value (currently 63 on Duet3 and 31 on Duet 2). For sensors that control heaters, we suggest you choose the sensor number to be the same as the heater number that it controls.
P"pin_name"
The name of the control board pin that this sensor uses. For thermistors it is the thermistor input pin name. For sensors connected to the SPI bus it is the name of the output pin used as the chip select.
Y"sensor_type"
The sensor and interface type. Valid values are:
- thermistor
- pt1000
- rtd-max31865
- thermocouple-max31855
- thermocouple-max31856
- linear-analog
- dht11
- dht21
- dht22
- dht-humidity
- current-loop-pyro
- mcu-temp
- drivers
- drivers-duex
Sensor type names obey the same rules as pin names, i.e. case is not significant, neither are hyphen and underscore characters.
A"name"
Sensor name (optional), displayed in the web interface
Additional parameters for thermistors
Tnnn
Thermistor resistance at 25C
Bnnn
Beta value, or the reciprocal of the Steinhart-Hart thermistor model B coefficient
Cnnn
Steinhart-Hart C coefficient, default 0
Rnnn
Series resistor value
Lnnn
ADC low offset correction, default 0 (ignored if the hardware supports automatic ADC gain and offset calibration)
Hnnn
ADC high offset correction, default 0 (ignored if the hardware supports automatic ADC gain and offset calibration)
Additional parameters for PT1000 sensors
Rnnn
Series resistor value
Lnnn
ADC low offset correction, default 0 (ignored if the hardware supports automatic ADC gain and offset calibration)
Hnnn
ADC high offset correction, default 0 (ignored if the hardware supports automatic ADC gain and offset calibration)
Additional parameters for MAX31856-based thermocouple sensors
K"c"
The thermistor type letter, default K. [In builds prior to 2019-07-23 this parameter was T instead of K.]
Fnn
(where nn is 50 or 60) The local mains frequency. Readings will be timed to optimise rejection of interference at this frequency.
Additional parameters for MAX31865-based PT100 sensors
Rnnn
Series resistor value
Fnn
(where nn is 50 or 60) The local mains frequency. Readings will be timed to optimise rejection of interference at this frequency.
Wn
Number of wires, only needed when using 3-wire sensors with third-party MAX31865 boards
Additional parameters for linear analog sensors
Fn
F0 = unfiltered (fast response), F1 = filtered (slower response, but noise reduced and ADC oversampling used to increase resolution)
Bnnn
The temperature or other value when the ADC output is zero. [In builds prior to 2019-07-23 this parameter was L instead of B.]
Cnnn
The temperature or other value when the ADC output is full scale. [In builds prior to 2019-07-23 this parameter was H instead of C.]
Examples
;Duet 2 M308 S0 P"bed_temp" Y"thermistor" T100000 B3950 ; define bed temperature sensor M308 S1 P"e0_temp" Y"thermistor" T100000 B4725 C7.06e-8 ; define E0 temperature sensor ;Duet 3 M308 S2 P"spi.cs0" Y"thermocouple-max31856" K"J"; define temperature sensor number 2 as a J Type thermocouple on the first port of a temperature daugher board plugged into the main board. M308 S3 P"3.spi.cs1" Y" rtd-max31865" ; define temperature sensor number 3 as a PT100 on the first port of a temperature daugher board plugged into the expansion board with CAN bus address 3.
M950: Create heater, fan, or GPIO/servo port
M950 is used to create heaters, fans and GPIO ports and to assign pins to them. Each M950 command assigns a pin or pins to a single device. So every M950 command must have exactly one of the H, F, J, P or S parameters.
If a M950 command has C and/or Q parameters, then the pin allocation and/or frequency will be configured accordingly. Otherwise, the current configuration will be reported.
Parameters:
- Hnn Heater number
- Fnn Fan number
- Jnn Input pin number (RRF 3.01RC2 and later only)
- Pnn or Snn Output/servo pin number (the only difference is the default PWM frequency)
- C"name" Pin name(s) and optional inversion status. Pin name "nil" frees up the pin. A leading '!' character inverts the input or output. A leading '^' character enables the pullup resistor. The '^' and '!' characters may be placed in either order.
- Qnn PWM frequency in Hz (optional)
- T Temperature sensor number, required only when creating a heater. See M308.
Order dependency
- When M950 is used to create a heater, the M950 command must come later in config.g than the M308 command that creates the sensor referred to in the T parameter
- M950 must come before any commands that refer to the device being created. For example, when M950 is used to create a heater, it must be earlier than the M307 command used to set the heater parameters, and earlier than any M563 commands that create tools that use that heater. When M950 is used to create a fan, it must come earlier than any M106 commands relating to that fan.
Examples:
M950 H1 C"out1" Q100 T1 ; create heater 1 M950 H2 C"nil" ; disable heater 2 and free up the associated pin M950 F3 C"heater2" Q100 ; Fan 3 is connected to heater 2 pin, PWM at 100Hz M950 P0 C"exp.heater3" ; create output/servo port 0 attached to heater 3 pin on expansion connector M950 F2 C"!fan2+^pb6" ; Fan 2 uses the Fan2 output, but we are using a PWM fan so the output needs to be inverted, also we are using PB6 as a tacho input with pullup resistor enabled M950 J1 C"!^e1stop" ; Input 1 uses e1Stop pin, inverted, pullup enabled
Pin names
Pin name format
A pin name is a string of characters enclosed in double quotation marks. It is not case sensitive. All instances of _ and - characters are stripped from pin names before comparing them.
Example:
BED_HEAT bedheat
These two names refer to the same pin because of the comparison rules.
Some pin names have the form "connector.pin" or "board.pin" where connector or board identifies the connector on the Duet or the expansion board, and pin identifies the pin within that connector or on that expansion board. Sometimes a pin has multiple names.
Example:
exp.heater3 exp.8 duex.e2_heat duex.pwm1
These four all refer to the heater3 pin, either on the expansion connector (where it is pin #8 of 50) or on the heater output terminal block of a DueX2 or DueX5. However, there is a difference. The DueX boards buffer and invert the signal. Therefore, when you use one of the forms prefixed with duex the firmware knows it has to invert the signal, but it doesn't invert it if you use one of the other forms. In contrast, when you referred to logical pin 3 in previous versions of RRF, the firmware always inverted the signal - so if you were driving a servo or BLTouch from this pin you would have needed to use the I1 parameter in your M280 command.
You may occasionally need to invert sense of a pin - for example, if you use a fan output to control the PWM input of a 4-wire fan instead of using it to switch the ground supply. You can indicate inversion by prefixing the pin name with exclamation mark.
Example:
!fan2
This means the pin labelled FAN2 on the Duet, but with the drive signal inverted.
When declaring an input pin (e.g. in the M574 command), a '^' character before the name indicates that the pullup resistor should be enabled. Otherwise it is not enabled.
Example:
!^e1stop
Some GCode commands accept more than one pin name. For example, the M453 command allows you to specify both forward and reverse spindle ports, the M574 command allows you to specify multiple endstop switches per axis, and the M558 command allows you to specify both input and output pins for the Z probe. You can use the + character to indicate multiple pins.
Example:
z_stop+e0_stop+e1_stop
Note, if you provide more pin names than the command accepts, the extra ones are likely to be ignored.
Pin names for Duet 3
Duet 3 uses pin name format "expansion-board-address.pin-name" to identify pins on expansion board, where expansion-board-address is the numeric address of the board as set on the address switches. A pin name that does not start with a sequence of decimal digits followed by a period, or that starts with "0." refers to a pin on the Duet 3 main board.
Duet 3 MB6HC pin names
The wiring Diagram for the Duet 3 Mainboard 6HC is here:
Duet 3 Mainboard 6HC Wiring Diagram
out0, bedheat
out1
out2
out3
out4
out5
out6
out7
out8
out9,laser,vfd
out4.tach
out5.tach
out6.tach
io0.in
io1.in
io2.in
io3.in
io4.in
io5.in
io6.in
io7.in
io8.in
io0.out
io1.out
io2.out
io3.out
io4.out
io5.out
io6.out
io7.out
io8.out
servo, out10 (only on v0.5, not on v0.6)
pson
spi.cs0
spi.cs1
spi.cs2
spi.cs3
temp0
temp1
temp2
temp3
Duet 3 Mini 5+ pin names
The wiring Diagram for the Duet 3 Mini 5+ is here:
out0
out1
out2
out3
out4
out5
out6
out3.tach
out4.tach
io0.in
io1.in
io2.in
io3.in
io4.in
io5.in
io6.in
io0.out
io1.out
io2.out
io3.out
io4.out
spi.cs0
spi.cs1
spi.cs2
spi.cs3
temp0
temp1
temp2
Duet 3 EXP3HC pin names
The wiring Diagram for the Duet 3 Expansion 3HC is here:
Duet 3 Expansion 3HC Wiring Diagram
out0
out1
out2
out3
out4
out5
out6
out7
out8
out3.tach
out4.tach
out5.tach
io0.in
io1.in
io2.in
io3.in
io4.in
io5.in
io0.out
io1.out
io2.out
io3.out
io4.out
io5.out
spi.cs0
spi.cs1
spi.cs2
spi.cs3
temp0
temp1
temp2
Duet 3 Tool Board 1LC pin names
The wiring diagram for the Duet 3 Tool Board 1LC is here:
out0
out1
out1.tach
out2
out2.tach
io0.out
io0.in
io1.in
io2.in
io3.in (v1.1 only)
temp0
temp1
button0
button1
Duet 3 Expansion 1XD pin names
out0
out1
io0.in
io0.out
io1.in
io2.in
io2.out2 (v0.4 board only)
io2.out (v1.0 and later board)
temp0
Pin names for Duet 2 WiFi/Ethernet
Multiple names on a line are aliases for a single pin. Some pins (primarily heater pins) have an inversion between the processor and the corresponding output, RRF3 will automatically allow for this inversion. These pins are marked with a * after the pin name in the list below. For legacy reasons some Duex pins are inverted or not, depending on the name/alias used to access them. This is indicated with a ! in front of the pin name in the sable below. e.g. exp.heater3 is the same pin as !duex.e2heat the ! indicates that the logic of the pin is inverted when referred to as "duex.e2heat"
The Duet 2 Wiring Diagram is here:
Duet 2 WiFi/Ethernet Wiring Diagrams
The Duex wiring diagram is here:
The connectors on the Duet 2 and Duex wiring diagram are labelled in a manner similar, but not the same as the RepRapFirmware 3.x pin name format (for legacy reasons):
fan2 -> FAN2- etc
ystop -> Y endstop switch, low end, active high
zprobe.in+zprobe.mod -> Z_PROBE_IN and ZPROBE_MOD
exp.heater5 - > HEATER5
For example, if you need to free up the fan 0 pins, use:
M950 F0 C"nil" ; disable fan 0 and free up the associated pin
Or to free up an endstop, send:
M574 X0 P”nil”
Duet 2 and DueX heater outputs
bedheat *
e0heat *
e1heat *
exp.heater3, exp.8, !duex.e2heat, !duex.pwm1
exp.heater4, exp.13, !duex.e3heat, !duex.pwm2
exp.heater5, exp.18, !duex.e4heat, !duex.pwm3
exp.heater6, exp.23, !duex.e5heat, !duex.pwm4
exp.heater7, exp.31, !duex.e6heat, !duex.pwm5
Duet 2 and DueX temperature inputs
bedtemp
e0temp
e1temp
e2temp, duex.e2temp, exp.thermistor3, exp.35
e3temp, duex.e3temp, exp.thermistor4, exp.36
e4temp, duex.e4temp, exp.thermistor5, exp.37
e5temp, duex.e5temp, exp.thermistor6, exp.38
e6temp, duex.e6temp, exp.thermistor7, exp.39
Duet 2 and DueX fan outputs
Note: the duex.fan pins cannot be used to control a laser.
fan0
fan1
fan2
duex.fan3
duex.fan4
duex.fan5
duex.fan6
duex.fan7
duex.fan8
Endstop inputs
xstop
ystop
zstop
e0stop
e1stop
exp.e2stop, exp.4
exp.e3stop, exp.9, duex.cs6
exp.e4stop, exp.14, duex.cs7
exp.e5stop, exp.19, duex.cs8
exp.e6stop, exp.24
duex.e2stop
duex.e3stop
duex.e4stop
duex.e5stop
duex.e6stop
Misc
Note: the duex.gp pins cannot be used to control a laser.
zprobe.in
zprobe.mod
duex.cs5
connlcd.encb, connlcd.3
connlcd.enca, connlcd.4
connsd.encsw, connsd.7
exp.pb6, exp.29, duex.pb6
duex.gp1
duex.gp2
duex.gp3
duex.gp4
SPI CS
spi.cs1
spi.cs2
spi.cs3
spi.cs4
spi.cs5, duex.cs5, exp.50
spi.cs6, duex.cs6, exp.9
spi.cs7, duex.cs7, exp.14
spi.cs8, duex.cs8, exp.19
Pins on additional SX1509B expander
See the page on Adding additional output ports for more details. These pins cannot be used to control a laser.
sx1509b.0
sx1509b.1
sx1509b.2
sx1509b.3
sx1509b.4
sx1509b.5
sx1509b.6
sx1509b.7
sx1509b.8
sx1509b.9
sx1509b.10
sx1509b.11
sx1509b.12
sx1509b.13
sx1509b.14
sx1509b.15
Pin names for Duet 2 Maestro
Some pins (primarily heater pins) have an inversion between the processor and the corresponding output, RRF3 will automatically allow for this inversion. These pins are marked with a * after the pin name in the list below.
bedheat *
e0heat *
e1heat *
fan0
fan1
fan2
xstop
ystop
zstop
e0stop
e1stop
zprobe.in (this can be used with smarteffector)
zprobe.mod, servo
bedtemp
e0temp
e1temp
ctemp
pson
exp.pa21
exp.pa22
exp.pa3
exp.pa4
spi.cs1
spi.cs2
19 Comments
hi my opinion, it is that making these code changes is not a good thing, you make things so heavy and stressful. a firmware should give improvements and that's it without having to intervene later personally. it's very daunting ...
Massimiliano Conti - Reply
The configuration GCodes in RRF2 were not flexible enough to handle Duet 3. We also had RRF2 users complaining about the lack of flexibility in allocating pins to external devices. The changes we made in RRF3 address both of these issues.
David Crocker -
Right at the top should be brief explanation of GPIO and how it’s at the core of RRF3, like this:
“GPIO (General-Purpose Input/Output) is an digital signal pin on a circuit board or processor that can act as an Input or Output, as controlled by the Firmware. GPOUT = output, GPIN = input.
RRF3 uses these programmable pins to allow much greater flexibility and enhanced expansion for the future. The configuration files must define the uses of these pins first, then their assignments.”
I constantly see the unwarranted assumption that a Duet purchaser is always an Engineer or digital Electronics Tech.
A standard in Technical Writing is that specialized terms are defined before they’re used, or a brief description at the first use.
Failure to do this overwhelms people, drives them away from a fantastic product line and overloads the Forum with confused people.
Fixing this “define the terms at start” will reduce Forum support issues, and lost sales from confusion.
Feel free to reword, but KISS :-) BTW - RRF3 ROCKS!
PuterPro - Reply
thanks for the feedback, and good point!
Tony -
My quick 2 cents as a beginner, the RepRapFirmware versioning is depicted differently in different places. The GitHub Releases page is refering to it as “3.01-RC11 “, whereas on the Machine-Specific page on the web interface refers to it as “Firmware: RepRapFirmware for Duet 3 MB6HC vo.6 or 1.0 3.0 (2020-01-03b3)”. For a noob, it is hard to rectify what I am suppose to be comparing to make sure I am up to date.
Sevil Natas - Reply