Problem with 3 Independent Z-axis motors and Endstops
-
Setup up a DuetWifi with three independent z-axis motors connected to stepper drivers Z-Motor, E0-Motor and E1-Motor, each with its own lower endstop switch connected to Z-stop, E0-stop and E1-stop. After firmware reset the platform lowers, homes to each endstop switch independently, and raises independently. But when the three axis are recombined the three z-motors do move together. What am I missing?
config.g
; Assign Drive Axis, Motors, Endstops
M584 X0 Y1 Z2:3:4 U3 V4 E5 P3 ; Assign Drive # and Axis to Motors (X=0, Y=1, Z1-Motor=Z5, Z2-Motor=U6, Z3-Motor=V7, Extruder1=3)
M574 X1 Y2 Z2 U2 V2 S0 ; set endstop configuration (X low, Y high, Z/U/V high; all endstop switches active low)
M906 X1500 Y1500 Z1500 U1500 V1500 E1500 I100 ; Set motor currents (mA)
M208 X300 Y300 Z400 U400 V400 S0 ; set axis maxima
M208 X0 Y0 Z0 U0 V0 S1 ; set axis minima; Configure Steps and Speeds
;M350 X16 Y16 Z16 U16 V16 E16 I1 ; Configure microstepping with interpolation
M92 X80 Y80 Z400 U400 V400 E95 ; set axis steps/mm
M203 X30000 Y30000 Z1000 U1000 V1000 E10000 ; Maximum Speed (mm/min)
M201 X2000 Y2000 Z300 U300 V300 E4000 ; Acceleration (mm/s^2)
M566 X600 Y600 Z40 U40 V40 E950 ; Max instantaneous speed change (mm/min)homez.g
; Home 3 Z-Axis Drives
M117 Homing Z axis...
G91 ; relative positioning
G1 Z400 F500 S1 ; lower all z motors until z-stop reached
M584 Z2 U3 V4 P5 ; Re-assign Z Drives, P5 to drive/show axis (Z1-Motor=Z2, Z2-Motor=U3, Z3-Motor=V4)
G1 Z-3 F200 S2 ; raise Z1 axis slowly (S2 required to move individual motors)
G1 U-3 F200 S2 ; raise Z2 axis slowly (S2 required to move individual motors)
G1 V-3 F200 S2 ; raise Z3 axis slowly (S2 required to move individual motors)
G1 Z10 U10 V10 F200 S1 ; lower all z motors slowly until each endstop reached
G1 Z-10 U-10 V-10 F200 S0 ; raise platformM584 Z2:3:4 P3 ; Combine axes and stop drive/show axis (P3)
G1 Z-10 F500 S0 ; test raise platformG90 ; absolute positioning
M117 Homing Z axis done
-
@b3d said in Problem with 3 Independent Z-axis motors and Endstops:
But when the three axis are recombined the three z-motors do move together
Did you mean "do NOT move together"?
Do you have a Duex expansion board or is E5 set in config.g just set to a non-existent driver?
What firmware version are you running?
In homez.g why do you move the 3 motors separately after the M584 command?Because you're using the E0 and E1 drivers, you may have to unassign them before re-combining the Z motors (or at least E1):
M584 E5:9 Z2:3:4 P3
If you have the Duex board, you may want to use drivers 5 and 6 for the extra Z motors just to avoid the E drivers.
https://duet3d.dozuki.com/Wiki/Gcode#Section_M584_Set_drive_mapping
-
oops, typo ... when the three axis are recombined the three z-motors do NOT move together.
RepRapFirmware for Duet 2 WiFi/Ethernet version 2.0(RTOS) running on Duet WiFi 1.02 or later + DueX5
Using the Duex5 for the extruder E5.
The 3 motors are moving separately in homez.g to align the z-motors. at the endstops. Each z-motor stops independently when the build platform reaches that z-motors corresponding limit switch endstop.
I had previous set it up with Drivers 5,6,7 on the Duex5 for the three z-motors and the behavior was exactly the same. -
Your config looks ok to me, but you might need to add M400 before the second M584 command in homez.g.
-
Adding M400 to wait for motors to stop before M584 command did not work. Raising and lowering before recombining axis works fine, but once the axis are recombined with M584 Z2:3:4 P3, the G1 Z-5 F200 S0 command only moves one of the 3 Z-motors.
-
Each z motor independently moves to its corresponding endstop. However once the 3 z-axis are recombined the combined z-movement fails.
config.g
; Three Z-Axis Motors on DuetWifi, Z1-Motor=Drive 2, Z2-Motor=Drive 3, Z3-Motor=Drive 4
; Three Z-Axis Endstops on DuetWifi. Z1-Endstop=Z-Stop, Z2-Endstop=E0-Stop, Z3-Endstop=E1-StopM400 ; wait for movement to stop
; Main board
M569 P0 S1 ; Drive 0 (X) goes forwards
M569 P1 S1 ; Drive 1 (Y) goes forwards
M569 P2 S0 ; Drive 2 (Z) goes backwards
M569 P3 S0 ; Drive 3 (E0) goes backwards
M569 P4 S0 ; Drive 4 (E1) goes backwards
; Expansion board
M569 P5 S1 ; Drive 5 goes forwards
M569 P6 S0 ; Drive 6 goes backwards
M569 P7 S0 ; Drive 7 goes backwards
M569 P8 S0 ; Drive 8 goes backwards
M569 P9 S0 ; Drive 9 goes backwards; Assign Drive Axis, Motors, Endstops
M584 X0 Y1 Z2 U3 V4 E5 ; Assign Drive # and Axis to Motors (X=0, Y=1, Z1-Motor=Z2, Z2-Motor=U3, Z3-Motor=V4, Extruder1=5)
M574 X1 Y2 Z2 U2 V2 S0 ; set endstop config for X, Y separately (X=1 low position, Y=2 high position, S0=switch active low); Configure Steps and Speeds
;M350 X16 Y16 Z16 U16 V16 E16 I1 ; Configure microstepping with interpolation
M92 X80 Y80 Z400 U400 V400 E190 ; set axis steps/mm
M906 X1500 Y1500 Z2000 U2000 V2000 E1400 I100 ; Set motor currents (mA)
M201 X2000 Y2000 Z200 U200 V200 E4000 ; Maxumum Accelerations (mm/s^2)
M203 X33000 Y33000 Z1000 U1000 V1000 E10000 ; Maximum Speeds (mm/min)
M566 X600 Y600 Z20 U20 V20 E950 ; Maximum jerk speeds mm/minute; Configure axis dimensions and z-axis lead screw locations
M208 X300 Y300 Z400 U400 V400 ; set axis maxima
M208 X0 Y0 Z0 U0 V0 S1 ; set axis minima
;M671 X346.37:346.37:-38.64 Y354.62:-25.39:164.62 S1.2 ; leadscrew positions relative to X=0, Y=0 (right rear, right front, left middle) (S=max correction in mm)M584 Z2:3:4 P3 ; Combine Z, U and V, P3 to display/drive 3 axis.
homez.g
; Home 3 Independent Z-Axis DrivesM117 Homing Z axis...
M400 ; Wait for movement to stop
G91 ; relative positioningM584 Z2 U3 V4 P5 ; separate z axis motors
G1 Z400 U400 V400 F500 S1 ; lower all z motors until each corresponding z-stop reached
M400 ; Wait for movement to stopG1 V-3 F200 S2 ; raise Z3 axis slowly (S2 Ignore endstops and ignore axis not homed)
G1 V10 F200 S1 ; lower Z3 motor slowly until its endstop reached
G1 V-3 F200 S2 ; raise Z3 axis slowly (S2 Ignore endstops and ignore axis not homed)
M400 ; Wait for movement to stopG1 U-3 F200 S2 ; raise Z2 axis slowly (S2 Ignore endstops and ignore axis not homed)
G1 U10 F200 S1 ; lower Z2 motor slowly until its endstop reached
G1 U-3 F200 S2 ; raise Z2 axis slowly (S2 Ignore endstops and ignore axis not homed)
M400 ; Wait for movement to stopG1 Z-3 F200 S2 ; raise Z1 axis slowly (S2 Ignore endstops and ignore axis not homed)
G1 Z10 F200 S1 ; lower Z1 motor slowly until its endstop reached
G1 Z-3 F200 S2 ; raise Z1 axis slowly (S2 Ignore endstops and ignore axis not homed)
M400 ; Wait for movement to stopM584 Z2:3:4 P3 ; combine z axis motors
G1 Z-5 F200 ; test raise all axis slowly
G90 ; absolute positioning
M117 Homing Z axis done
-
@b3d Does the Z axis move correctly without / before homing? i.e. after power up but with axes not homed, does a small (say 5mm) Z move work as expected? You might need to enter M564 H0 to allow un-homed axis movement.
-
Yes all 3 z-axis motors move together before homing. Tested with this sequence:
M564 H0
G91
G1 Z-5 F200 S2 -
@b3d That's really strange. I was just comparing my CoreXYUV homing file with your 3 lead screw file as there are similarities due to us both using U and V axes. One thing I do differently to you is that when I re-combine the axes, I explicitly assign all drives, not just those that were temporarily changed. I'm just wondering if putting P3 at the end of M584 Z2:3:4 is buggering something up. It's a long shot but at the end of your homing file and your config.g try M584 X0 Y1 Z2:34 E5 P3 instead of just M584 Z2:3:4 P3.
Alternatively, maybe there is a hidden character crept in to that last M584 line that you have. Try deleting it and re-typing it. I confess that I'm clutching at straws here but I can't see anything else obviously amiss.
-
Thanks @deckingman for comparing to your configuration and homing files. I changed the second M584 to a freshly typed M584 X0 Y1 Z2:3:4 E5 P3 in both config.g and homez.g to recombine the axes. Added a test move G1 Z-5 U-5 V-5 F200 S2 after homing each axes individually and before combining the Z, U and V axes, and that works fine. The test move G1 Z-5 F200 immediately after combining the axes still does not work. During this move the Z2 axis rotates in the correct direction to raise the platform while at the same time the drive 3 (U) and drive 4 (V) axes are going the wrong way.
homez.g
; Home 3 Independent Z-Axis DrivesM117 Homing Z axis...
M400 ; Wait for movement to stop
G91 ; relative positioning;M584 Z2 U3 V4 P5 ; separate z axis motors
M584 X0 Y1 Z2 U3 V4 E5 P5 ; separate Z axis motors. P5 to display/drive 5 axis.G1 Z400 U400 V400 F500 S1 ; lower all z motors until each corresponding z-stop reached
M400 ; Wait for movement to stopG1 V-3 F200 S2 ; raise Z3 axis slowly (S2 Ignore endstops and ignore axis not homed)
G1 V10 F200 S1 ; lower Z3 motor slowly until its endstop reached
G1 V-3 F200 S2 ; raise Z3 axis slowly (S2 Ignore endstops and ignore axis not homed)
M400 ; Wait for movement to stopG1 U-3 F200 S2 ; raise Z2 axis slowly (S2 Ignore endstops and ignore axis not homed)
G1 U10 F200 S1 ; lower Z2 motor slowly until its endstop reached
G1 U-3 F200 S2 ; raise Z2 axis slowly (S2 Ignore endstops and ignore axis not homed)
M400 ; Wait for movement to stopG1 Z-3 F200 S2 ; raise Z1 axis slowly (S2 Ignore endstops and ignore axis not homed)
G1 Z10 F200 S1 ; lower Z1 motor slowly until its endstop reached
G1 Z-3 F200 S2 ; raise Z1 axis slowly (S2 Ignore endstops and ignore axis not homed)
M400 ; Wait for movement to stop; This test move before combining axis works
G1 Z-5 U-5 V-5 F200 S2 ; raise Z1 axis slowly (S2 Ignore endstops and ignore axis not homed)M584 X0 Y1 Z2:3:4 E5 P3 ; Combine Z, U and V. P3 to display/drive 3 axis.
; This test move after combining axis does NOT work (drives 3 and 4 are rotating in the wrong direction)
G1 Z-5 F200 ; test raise all axis slowlyG90 ; absolute positioning
M117 Homing Z axis done
-
Just on a lark, try commenting out your M117 message commands.
-
Also, what firmware version?
-
No change with commenting out M117 messages.
RepRapFirmware for Duet 2 WiFi/Ethernet version 2.0(RTOS) running on Duet WiFi 1.02 or later + DueX5 -
One last ditch try, upgrade to 2.01 full release, and if that doesn't work, 2.02 RC2.
-
Also, have you tried sending each command from the macro individually through the console? Does the recombine axis command work then?
-
@phaedrux Thanks for your suggestions. I commented out the last M584 in homez.g and sent the following commands from the console:
M584 Z2:3:4 P3
G91
G1 Z-5 F200
Same thing. Drive 2 (Z) rotates in the correct direction, while drive 3 (U) and drive 4 (V) axes rotate the wrong way. -
@b3d I would try to remove the separated movement commands and check whether the combined movement works as intended. Or whether the wrong movements remain.
This is to isolate the problem (reason a) something wrong with changing from separate to combined b) backwards rotation handled differently for Z and U/V).
-
Its starting to look like a firmware bug. Upgraded to Firmware Version 2.01(RTOS) (2018-07-26b2). Now the 3 z-axis rotate in the correct direction after recombining Z, U and V. However, this only works the first time after firmware reset. If Home Z is run a second time, at the first G1 command, only the Z axis moves (U and V do not move).
homez.g
; Home 3 Independent Z-Axis DrivesM117 Homing Z axis...
M400 ; Wait for movement to stop
G91 ; relative positioningM584 Z2 U3 V4 P5 ; separate Z axis motors. P5 to display/drive 5 axis.
; This only works the fist time after firmware reset.
; The second time Homez is run, only the Z axis moves (U and V do not move).
G1 Z400 U400 V400 F500 S1 ; lower all z motors until each corresponding z-stop reached
M400 ; Wait for movement to stopG1 V-3 F200 S2 ; raise Z3 axis slowly (S2 Ignore endstops and ignore axis not homed)
G1 V10 F200 S1 ; lower Z3 motor slowly until its endstop reached
G1 V-3 F200 S2 ; raise Z3 axis slowly (S2 Ignore endstops and ignore axis not homed)
M400 ; Wait for movement to stopG1 U-3 F200 S2 ; raise Z2 axis slowly (S2 Ignore endstops and ignore axis not homed)
G1 U10 F200 S1 ; lower Z2 motor slowly until its endstop reached
G1 U-3 F200 S2 ; raise Z2 axis slowly (S2 Ignore endstops and ignore axis not homed)
M400 ; Wait for movement to stopG1 Z-3 F200 S2 ; raise Z1 axis slowly (S2 Ignore endstops and ignore axis not homed)
G1 Z10 F200 S1 ; lower Z1 motor slowly until its endstop reached
G1 Z-3 F200 S2 ; raise Z1 axis slowly (S2 Ignore endstops and ignore axis not homed)
M400 ; Wait for movement to stop; This test move before combining axis works
G1 Z-5 U-5 V-5 F200 S2 ; raise Z1 axis slowly (S2 Ignore endstops and ignore axis not homed)M584 Z2:3:4 P3 ; Combine Z, U and V. P3 to display/drive 3 axis.
; This test move after combining axis also works now
G1 Z-5 F200 ; test raise all axis slowlyG90 ; absolute positioning
M117 Homing Z axis done
-
@b3d Well it sounds like some sort of progress. Now that you have upgraded the firmware, can you try assigning all drives in each M584 command as detailed in my earlier post. So always assigne X,Y and E as well as Z (and U and V). If you take a look at this https://duet3d.dozuki.com/Wiki/GCode#Section_M584_Set_drive_mapping and especially the warning paragraph underneath the example which states:
Quote...........
"Assigning a drive using M584 does not remove its old assignment. Therefore, if you assign a drive that defaults to being an extruder drive, you should also assign the extruder drives explicitly as in the above example. Failure to do so may result in unexpected behaviour."
..end of quote.So I'm just wondering if it's something along those lines that is screwing things up and drives 3 and 4 are resorting to being extruders.
It is possible that you have unearthed a hitherto unknown bug in the firmware but what makes me doubt that is that there are other users who do what you are trying to do and AFAIK, yours is the only case where it isn't working. On the other hand, maybe everyone else with 3 independent screws home to Z min so you might be the only user using 3 independent screws homing to Z max.
Hopefully now that the TCT show is over, David (DC42) might find time to take a look at this thread.
Edit. One other thing. If you send M584 with no parameters through the gcode console, it will report the current state of the drive mapping. So if you entered each command in your homeZ file one at a time, then entered M584 after each command, it might show at what point things get screwed up.
-
Thanks @deckingman, appreciate your help and gave your suggestions a try this morning. Good to know that M584 returns the drive mapping. I changed the M584 to define all drives every time in config.g and homez.g.
After config.g M584 -> Driver assignments: X0 Y1 Z2:3:4 U3 V4 E5, 3 axes visible
After homez.g M584 -> Driver assignments: X0 Y1 Z2:3:4 U3 V4 E5, 3 axes visibleBehavior is still the same. Running Homez.g the first time after firmware reset and everything works as expected, with the Z, U and V axes rotating the same direction. But when Homez is run a second time, the first G1 Z400 U400 V400 F500 S1 command causes the Z axis to rotate in different direction from U and V. Homez then hangs for a couple of minutes before continuing on with the G1 V-3 F200 S2, and subsequent commands.
Also tried @phaedrux suggestion to enter commands individually from console. Did this after running homez once after reset. Same behavior. Checked drive mapping after the G1 Z400 U400 V400 F500 S1 and it returned Driver assignments: X0 Y1 Z2 U3 V4 E5, 5 axes visible