Duet Wifi independent dual X & Y Axis + Endstops configuration

Hi Ian,
While I am reading through these config files I have some questions about what you are intending to accomplish. What type Board are you using? Maestro? Duet WiFi 2? etc.? It would help to check the board specs against what you are trying to enable. Also what type of endstops are you using? Wired switches? Sensorless (Crash detection)? Optical? Proximity?

That will help me/us to know what the problem might be.

Hi, Sorry I didn’t give the complete info… I have a Duet2 wifi board with PanelDue. The endstops are normal microswitches at the low end of the axes which are 650 and 600mm long (X&Y) with a Z of 200mm without endstop. The machine is a self made MPCNC , printed parts with 25mm steel tube frame and a trim router for the spindle. At the moment it’s running grbl on a Ramps 1.4 board but I wanted to upgrade it and use this Duet board with the 2 motors per axis homing individualy to square the axes if they get out of sync. Thanks.

1 Like

Thanks,
Like you said having the Config file split up into several files is a bit confusing. I am tempted to replace all the “M98” calls with the GCode from the smaller files so I can read them all in order that they execute. Because some of the initial setup GCode commands are sensitive to order of operations. For example: M584 must come before M574. And even if you do that correctly and then M584 gets used again then it act as though M574 was never configured.

Ok at the moment I am focusing on this section of your config file.

M584 X0:4 Y1:3 Z2 ; Apply drive mapping to axes <–Called first that is good

;Configure Endstops

M574 X1 S1 C0
M574 Y1 S1 C1
M574 Z0
M574 U1 S1 C4
M574 V1 S1 C3

I don’t know what you are trying to accomplish with C parameters. I don’t see it in the old or [new]( GCode dictionary | Duet3D Documentation) documentation pages. I assume you are attempting to define what pins on the board the endstops will use. Am I correct?

By the way. Using switches instead of sensorless homing makes this a lot easier and more reliable.

Using this page as reference for the names of the pins
And using this comment from the M574 documentation,

"To use two Z motors using independent homing switches, declare two Z motors in M584, then declare two pins for Z endstops in a single M574 command. Example

M584 X0 Y1 Z2:3 E4
M574 Z1 S1 P"io2.in+io3.in" ; Z axis with two motors, individual min endstops"

I think your config GCode should look like this…

M584 X0:4 Y1:3 Z2 ; Apply drive mapping to axes aka use two motors for X and for Y
M574 X1 S1 P"xstop+e0stop" ; X axes with two motors and individual min endstops
M574 Y1 S1 P"ystop+e1stop" ; Y axes with two motors and individual min endstops
M574 Z1 S0 ;Z axes with NO endstop just use current position as Home

Hi Ian,
I do see that M584 and M574 are getting called twice each in your files.

M98 P"config-axes.g"
Inside of that file the Axes are defined using M584

M98 P"config-axes-endstops.g"
Inside of that file the endstops are defined using M574

Then your main config.g file calls both M584 and M574 again near the end. I would suggest moving my suggested changes into the sub program files just so order of operations is maintained.

Thanks Aaryn, First, the ‘C’ parameters I got from another forum I went on where a chap called Mike Lincoln said… “When remapping endstops the C parameter names the drive number as per the pictures on the duet3d website.”
The M584 and M574 calls in the config.g file are only there because, when I couldn’t get other things to work I though it might be because they needed calling before the sub folders were addressed. Now i see I would have been wrong anyway as they are too far down the file for that… I’ll try your suggestion in a few minutes and see if it solves things…

With the 3.3 firmware, there’s no need to define the U and V axes. Keep in min that certain things must happen in order. M584 has to be fairly early in the config.

Here’s my running config.g:

; Configuration file for Duet WiFi (firmware version 3)
; executed by the firmware on start-up
;
; generated by RepRapFirmware Configuration Tool v3.2.3 on Tue Apr 20 2021 01:19:12 GMT-0600 (Mountain Daylight Time)
; Monkeyed with by SupraGuy because obviously I know better than the configuration tool, lol!

