How to configure the Duet3D
This "How to" is dedicated to the configuration of the Duet3D controller family (WiFi, Ethernet, Maestro)
Or any other RRF compatible controller board (i.e. SKR-2, SKR E3 RRF)
Or any other RRF compatible controller board (i.e. SKR-2, SKR E3 RRF)
IMPORTANT:
If you're going to use the SMuFF with a Duet3D controller board (or any other RRF based controller board in that matter), please make sure you have compiled the SMuFF firmware using the according xxx__DUET or xxx__DDE+DUET build environment for your controller board. If you haven't, the handshake shown below will not work!
ALSO:
If you're facing issues connecting to the Duet/RRF controller board (i.e. SMuFF doesn't react to the tool change commands sent) via the serial interface, here's a solution for you.
My Duet3D is configured so that the E0 stepper motor is the main extruder. I've connected the extruder stepper driver of the Duet3D (E0 terminal) to the external Feeder input of the SMuFF. The SMuFF is responsible for the tool changes, whereas the Duet handles the Feeder during the printing process (this will work only using the Shared-Stepper option).
Because there's some handshake needed in order for the SMuFF to tell the Duet3D when a tool change operation has completed, I'm using the E1 endstop on the Duet, which needs to be defined in the config.g as follows (pick commands depending on the RRF version you have installed on the Duet, it's either 2.x or > 3.1):
M575 P1 B115200 ; set baudrate for PanelDue serial port (enabled by default in 2.x)
...
M574 S1 E1 ; define end stop for SMuFF on Duet3D FW 2.x
M575 P1 B115200 ; set baudrate for PanelDue serial port (and enable it)
...
M950 J1 C"e1stop" ; define end stop for SMuFF on Duet3D FW 3.1 and newer
M950 J1 C"PWRDET" ; define end stop for SMuFF on E3-RRF (see wiring scheme below for explanation)
To make this work, you'll need an extra wire which connects the THB (bed thermistor signal) on the SMuFF controller with the E1STOP endstop signal on the Duet3D controller board (see picture below).
Here's a picture of the wiring scheme. It's assumed that the main extruder is connected to E0MOT and the endstop for E1 is not being used.
Although this image shows a Duet2 WiFi controller, the wiring scheme is the same for all Duet3D controller boards.
Please keep in mind that 3rd party controller boards, such as the SKR-2 or SKR E3 RRF may have different layouts/labels but since they're running RRF firmware, the wiring scheme stays the same.
Also, you only need to wire up one GND signal (preferably the one on the PanelDue header). Never wire any supply pins (VCC, 5V, 3.3V) to the SMuFF!
This configuration works best if you don't use a PanelDue. If you do, you have to either get rid of the PanelDue or relocate the PanelDue and connect it to one of the serial ports on the SMuFF directly. Keep in mind that the number of (free) serial ports on the SMuFF depends on the controller board you're using!
The SMuFF will pass any non tool change related commands to the PanelDue and route commands from the PanelDue back to the Duet.
Here's the same wiring scheme for the Bigtreetech SKR-2 running RepRap Firmware (RRF).
As stated above, labels and locations differ but they serve the same purpose.
Please notice: E1STOP is labeled E1DET on this board, though the firmware handles it as e1stop, so the M950 command shown above is still valid.
And here's is the wiring scheme for the Bigtreetech E3-RRF.
Attention: Since this board doesn't have a 2nd extruder, there's also no E1STOP header and the handshake has to be routed to the PWR-DET pin instead, as shown in the picture!
Thus, the pin name used in the M950 J1 command needs to be set to C"PWRDET", to function properly.
Please notice: For any other board out there supporting RRF, always keep in mind that you'll need the 3 connections shown above. The extruder motor isn't supposed to be a problem at all, since all boards have one. The serial connection (which eventually talks to the SMuFF) also is supposed to be available on every board. Lastly, the additional signal (a.k.a. Busy signal) which goes to the E1STOP of the original Duet might not be available everywhere (usually only on boards supporting two Extruders). What you have to do in order to make that work is to pick up a free signal pin on the board (digital input, TTL level) and configure that to be J1 for RRF using the M950 GCode command, similar as shown for the E3-RRF board above.
Since all new boards are powered by the RRF port of Team Gloomy, it's worth checking out the pin assignments on their website.
Since the Duet boards by default define only one tool, I added the tool definitions according to the number of tools the SMuFF is equipped with:
M563 P0 D0 H1 S"SMuFF-0" ; Define tool 0
G10 P0 X0 Y0 Z0.0 R0 S0 ; Set axes offsets and the initial active and
; standby temperatures for this tool
M563 P1 D0 H1 S"SMuFF-1" ; Define tool 1
G10 P1 X0 Y0 Z0.0 R0 S0 ; same as above
M563 P2 D0 H1 S"SMuFF-2" ; Define tool 2
G10 P2 X0 Y0 Z0.0 R0 S0 ; same as above
M563 P3 D0 H1 S"SMuFF-3" ; Define tool 3
G10 P3 X0 Y0 Z0.0 R0 S0 ; same as above
M563 P4 D0 H1 S"SMuFF-4" ; Define tool 4
G10 P4 X0 Y0 Z0.0 R0 S0 ; same as above
I've named my tools SMuFF-0..4 but notice that the name can be whatever you fancy.
Duet3D macros
Here are now the tool changing macros used on the Duet3D. Please keep in mind, tfreeX.g, tpreX.g and tpostX.g are RepRap system macros. The X stands for the tool number, hence you'll need one such set of macros per tool (the default configuration has only macros for tool 0).
For a better understanding which script does what, I've added this graph of the script workflow on the right.
All commands sent to the SMuFF are using the M118 (display message) GCode with parameter P2, which addresses the PanelDue serial port. The very first sequence in this string "\s" is needed for the SMuFF-Ifc but can be omitted if you're directly connected to the SMuFF via TTL-Serial.
All GCodes sent to the SMuFF must end with a "\n" (that's two characters), otherwise the SMuFF won't recognize the GCode command (although, it seems this is only an issue on RRF 2.x).
Please keep in mind that all macros shown here must be kept in the /sys/ folder of the Duet3D and also watch out for the Duet firmware 2.x / >3.1 differences.
/sys/tfree0.g
/sys/tfree1.g
...
/sys/tfreeN.g
;------------------------------------------
; tool change using SMuFF FW 2.25
;------------------------------------------
M98 P"/sys/toolchange.g"
/sys/tpre0.g
/sys/tpre1.g
...
/sys/tpreN.g
;------------------------------------------
; tool change using SMuFF FW 2.25
;------------------------------------------
M118 S"Sending T0 to SMuFF" ; print info to console
M118 P2 S"\sT0S1\n" ; send 'T0' command with automatic load
M98 P"/sys/toolload.g" ; wait for SMuFF to complete
Keep in mind: In each macro, the tool change command that's being sent to the SMuFF in M118 P2 must be set up according to the script name, i.e. "...T0...", "...T1...", "...T2..." and so on.
For example, in tpre2.g replace all appearances of T0 by T2, in tpre3.g all T0 by T3 in the script shown above.
/sys/tpost0.g
/sys/tpost1.g
...
/sys/tpostN.g
;------------------------------------------
; tool change using SMuFF FW 2.25
;------------------------------------------
M98 P"/sys/toolpurge.g"
/sys/toolchange.g
M83 ; set extruder to relative mode (important)
G60 S0 ; store current position
G1 E-5 F12000 ; retract 5mm fast to avoid oozing
G91 ; switch to relative positioning
G1 Z15 F8000 ; lift nozzle
G90 ; switch back to absolute positioning
;--------------------------------------------------------------------------------------
; If you're not using the Filament-Cutter, you may use some tip-shaping, also known
; as Ramming, GCodes at this point.
;--------------------------------------------------------------------------------------
; insert your favorite Ramming sequence here (i.e. Marlin Ramming Sequence):
;M83 ; set extruder to relative mode (important!)
;G1 E1 F1000
;G1 E1 F1500
;G1 E2 F2000
;G1 E1.5 F2500
;G1 E2.5 F3000
;G1 E-15 F4000
;G1 E-14 F1200
;G1 E-6 F600
;G1 E10 F700
;G1 E-10 F400
;G1 E-50 F2000
;--------------------------------------------------------------------------------------
; Move to a position outside the bed for changing the tool and purging later on.
; You have to modify this lines according to your printer / environment.
;--------------------------------------------------------------------------------------
M564 S0 ; unlimit axes
G1 X-25 Y160 F15000 ; move to change position
M98 P"/sys/toolunload.g" ; call the macro for unloading filament
Please notice: The "Ramming Sequence" example shown above is not needed if you're using a Filament Cutter, which is the method I'd highly recommend. In such case, leave those lines out. If you're not using a Filament Cutter, make sure you remove the leading ";" in front of all G1 commands. You'll also need to "tune in" the ramming sequence to match your printer/filament, which can be a tedious process.
Also: Please adopt the "G1 X-25 Y160..." above to meet your printers capabilities. Pick a nozzle position (X,Y) outside the bed if possible.
/sys/toolunload.g
;------------------------------------------
; unloading filament using SMuFF FW 2.25
;------------------------------------------
M18 E ; turn off motor (IMPORTANT!) (FW 2.x)
M18 E0 ; turn off motor (IMPORTANT!) (FW >3.1)
G4 P500 ; wait for motor to turn off
M118 S"Sending unload command to SMuFF" ; print info to console
M118 P2 S"\sM701\n" ; send 'M701' command for unloading
G4 S1 ; wait for the SMuFF to process
M118 S"Waiting for SMuFF to finish" ; print info
M577 E1 S0 ; wait for the signal from SMuFF (FW 2.x)
M577 P1 S0 ; wait for the signal from SMuFF (FW >3.1)
M118 S"SMuFF has finished unloading" ; print info
/sys/toolload.g
;----------------------------------------------
; loading filament using SMuFF FW 2.25
;----------------------------------------------
G4 S2 ; wait for the SMuFF to process
M118 S"Waiting for SMuFF to finish loading" ; print info to console
M577 E1 S0 ; wait for the signal from SMuFF (FW 2.x)
M577 P1 S0 ; wait for the signal from SMuFF (FW >3.1)
M118 S"SMuFF has finished loading" ; print info to console
G4 S1 ; pause 1s
/sys/toolpurge.g
M118 S"Purging after tool change" ; print info to console
M17 E0 ; turn motor back on (IMPORTANT!) (FW >3.1)
M83 ; set extruder to relative mode
M116 H1 S3 ; wait for extruder to reach temperature
G1 E100 F240 ; purge out old filament
M400 ; wait for move to finish
G4 S3 ; pause 3s, wait for oozing
M98 P"/sys/toolclean.g" ; clean nozzle (if Wiper is installed)
G0 X9 F5000 ; move over the bed
M564 S1 ; limit axes again
G0 R0 F2000 ; restore position for printing
Keep in mind: The content of this script is not needed if you have configured the SMuFF to do the purge after a tool change automatically. In such case, simply leave this macro empty (which will also cause the next macro not to be called/executed).
/sys/toolclean.g
M118 P2 S"\sG12\n" ; initiate "Servo wipe" command on SMuFF
G4 P3500 ; wait for wipe to finish
You can download the "toolxxx.g" macros shown above from here.
Mandatory settings on SMuFF
In order to make the SMuFF work correctly with the Duet/RRF, you'll need to enable the "Is Shared" option in menu Steppers/Servo -> Feeder and also the "External Ctrl." option. Set both options to "Yes". Keep in mind: The "Is Shared" option requires using the relay board (which you should always have, regardless of the printers controller).
In SMuFF-WebInterface those options are located under Settings->General "Use Shared Stepper" and Settings->Feeder "External Control".
Troubleshooting
In order to check whether the communication to the SMuFF works correctly, you can do the following:
Key in the command sequence M118 P2 S"\sM300 S880 P1000\n" into the DWC console. The SMuFF is supposed to beep for 1 second.
short Signal and +3.3V pins on E1STOP then enter M557 E1 S0 (FW 2.x) or M557 P1 S0 (FW >3.1) into the DWC console. DWC / Duet will sit and wait until the +3.3V is removed from the E1STOP signal, in which case the log will display the command entered.
If the first command fails (i.e. no beep), make sure you have wired the serial connection correctly, especially that RX and TX signals are swapped. Also, make sure the PanelDue serial port is initiated correctly (check presence of M575 GCode in your config.g).
If the second sequence fails (i.e. no response in log), make sure you've set up the pin definition correctly (M950 J1 GCode in your config.g). The latter applies only to RRF > 2.x.
If both checks above worked correctly, key in Tx (x = tool 1..5) in DWC console and the SMuFF is supposed to swap the current tool. Before you do that, make sure the hotend has been heated to temperature or allow "cold extrudes" (M302 P1), otherwise a tool change will fail.
Pitfalls
Whenever you reset or power cycle your printer (Duet/RRF), it will reset the current tool. If you enter T in DWC console, it'll return -1 which means "no tool selected". The SMuFF on the other hand will store the latest selected tool on its SD-Card and restore it after a reset or power cycle. Hence, Duet/RRF and SMuFF are out of sync in regard of the tool selected.
To overcome this issue, go to the DWC console after a reset/power cycle and key in the current tool selected on the SMuFF (i.e. T4) before you home the axes of your printer the first time. This will set the active tool on Duet/RRF without processing the tool change scripts mentioned above and both devices are synced again.