3.6.0-beta.1 Breaking Homing Sequence
-
start gcode
; Printer Settings Start GCode Start ; Prepare G21 ; Set units to millimeters (mm). G90 ; Set all axes (not extruders) to absolute positioning. M83 ; Set all extruders (not axes) to relative positioning. M106 P0 S0 ; Fan (Make sure part cooling fan is off at beginning of print). ; P (Fan number): 0 (Default. Extruder 1). ; S (Fan Speed): 0 (Turn off). M220 S100 ; Set speed factor override percentage (Set speed factor to 100%). ; S (Speed factor override percentage): 100 % (Default). M221 S100 D0 ; Set extrusion factor override percentage (Set extrusion factor to 100%). ; S (Extrude factor override percentage): 100 % (Default). ; D (Extruder drive number): 0 (Default. Extruder 1). M572 D0 S0 ; Set extruder pressure advance (Turn off pressure/linear advance). ; D (Extruder number): 0 (Default. Extruder 1). ; S (Pressure advance amount): 0 sec (Turn off). ; Notify M291 P"Printer: Voron. Material: {filament_preset[current_extruder]}. Nozzle: {nozzle_diameter[current_extruder]}. Layer: {layer_height}." R"Settings" S1 T10 ; Display message. ; Home G28 ; Home (all axes). ; X (Flag to home the X axis): - ; Y (Flag to home the Y axis): - ; Z (Flag to home the Z axis): - ; Heat (1 of 2) M140 S{first_layer_bed_temperature[0]} ; Set bed temperature and dont wait (Heat up bed to first layer settings). ; P (Bed heater index): - (Default is 0). ; H (Heater Number): - ; S (Active/Target temperature): ... deg C. T0 ; Select tool. ; n (Tool number to select): 0 (Tool 1. A negative number deselects all tools.) ; R1 (Select the tool that was active when the print was last paused): - ; P (Bitmap of the macros to be run): - M568 P0 R{nozzle_temperature_range_low[current_extruder] - 40} S{nozzle_temperature_initial_layer[current_extruder]} A1 ; Set tool (Extruder 1 temperature) settings. ; P (Tool number): ... ; R (Standby temperature): ... deg C. ; S (Active temperature): ... deg C. ; A (Required heater state): 1 (Standby temperature). ; Move Toolhead G1 X{(print_bed_min[0] + print_bed_max[0]) / 2} Y{print_bed_max[1] - 10} F21000 ; Controlled linear move (Absolute. Hover over rear center position to facilitate bed preparation). ; X (X axis): ... ; Y (Y axis): ... ; Z (Z axis): - ; F (Feed rate): 21,000 mm/min (350 mm/sec). ; H (Move type): - (Default is 0). ; Wait for Heaters M116 ; Wait (for the nozzle and the bed to heat up). ; P (Tool number): - ; H (Heater number): - ; C (Chamber number): - ; S (Tolerance): - deg C. ; Run Bed Compensation G32 ; Run "bed.g" macro for automatic bed compensation. ; Heat (2 of 2) M140 S{first_layer_bed_temperature[0]} ; Set bed temperature and dont wait (Heat up bed to first layer settings). ; P (Bed heater index): - (Default is 0). ; H (Heater Number): - ; S (Active/Target temperature): ... deg C. M568 P0 A2 ; Set tool settings and dont wait (Heat the extruder up 2 of 2 to active temp). ; P (Tool number): ... ; R (Standby temperature): - deg C (This parameter has been referenced already). ; S (Active temperature): - deg C (This parameter has been referenced already). ; A (Required heater state): 2 (Active temperature). M116 ; Wait (for the nozzle and bed to heat up). ; P (Tool number): - ; H (Heater number): - ; C (Chamber number): - ; S (Tolerance): - deg C. ; Move Toolhead G1 X0 Y0 Z3 F21000 ; Controlled linear move (Absolute. Hover over origin position). ; X (X axis): ... ; Y (Y axis): ... ; Z (Z axis): ... (To prevent scratching the bed). ; F (Feed rate): 21,000 mm/min (350 mm/sec). ; H (Move type): - (Default is 0). ; Purge Blob G1 E1 F900 ; Controlled linear move (Relative. Un-retract extruder). ; E (Extrude): 1 mm (You retract 1 mm for the End GCode or the cancel.g file) ; F (Feed rate): 900 mm/min (15 mm/sec. Minimum un-retraction for S7 printer). G1 E10 F94 ; Controlled linear move (Relative. Prime the hotend). ; E (Extrude): 10 mm. ; F (Feed rate): 94 mm/min (1.57 mm/sec. A flow rate of ~ 10 mm^3/sec). ; Prime Line G1 X5 Z0.2 F2400 ; Controlled linear move (Absolute. Move -Z and +Y to start prime line). ; X (X axis): 5 mm (Move to X of 5, to prevent nozzle squishing into prime blob). ; Z (Z axis): 0.2 mm (Move to Z of 0.2, to go to start of layer). G1 X325 E12 F1200 ; Print prime line horizontally across front left corner (Uses a conservative initial layer speed of 20 mm/sec). G1 X350 F7200 ; Travel to release purge line from nozzle. G1 Z3 F2400 ; Raise extruder to prevent bed scratching. G92 E0 ; Reset extruder distance to 0. ; Printer Settings Start GCode End
-
It seems to fail around the bed.g section:
; Voron ; 0:/sys/bed.g ; Called to perform automatic bed compensation via G32. ; Prepare M400 ; Wait for current moves to finish. M561 ; Clear any bed plane fitting transform. M290 S0 R0 ; Baby stepping. ; S (Amount to baby step [mm]): 0 (Clear/Reset). ; R (Relative?): 0 (Absolute). ; Home (1 of 2) if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed ; If the axes are not homed ... G28 ; ... home the axes. ; Gantry Tram M98 P"gantry_probing.g" echo "BTC: 1 - Difference was " ^ move.calibration.initial.deviation ^ "mm" while move.calibration.initial.deviation >= 0.05 ; perform additional tramming if previous deviation was over 0.05 mm. if iterations = 5 abort "Too many auto tramming attempts" M98 P"gantry_probing.g" ; perform bed tramming echo "BTC: " ^ iterations + 2 ^ " - Difference was " ^ move.calibration.initial.deviation ^ "mm" continue ; Home 2 of 2 (Just Z). G28 Z ; Home z ; Bed Level G29 S0 ; Mesh bed probe. ; S (Set parameter): 0 (Probe the bed. Save height map in the file "/sys/heightmap.csv" on the SD card. Activate bed compensation.) ; End
here is the referenced gantry_probing.g file as well
; Gantry Tram G90 ; Absolute positioning. G30 P0 X325 Y313.5 Z-99999 ; Single Z probe (Probe points are based on probe location, not nozzle location. See config.g M557). ; P (Probe point number): 0 (1st of 4). ; X (X coordinate): 325 (Right side). ; Y (Y coordinate): 313.5 (Far side). ; Z (Z coordinate): -99999 (Probe the bed). G30 P1 X325 Y25 Z-99999 ; Single Z probe. ; P (Probe point number): 1 (2nd of 4). ; X (X coordinate): 325 (right side). ; Y (Y coordinate): 313.5 (close side). ; Z (Z coordinate): -99999 (Probe the bed). G30 P2 X25 Y25 Z-99999 ; Single Z probe. ; P (Probe point number): 2 (3rd of 4). ; X (X coordinate): 25 (left side). ; Y (Y coordinate): 25 (close side). ; Z (Z coordinate): -99999 (Probe the bed). G30 P3 X25 Y313.5 Z-99999 S4 ; Single Z probe. ; P (Probe point number): 3 (4th of 4). ; X (X coordinate): 25 (left side). ; Y (Y coordinate): 313.5 (far side). ; Z (Z coordinate): -99999 (Probe the bed). ; S (Set parameter): 4 (Calculate 4 point compensation).
-
Also, if it helps, my X and Y steppers sound noticeably quieter after the update, even though M970 shows phase stepping as disabled for all axes. Steppers are LDO 42STH60-2004AH on a voron 2.4 350 setup.
-
@Charlie Does the iterations variable used in bed.g need to be defined?
-
@adrian iterations is a builtin keyword for loops.
-
Its looking like more of a stepper motor/driver issue. Increasing the X/Y stepper motor current to 2380 mA allows me to run the homing sequence and have 600mm/s travel speeds with 7000mm/s^2 accels.
I think my biggest question now is what all the new parameters do. Im using the Forum, GCode Dictionary and the github changelogs to get most of my info.
Any more info on what M970.1 and .2 do? My assumption is that the speed and accel "constant" is like the slope "m" on a y=mx+b style graph, where "b" is min stepper current (motor idle current set by M906?), and the actual current set is the maximum of either the 970.1 and 970.2 lookup values. Im really in the dark regarding this stuff though, so please let me know if I'm completely wrong.
-
Hi @Charlie, I added the new phase stepping feature but it is still experimental. Phase stepping is disabled by default unless you run
M970 {axis letter}1
(note that it is currently only supported on 6HC mainboard drivers).One of the benefits of phase stepping is lower motor noise. In the 3.6.0-beta1 release this is done my controlling the motor current based on speed and acceleration.
M970.1
,M970.2
&M917
allow setting the scaling factors for this equation. For example, you may find that you want higher current when accelerating/decelerating to prevent stalling but a lower current when moving at steady speed to reduce noise.M917
sets the minimum current percentage based on theM906
value. The current will never exceed theM906
value.If you want to use phase stepping then please do give feedback on how you find it performs. It should be safe to use but limited print comparisons have been done at this point.
As for your issue, it sounds like increasing the motor current fixes it? If so my guess would be the new input shaper is causing a move to achieve slightly higher accelerations/speeds than it did in 3.5 which could have caused a motor stall.
-
@Charlie the easiest way to tune the phase step parameters is to connect a USB cable to the Duet with a program like YAT or Putty and enable debugging with
M111 P4 S1
(disable it again after you are done). Then do a move with a phase stepped axis and it will print an output like this:
Thev
is velocity,a
is acceleration, andcf
is current fraction (what theM906
value will be multiplied by for that point in the move.You can tweak the
M970.1
,M970.2
&M917
parameters untill you are happy with the max speed/acceleration and noise that the motors are making -
@Charlie one other thing to verify relating to you homing/motor stalling issue is the actual current that is being applied to the motors. Can you send the response from
M569 P{driver_num}
andM906
please. Make sure thatM569
is sent soon after a move so that the current has not been reduced by theM906
idle current reduction -
@AndyE3D First of all, thank you so much for your work on implementing this feature! Its been awesome for decreasing motor noise, as well as decreasing VFAs (especially below 100mm/s print speeds).
When I get the time, Ill be sure to do that. Im assuming that I would be able to run Serial Tools app from mac to do the same stuff on a Mac.
Im also getting one of the Vector 3D stepper motor analyzers. I don’t know if anyone has used that and has any input, but Ill be sure to report my findings.
-
@AndyE3D This may sound simple, but how do I get the "v, a, cf" display in SBC mode? I enabled debugging using the M111 P4 S1 in dwc, plugged my computer into the USB port on the Duet, and I tried Serial Tools on a Mac, but I dont get any response. Im assuming that this may be correct for standalone mode, but not for SBC. Is this correct?
-
@AndyE3D I also tried using YAT on a PC, and was unable to get a response from any commands that I made (like M122 or M115). Im assuming that this may have something to do with SBC mode, or Im making some other error in the setup.
-
@AndyE3D Do we know what the M970.1 default 1000 and the M970.2 5000 values are relative to?
The documentation is a bit sparse on how the math is calculated. -
@Notepad I completely agree. "Acceleration/Velocity constant." Does not help much when trying to tune settings. I was hoping to be able to report back how the calculations are made after doing some testing (and reverse calculating the current factor), but without being able to get a debugging output Im unable to help.
-
Does anyone have references to how this is implemented?
The only link I currently have is M970. Others with more info (particularly regarding how its calculated and tuned) would be greatly appreciated.
-
@Charlie I don't think SBC mode will impact the USB interface to the Duet. You may need to try a different USB cable as for reasons I've never understood the Duet boards seem very sensitive to this. When you plug the cable into a windows PC do you see a new COM port being created (and hear the windows "new device" sound)? If you do you should see the device come and go in the windows device manager. I'd try opening that port using putty (rather than YAT as I've found YAT to be a little fussy with the terminal settings). If you use putty you will probably need to enable local echo (to see what you type) and also adjust the handling of newline to also perform a carriage return. See: https://teamgloomy.github.io/putty.html for more details (this is for the stm32 port of RRF firmware but pretty much all of it applies to the Duet).
-
@Notepad @Charlie this is the equation that uses the acceleration & velocity constants
float PhaseStep::CalculateCurrentFraction() noexcept { // Driver is in assisted open loop mode // In this mode the PID terms are not used and the A and V terms are independent of the loop time. constexpr float scalingFactor = 100.0; constexpr float scalingFactorSqr = scalingFactor * scalingFactor; PIDVTerm = mParams.speed * Kv * scalingFactor; PIDATerm = mParams.acceleration * Ka * scalingFactorSqr; PIDControlSignal = min<float>(fabsf(PIDVTerm) + fabsf(PIDATerm), 256.0); currentFraction = holdCurrentFraction + (1.0 - holdCurrentFraction) * min<float>(PIDControlSignal * (1.0/256.0), 1.0); if (reprap.GetDebugFlags(Module::Move).IsBitSet(MoveDebugFlags::PhaseStep)) { debugPrintf("v=%f, a=%f, cf=%f\n", (double)(mParams.speed * scalingFactor), (double)(mParams.acceleration * scalingFactorSqr), (double)currentFraction); } return currentFraction; }
The units, calculation, and tuning are almost identical to assisted open loop on the 1HCL board with the main difference being it does not have the encoder to warn about skipped steps (stall detect also does not work when phase stepping), and the Kp & Kd terms are not used.
In YAT make sure that you have enabled
DTR
if you are running the latest firmware as the USB code was changed recently. I don't know if there are other difference connecting to the Duet on MacOS
-
@AndyE3D Thank you so much for posting this code. Im pretty new to code in general, but it looks like makes sense (unless im completely mistaken which is also possible). Looks like this is in GitHub: ReprapFirmware/src/Movement/PhaseStep.cpp, line 132 for others that may be looking.
After trying to put some of this in a spreadsheet (which Im sure is not the best way to go about this, but its what I kinda know), and putting in some velocity and acceleration values, Im struggling to get the PIDControlSignal value to be anything other than the 256 max value, which will in turn set the currentFraction to the max of 1.
Im not sure what Im missing here. Could be that the mParams arent actually as simple as the speed and accel in mm/sec(^2), I may have calculated holdCurrentFraction wrong (in PhaseStep.h as 0.71), or the default values are really conservative. Or something else that I cant think of.
-
@AndyE3D And yes, making sure that DTR was enabled solved my issue with connection! Thank you so much. I can now use YAT on the PC to send and receive commands using a direct USB connection to the Duet.
Now my issue is that, although I can connect and send an M122 command and get an output, once I send
M111 P4 S1
, every time I send a move command (likeG91 G1 H2 X10 F3000
) I get a "Warning: Lost connection to Duet (Timeout while waiting for transfer ready pin)", and then a "Warning: SPI connection has been reset". Then it seems to restart, as the machine is no longer homed.