; General preferences
G90                                             ; send absolute coordinates...
M83                                             ; ...but relative extruder moves
M550 P"MPCNC Primo"                             ; set printer name

; Network
M552 S1                                         ; enable network
M586 P0 S1                                      ; enable HTTP
M586 P1 S0                                      ; disable FTP
M586 P2 S0                                      ; disable Telnet

; Drives
M669 K0                                         ; set Cartesian kinematics
M569 P0 S0                                      ; physical drive 0 goes backwards
M569 P1 S1                                      ; physical drive 1 goes forwards
M569 P2 S1                                      ; physical drive 2 goes forwards
M569 P3 S0                                      ; physical drive 3 goes backwards
M569 P4 S1                                      ; physical drive 4 goes forwards
M584 X0:3 Y1:4 Z2                               ; set drive mapping: X on drives 0 and 3, Y on 1 and 4, Z on 2
M350 X16 Y16 Z16 I1                             ; configure microstepping with interpolation
M92 X100.00 Y100.00 Z400.00                     ; set steps per mm
M566 X900.00 Y900.00 Z60.00                     ; set maximum instantaneous speed changes (mm/min)
M203 X3000.0 Y3000.0 Z180.00                    ; set maximum speeds (mm/min) 5 centimeters per second, lol
M201 X250.00 Y250.00 Z20.00                     ; set accelerations (mm/s^2)
M906 X1200 Y1200 Z1200 I75                      ; set motor currents (mA) and motor idle factor in per cent
M84 S30                                         ; Set idle timeout

; Axis Limits
M208 X0 Y0 Z-12.5 S1                            ; set axis minima
M208 X635 Y940 Z90 S0                           ; set axis maxima

; Endstops
M574 X1 S1 P"^xstop+^e0stop"                    ; configure active-high endstop for low end on X via pin ^xstop+^e0stop
M574 Y1 S1 P"^ystop+^e1stop"                    ; configure active-high endstop for low end on Y via pin ^ystop+^e1stop

; Z-Probe
M558 P5 C"!^zprobe.in" H5 F120 T6000            ; set Z probe type to switch and the dive height + speeds
G31 P850 X0 Y0 Z0.5                             ; set Z probe trigger value, offset and trigger height
M557 X15:615 Y15:915 S100                       ; define mesh grid

; Heaters
M140 H-1                                        ; disable heated bed (overrides default heater mapping)
M308 S2 Y"drivers" A"DRIVERS"                   ; configure sensor 2 as temperature warning and overheat flags on the TMC2660 on Duet
M308 S3 Y"mcu-temp" A"MCU"                      ; configure sensor 3 as thermistor on pin e1temp for left stepper

; Fans
M950 F0 C"fan0" Q500                            ; create fan 0 on pin fan0 and set its frequency
M106 P0 S0 H-1                                  ; set fan 0 value. Thermostatic control is turned off
M950 F1 C"fan1" Q500                            ; create fan 1 on pin fan1 and set its frequency
M106 P1 S1 H T45                                ; set fan 1 value. Thermostatic control is turned on
M950 F2 C"fan2" Q500                            ; create fan 2 on pin fan2 and set its frequency
M106 P2 H2:3 L0.15 X1 B0.3 T25:60               ; set fan 2 value. Thermostatic control is turned on

; Tools
M563 P0 S"Router" R0                            ; Define the router as tool 0
M453                                            ; Set CNC Mode

; Custom settings are not defined
M575 P1 S1 B57600                               ; Enable PanelDUE
G54                                             ; Select Workspace Coordinate 1

So you’ll see my M584 only defines X, Y and Z. (My LowRider does define U and V as well, so that I can independently jog the Y2 and Z2 motors after homing. That config file is still ugly because I’m working on other stuff. For the Primo, it was easy to adjust the machine stops to be square, so there was no need.

I also set axis limits, so that the machine does not try to move out of the space I defined. The Z limit of -12.5 is temporary, I usually have it set to -2.5 because that’s as far as I want the tool to dig into the spoilboard, and it keeps those limits in absolute position, regardless of work coordinates.

Setting the endstops with the + sign works fine, you just have to make sure you define them in the same order that you defined the drives earlier.

Those pseudo “heaters” are set up so that I can monitor the overtemp function of the drivers, and the MCU temperature. If the drivers get to overheating, I want the fan on full blast, but they don’t give you actual temps, just overheat or no. The MCU is sort of a weather vane and I can use it to set the fan to hopefully keep the overtemp on the drivers from ever activating.

My LowRider config has a bunch of stuff for laser mode defined as well, but CNC mode and workspace 1 are how it leaves the config alone. Switching to laser mode is a macro, and another macro switches it back… But it’s still fugly, so forgive me for not posting that configuration.

1 Like

Thanks a lot, can you now please give me a clue as to your homing files - I think that may be where I am getting lost. I have changed the firmware as you suggest and homing is the next (big) step…

With the ‘homex.g’ file as follows, the X motor seems to home as expected but the X1 motor (otherwise motor 3) doesn’t move and I get the error message ‘invalid number of visible axes’. Looking at the ‘machine-specific’ screen I see endstops for X, Y and Z axes only and both the endstop switches (xstop and e0stop) trigger the X endstop indicator.
homex.g
; called to home the X axis

M584 X0 P5; split X axis
G91 ; relative positioning
G21 ; Set units to mm
;M574 X0 S1 P"!xstop + !e1stop"
G1 H2 Z5 F900 ; move quickly to Z axis endstop and stop there (first pass)
G1 H1 X-670 F1500 ; move quickly to X axis endstops and stop there (first pass)
G1 H2 X5 F2400 ; go back a few mm
G1 H1 X-600 F300 ; move slowly to X axis endstops once more (second pass)
G1 H2 X300 F1500 ;
M584 X0:3 P3 ; join axis
G92 X0 ; Set Home Position
G90 ; absolute positioning

That error comes from these lines of GCode.
M584 X0 P5; split X axis
and
M584 X0:3 P3 ; join axis
Since you are not using Sensorless homing you don’t need to split the X axes out to X and U and home them separately. So try to comment out both of the M584 commands in your homing file.

Dan,
How did you get the forum to post the Code into that scrollable iframe? Is it the “Preformated Text button?”

Thanks Aaryn, I think that has sorted it.

1 Like

Nothing special there, they’re pretty much standard. Because the 2 drives are defined with the 2 endstops, it just drives each until the first drive triggers the first stop and the second drive triggers the second stop. The same number of each must be specified.

Start and stop the code segment with 3 back ticks (typically to the left of the 1 on the top row of the keyboard

I don’t remember the click shortcut, since that’s how I use it.

BBcode used to call it a code segment if you remember those forums…

1 Like
; homeall.g
; called to home all axes
;
; generated by RepRapFirmware Configuration Tool v3.2.3 on Tue Apr 20 2021 01:19:12 GMT-0600 (Mountain Daylight Time)
G91                     ; relative positioning
G1 H2 Z5 F6000          ; lift Z relative to current position
G1 H1 X-767 Y-945 F1800 ; move quickly to X and Y axis endstops and stop there (first pass)
G1 H2 X10 Y10 F6000     ; go back a few mm
G1 H1 X-20 Y-20 F360    ; move slowly to X and Y axis endstops once more (second pass)
G1 H1 Z-95 F360         ; move Z down stopping at the endstop
G90                     ; absolute positioning
G92 Z0.5                ; set Z position to axis minimum (you may want to adjust this)

; Uncomment the following lines to lift Z after probing
G91                     ; relative positioning
G1 Z5 F100              ; lift Z relative to current position
G90                     ; absolute positioning

I think the only think that I changed (much) was the G92 command to set the position of the Z to the thickness of the tiny touchplate. I might have changed the maximum limits that the machine will move before giving up for homing from the configuration tool. I still puch the Primo close to the home corner to start though, because it takes less time.