Sensorless homing with TMC2209's
-
HW/FW specs to start it off: Duet 3 Mini 5+ with LDO-42STH48-2504AC steppers for the CoreXY and RRF 3.5b1 (started tuning on 3.4.5 with the exact same behaviour so it's not a 3.5b1 related thing).
I'm trying my luck on sensorless homing for X/Y axes (to start with atleast) on my Voron Trident, but I'm having a hard time tuning in the current reduction / stall sensitivity ratio. Or that's at least what I think is the snag at this point.
First of i had some rather weird issues with getting the homing to work at all, an had tho deploy a
M84
for the axis i'm trying to home at the very start of the homing macro to get it to work at all once the axis has been homed once (rehoming and axis should still be possible on a homed axis with sensorless homing shouldn't it?).I've got working now, but i'm having to run the stepper @ 80% of 1740mA with a stall sensitivity of 30 on the Y axis for it to be stable, which i think is a little bit on the higher side ain't it?
The X is much less twitchy and i can get that to be quite stable all the way down to 40% current with 2 in stall sensitivity.Heres my
homey.g
in it's current state:; /sys/homey.g v2.0 ; called to home the Y axis ; Configured for sensorless homing / stall detection on a Duet 3 Mini 5+ and LDO-42STH48-2504AC steppers on XY ; XY driver numbers var X = 0.0 ; The driver number for your X (B) stepper var Y = 0.1 ; The driver number for your Y (A) stepper ; Sensorless homing sensitivity var Sen = 30 ; Stall detection sensitivity ; Don't touch anyting bellow this point(unless you know what you're doing)!! ; ----------------------------------------------------------------------------- M84 Y ; Disable Y axis stepper(don't know why, but it's needed for now) M400 ; Wait for moves to finish G91 ; Relative positioning ; Enable stealthChop on XY steppers M569 P{var.X} S0 D3 V10 ; Set X axis driver in stealthChop mode M569 P{var.Y} S0 D3 V10 ; Set Y axis driver in stealthChop mode M915 X S{var.Sen} F0 R1 H200 ; Set stall detection sensitivity(-128 to +127), filter mode, action type and minimum motor full steps per second ; Lower XY currents, speed & accel M98 P"/sys/lib/current/xy_current_low.g" ; Set low XY currents M98 P"/sys/lib/speed/speed_probing.g" ; Set low speed & accel M400 ; Wait for current moves to finish ; Enable sensorless homing M574 X2 Y2 S4 ; Configure sensorless endstop for high end on X & Y M400 ; Wait for moves to finish ;G1 H1 X-0.5 F3000 ; Move X axis back a little bit to clear stall flag if it's triggered G1 H1 Y-0.5 F3000 ; Move Y axis back a little bit to clear stall flag if it's triggered M400 ; Wait for moves to finish ; Home Y axis G1 Y600 F6000 H1 ; Move quickly to Y axis max and stop there M400 ; Wait for moves to finish ; Enable spread cycle on XY steppers M569 P{var.X} S0 D2 ; Set X axis driver in spread cycle mode M569 P{var.Y} S0 D2 ; Set Y axis driver in spread cycle mode G1 Y-1 ; Back off a little bit to unflag stall detection G90 ; Absolute positioning ; Restore XY currents, speed & accel M98 P"/sys/lib/current/xy_current_high.g" ; Set high XY currents M98 P"/sys/lib/speed/speed_printing.g" ; Set high speed & accel
Can anyone see something weird or missing? (Other than bed lowering, i've got that sorted out. This is currently just debugging)
-
@Exerqtor I need to use a SG threshold of 30 for my 0.9deg motors for my filament load macros, so I think that value is reasonable. AFAIK the reported range for the TMC2209 goes from 0..255 in RRF so that should be reasonable:
load.g:
T0 M83 M913 E75 M302 P1 M569 P4 D3 V100 G1 H1 E750 F1800 M569 P4 D2 M913 E100 M302 P0
I usually drive my E motor at 1700mA but I reduce it to 75% when loading a new filament.
-
Ok then were not to far off eachother.
The main issue i'm having now is that homing Y is unstable SOME times.
If I run home all it first homes X to max pos, then it homes Y to max pos, then it moves the printhead to bed center and homes Z . But some times sporadicaly the SG trips right away when Y tries to home, if Y is already at center at that point I bet you can see the issue when it tries to move to bed center for the Z homing
🤣
I can't figure out wtf it exactly is thats causing it, but since it only happens if X has just been homed though (at least from what I've observed so far). I guess it's the SG still being tripped for some reason. And i cant figgure out a stable work around for it
😮💨
-
@Exerqtor If your printer is coreXY remember that both motors are involved in left/right or up/down moves so either/both can stall when homing. You are currently only setting the stall sensitivity on X (which itself is a little odd given this is your Y home macro). RRF is a little ambiguous when it comes to motors/driver letters in this sort of situation. You might want to use the P parameter to M915 and to set the sensitivity on both motors. If you are having problems with stalls being as soon as you try to move, adjusting the M915 H parameter can sometimes help with this.
You might also want to search the forum for threads about "stallguard tuning". If you read the TMC docs it seems that in theory TMC2209s need to "learn" the characteristics of the motors to accurately detect a stall. This requires that after you switch to stealthchop you apply current then pause then execute a small motor move (possibly followed by another short pause). This page has some comments on this (though I find them a little confusing) https://docs.duet3d.com/User_manual/Connecting_hardware/Motors_tuning you may find more information by searching the forum.
-
@gloomyandy said in Sensorless homing with TMC2209's:
@Exerqtor If your printer is coreXY remember that both motors are involved in left/right or up/down moves so either/both can stall when homing. You are currently only setting the stall sensitivity on X (which itself is a little odd given this is your Y home macro). RRF is a little ambiguous when it comes to motors/driver letters in this sort of situation. You might want to use the P parameter to M915 and to set the sensitivity on both motors. If you are having problems with stalls being as soon as you try to move, adjusting the M915 H parameter can sometimes help with this.
Yeah i can try with P instead of X / Y, worth a try at least, haven't touched the H parameter this far. So that might be something to look at.
You might also want to search the forum for threads about "stallguard tuning". If you read the TMC docs it seems that in theory TMC2209s need to "learn" the characteristics of the motors to accurately detect a stall. This requires that after you switch to stealthchop you apply current then pause then execute a small motor move (possibly followed by another short pause). This page has some comments on this (though I find them a little confusing) https://docs.duet3d.com/User_manual/Connecting_hardware/Motors_tuning you may find more information by searching the forum.
I've looked through more or less every stallguard/sensorless homing thread on this forum at this point
🤣
And I'm already doing just that if you have a look at this snippet of the code I posted earlier:
; Enable stealthChop on XY steppers M569 P{var.X} S0 D3 V10 ; Set X axis driver in stealthChop mode M569 P{var.Y} S0 D3 V10 ; Set Y axis driver in stealthChop mode M915 X S{var.Sen} F0 R1 H200 ; Set stall detection sensitivity(-128 to +127), filter mode, action type and minimum motor full steps per second ; Lower XY currents, speed & accel M98 P"/sys/lib/current/xy_current_low.g" ; Set low XY currents M98 P"/sys/lib/speed/speed_probing.g" ; Set low speed & accel M400 ; Wait for current moves to finish ; Enable sensorless homing M574 X2 Y2 S4 ; Configure sensorless endstop for high end on X & Y M400 ; Wait for moves to finish ;G1 H1 X-0.5 F3000 ; Move X axis back a little bit to clear stall flag if it's triggered G1 H1 Y-0.5 F3000 ; Move Y axis back a little bit to clear stall flag if it's triggered M400 ; Wait for moves to finish ; Home Y axis G1 Y600 F6000 H1 ; Move quickly to Y axis max and stop there M400 ; Wait for moves to finish
Unless I missunderstoodd what the "learing/tuning" conditions TMC mention, and I've structured the code wrong
😶
.Edit:
I'll try to throw in this before the
- 0.5mm
moves and see if that does the jobM17 X Y ; Enable XY steppers M400 P200 ; Wait 200ms for stallguard tuning.
-
@gloomyandy
Tried doing those changes now, first i added the M17 and the pause, tried and same behaviour.Then i adjusted M915 H to 400, same same.
Looks like i have to bumb up M915 S even more, if it's not something else that can be done.In it's current form it stalls out imidiately every time i try to home Y.
-
@Exerqtor Canyou post your current homey.g file. In all the files you have posted you had the M915 H parameter set to 200, so I'm not really sure what you have been trying. It would probably also help if you posted.You also seem to be using the G1 H1 parameter for the tuning move I'm not sure that is a good idea if you have stall endstops active as you may be stalling the motors during the tuning move. You may want to look at the setup the DC42 uses on his toolchanger (which is also corexy), remember though that he is using 5160 drivers so homing uses spreadcycle rather than stealthchop. https://github.com/Duet3D/RRF-machine-config-files/tree/master/E3D_Tool_Changer/dc42-duet3-centreZero-2Titan-2Hemera/sys
-
@gloomyandy
Sorry i meant 400, straight up typo on that oneI'll post the current iteration of homey.g and all sub macro's later so everything is "on the table".
But not using H1 moves (for anything other than the homing move) might also be a thing. Anywho, i'll post the file as it is before i make any more changes just for referance.
Edit with homey.g:
I've added a bit to the macro since the first post, but this is the how it as the post above:
; /sys/homey.g v2.0 ; called to home the Y axis ; Configured for sensorless homing / stall detection on a Duet 3 Mini 5+ and LDO-42STH48-2504AC steppers on XY ;---/ ; -/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/-- ; THIS MACRO ONLY WORKS WITH RRF 3.5.0b1 AND LATER!! ;--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/-- ;-/ ; ====================--------------------------------------------------------- ; Settings section ; ==================== ; Nozzle clearance (gets overridden if you have global.Nozzle_CL) var Clearance = 5 ; The "safe" clearance you want to have between the noszzle and bed before moving the printhead ; XY driver numbers var X = 0.0 ; The driver number for your X (B) stepper var Y = 0.1 ; The driver number for your Y (A) stepper ; Sensorless homing sensitivity var Sen = 30 ; Stall detection sensitivity ; Don't touch anyting beyond this point(unless you know what you're doing)!! ; ====================--------------------------------------------------------- if exists(global.Nozzle_CL) set var.Clearance = {global.Nozzle_CL} ; LED status if exists(global.sb_leds) set global.sb_leds = "homing" ; ====================--------------------------------------------------------- ; Lower Z axis ; ==================== ; If Z isn't allready been lowered if !exists(param.Z) ; Lower Z if needed if !move.axes[2].homed ; If Z isn't homed ; Lower Z currents, speed & accel if fileexists("/sys/lib/current/z_current_low.g") M98 P"/sys/lib/current/z_current_low.g" ; Set low Z currents else M913 Z60 ; Set Z motors to n% of their max current if fileexists("/sys/lib/speed/speed_probing.g") M98 P"/sys/lib/speed/speed_probing.g" ; set low speed & accel else M204 P500 T1500 ; Set printing acceleration and travel accelerations (mm/s²) G91 ; Relative positioning G1 Z{var.Clearance} F9000 H1 ; Lower Z(bed) relative to current position G90 ; Absolute positioning if fileexists("/sys/lib/current/z_current_high.g") M98 P"/sys/lib/current/z_current_high.g" ; Restore normal Z currents else M913 Z100 ; Set Z motors to 100% of their max current elif move.axes[2].userPosition < {var.Clearance} ; If Z is homed but less than var.Clearance ; Lower Z currents, speed & accel if fileexists("/sys/lib/current/z_current_low.g") M98 P"/sys/lib/current/z_current_low.g" ; Set low Z currents else M913 Z60 ; Set Z motors to n% of their max current if fileexists("/sys/lib/speed/speed_probing.g") M98 P"/sys/lib/speed/speed_probing.g" ; set low speed & accel else M204 P500 T1500 ; Set printing acceleration and travel accelerations (mm/s²) G1 Z{var.Clearance} F9000 ; Move to Z var.Clearance if fileexists("/sys/lib/current/z_current_high.g") M98 P"/sys/lib/current/z_current_high.g" ; Restore normal Z currents else M913 Z100 ; Set Z motors to 100% of their max current ; ====================--------------------------------------------------------- ; Home Y axis ; ==================== M84 Y ; Disable Y axis stepper(don't know why, but it's needed for now) M400 ; Wait for moves to finish G91 ; Relative positioning ; Enable stealthChop on XY steppers M569 P{var.X} S0 D3 V10 ; Set X axis driver in stealthChop mode M569 P{var.Y} S0 D3 V10 ; Set Y axis driver in stealthChop mode ; Enable sensorless homing M574 X2 Y2 S4 ; Configure sensorless endstop for high end on X & Y ; Lower XY currents, speed & accel if fileexists("/sys/lib/current/xy_current_low.g") M98 P"/sys/lib/current/xy_current_low.g" ; Set low XY currents else M913 X80 Y80 ; Set X Y motors to n% of their max current if fileexists("/sys/lib/speed/speed_probing.g") M98 P"/sys/lib/speed/speed_probing.g" ; Set low speed & accel else M204 P500 T1500 ; Set printing acceleration and travel accelerations (mm/s²) M400 ; Wait for current moves to finish ; Stall detection parameters M915 P{var.X}:{var.Y} S{var.Sen} F0 R1 H400 ; Set stall detection sensitivity(-128 to +127), filter mode, action type and minimum motor full steps per second ; Stallguard tuning M17 X Y ; Enable XY steppers G4 P200 ; Wait 200ms for stallguard tuning ; Unflag stalls M400 ; Wait for moves to finish G1 H1 X-0.5 F3000 ; Move X axis back a little bit to clear stall flag if it's triggered G1 H1 Y-0.5 F3000 ; Move Y axis back a little bit to clear stall flag if it's triggered M400 ; Wait for moves to finish ; Home Y axis G1 Y600 F6000 H1 ; Move Y axis max and stop there M400 ; Wait for moves to finish ; Enable spread cycle on XY steppers M569 P{var.X} S0 D2 ; Set X axis driver in spread cycle mode M569 P{var.Y} S0 D2 ; Set Y axis driver in spread cycle mode G1 Y-1 ; Back off a little bit to clear stall flag G90 ; Absolute positioning ; ====================--------------------------------------------------------- ; Finish up ; ==================== ; Restore XY currents, speed & accel if fileexists("/sys/lib/current/xy_current_high.g") M98 P"/sys/lib/current/xy_current_high.g" ; Set high XY currents else M913 X100 Y100 ; Set X Y motors to var.100% of their max current if fileexists("/sys/lib/speed/speed_printing.g") M98 P"/sys/lib/speed/speed_printing.g" ; Set high speed & accel else M204 P1500 T3000 ; Set printing acceleration and travel accelerations (mm/s²) ; LED status if exists(global.sb_leds) set global.sb_leds = "ready"
I said i was going to add the sub macro's as well, but they contain the same code lines as in their following
else
conditions, so i don't see any need for it. -
undefined Exerqtor marked this topic as a question
-
I don't know if dare to say that I've got it working, so I'll say i THINK i got it working now. At least i haven't made it to derp out once with this config.
It's based on dc42's homing config files, but i had to juice up the SG sen quite alot to make it work. I on the other side now lower the current 20% of normal (1750mA). At 10% the XY drivers starts throwing overtemp warnings, so i figgured 20% would be safe.
For those curious this is how they turned out.
homeall.g:; /sys/homeall.g v2.5 ; Called to home all axes ; Configured for sensorless homing / stall detection on a Duet 3 Mini 5+ and LDO-42STH48-2504AC steppers on XY ;---/ ; -/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/-- ; THIS MACRO ONLY WORKS WITH RRF 3.5.0b1 AND LATER!! ;--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/-- ;-/ ; ====================--------------------------------------------------------- ; Settings section ; ==================== ; Nozzle clearance (gets overridden if you have global.Nozzle_CL) var Clearance = 5 ; The "safe" clearance you want to have between the noszzle and bed before moving the printhead ; XY driver numbers var X = 0.0 ; The driver number for your X (B) stepper var Y = 0.1 ; The driver number for your Y (A) stepper ; Sensorless homing sensitivity var Sen = 8 ; Stall detection sensitivity ; Don't touch anyting beyond this point(unless you know what you're doing)!! ; ====================--------------------------------------------------------- if exists(global.Nozzle_CL) set var.Clearance = {global.Nozzle_CL} ; LED status if exists(global.sb_leds) set global.sb_leds = "homing" ; ====================--------------------------------------------------------- ; Lower Z axis ; ==================== ; If Z isn't allready been lowered ; Lower Z if needed if !move.axes[2].homed ; If Z isn't homed ; Lower Z currents, speed & accel if fileexists("/sys/lib/current/z_current_low.g") M98 P"/sys/lib/current/z_current_low.g" ; Set low Z currents else M913 Z60 ; Set Z motors to n% of their max current if fileexists("/sys/lib/speed/speed_probing.g") M98 P"/sys/lib/speed/speed_probing.g" ; set low speed & accel else M204 P500 T1500 ; Set printing acceleration and travel accelerations (mm/s²) G91 ; Relative positioning G1 Z{var.Clearance} F9000 H1 ; Lower Z(bed) relative to current position G90 ; Absolute positioning if fileexists("/sys/lib/current/z_current_high.g") M98 P"/sys/lib/current/z_current_high.g" ; Restore normal Z currents else M913 Z100 ; Set Z motors to 100% of their max current elif move.axes[2].userPosition < {var.Clearance} ; If Z is homed but less than var.Clearance ; Lower Z currents, speed & accel if fileexists("/sys/lib/current/z_current_low.g") M98 P"/sys/lib/current/z_current_low.g" ; Set low Z currents else M913 Z60 ; Set Z motors to n% of their max current if fileexists("/sys/lib/speed/speed_probing.g") M98 P"/sys/lib/speed/speed_probing.g" ; set low speed & accel else M204 P500 T1500 ; Set printing acceleration and travel accelerations (mm/s²) G1 Z{var.Clearance} F9000 ; Move to Z var.Clearance if fileexists("/sys/lib/current/z_current_high.g") M98 P"/sys/lib/current/z_current_high.g" ; Restore normal Z currents else M913 Z100 ; Set Z motors to 100% of their max current ; ====================--------------------------------------------------------- ; Home all axis ; ==================== M98 P"/sys/homex.g" Z"OK" ; Home X axis and pass param.Z "OK" since we allready lowered Z M98 P"/sys/homey.g" Z"OK" ; Home Y axis and pass param.Z "OK" since we allready lowered Z M98 P"/sys/homez.g" Z"OK" ; Home Z axis and pass param.Z "OK" since we allready lowered Z ; ====================--------------------------------------------------------- ; Finish up ; ==================== ; LED status if exists(global.sb_leds) set global.sb_leds = "ready"
homex.g:
; /sys/homex.g v2.5 ; called to home the X axis ; Configured for sensorless homing / stall detection on a Duet 3 Mini 5+ and LDO-42STH48-2504AC steppers on XY ;---/ ; -/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/-- ; THIS MACRO ONLY WORKS WITH RRF 3.5.0b1 AND LATER!! ;--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/-- ;-/ ; ====================--------------------------------------------------------- ; Settings section ; ==================== ; Nozzle clearance (gets overridden if you have global.Nozzle_CL) var Clearance = 5 ; The "safe" clearance you want to have between the noszzle and bed before moving the printhead ; XY driver numbers var X = 0.0 ; The driver number for your X (B) stepper var Y = 0.1 ; The driver number for your Y (A) stepper ; Sensorless homing sensitivity var Sen = 50 ; Stall detection sensitivity ; Step Back Distance var SBD = 2 ; The distance in mm that the head moves back before homing ; XY Currrent Reduction var CR = 20 ; The % of the XY stepper max current you want to be set during homing ; Don't touch anyting beyond this point(unless you know what you're doing)!! ; ====================--------------------------------------------------------- if exists(global.Nozzle_CL) set var.Clearance = {global.Nozzle_CL} ; LED status if exists(global.sb_leds) set global.sb_leds = "homing" ; ====================--------------------------------------------------------- ; Lower Z axis ; ==================== ; If Z isn't allready been lowered if !exists(param.Z) ; Lower Z if needed if !move.axes[2].homed ; If Z isn't homed ; Lower Z currents, speed & accel if fileexists("/sys/lib/current/z_current_low.g") M98 P"/sys/lib/current/z_current_low.g" ; Set low Z currents else M913 Z60 ; Set Z motors to n% of their max current if fileexists("/sys/lib/speed/speed_probing.g") M98 P"/sys/lib/speed/speed_probing.g" ; set low speed & accel else M204 P500 T1500 ; Set printing acceleration and travel accelerations (mm/s²) G91 ; Relative positioning G1 Z{var.Clearance} F9000 H1 ; Lower Z(bed) relative to current position G90 ; Absolute positioning if fileexists("/sys/lib/current/z_current_high.g") M98 P"/sys/lib/current/z_current_high.g" ; Restore normal Z currents else M913 Z100 ; Set Z motors to 100% of their max current elif move.axes[2].userPosition < {var.Clearance} ; If Z is homed but less than var.Clearance ; Lower Z currents, speed & accel if fileexists("/sys/lib/current/z_current_low.g") M98 P"/sys/lib/current/z_current_low.g" ; Set low Z currents else M913 Z60 ; Set Z motors to n% of their max current if fileexists("/sys/lib/speed/speed_probing.g") M98 P"/sys/lib/speed/speed_probing.g" ; set low speed & accel else M204 P500 T1500 ; Set printing acceleration and travel accelerations (mm/s²) G1 Z{var.Clearance} F9000 ; Move to Z var.Clearance if fileexists("/sys/lib/current/z_current_high.g") M98 P"/sys/lib/current/z_current_high.g" ; Restore normal Z currents else M913 Z100 ; Set Z motors to 100% of their max current ; ====================--------------------------------------------------------- ; Home X axis ; ==================== ; Turn off the X stepper M84 X ; Disable X axis stepper(don't know why, but it's needed for now) M400 ; Wait for moves to finish ; Enable stealthChop on XY steppers M569 P{var.X} S0 D3 V10 ; Set X axis driver in stealthChop mode M569 P{var.Y} S0 D3 V10 ; Set Y axis driver in stealthChop mode ; Enable sensorless homing M574 X2 Y2 S4 ; Configure sensorless endstop for high end on X & Y ; Lower XY currents, speed & accel if fileexists("/sys/lib/current/xy_current_low.g") M98 P"/sys/lib/current/xy_current_low.g" C{var.CR} ; Set low XY currents and pass param.C with the values set here else M913 X{var.CR} Y{var.CR} ; Set X Y motors to var.CR% of their max current if fileexists("/sys/lib/speed/speed_probing.g") M98 P"/sys/lib/speed/speed_probing.g" ; Set low speed & accel else M204 P500 T1500 ; Set printing acceleration and travel accelerations (mm/s²) M400 ; Wait for current moves to finish ; Stall detection parameters M915 X Y S{var.Sen} F0 R0 H200 ; Set stall detection sensitivity(-128 to +127), filter mode, action type and minimum motor full steps per second P{var.X}:{var.Y} M400 ; Wait for moves to finish G91 ; Relative positioning ; Unflag stalls G1 X1.0 Y-1.0 F300 H2 ; Energise motors and move them 1mm in the -X direction to ensure they are not stalled ; Home X axis G1 X600 F3000 H1 ; Move X axis max and stop there G1 X{0 -var.SBD} F2000 ; Move away from axis max G1 X600 F3000 H1 ; Move X axis max and stop there G1 X{0 -var.SBD} F2000 ; Move away from axis max M400 ; Wait for moves to finish G90 ; Absolute positioning ; Enable spread cycle on XY steppers M569 P{var.X} S0 D2 ; Set X axis driver in spread cycle mode M569 P{var.Y} S0 D2 ; Set Y axis driver in spread cycle mode ; ====================--------------------------------------------------------- ; Finish up ; ==================== ; Restore XY currents, speed & accel if fileexists("/sys/lib/current/xy_current_high.g") M98 P"/sys/lib/current/xy_current_high.g" ; Set high XY currents else M913 X100 Y100 ; Set X Y motors to var.100% of their max current if fileexists("/sys/lib/speed/speed_printing.g") M98 P"/sys/lib/speed/speed_printing.g" ; Set high speed & accel else M204 P1500 T3000 ; Set printing acceleration and travel accelerations (mm/s²) ; LED status if exists(global.sb_leds) set global.sb_leds = "ready"
-
homey.g:
; /sys/homey.g v2.5 ; called to home the Y axis ; Configured for sensorless homing / stall detection on a Duet 3 Mini 5+ and LDO-42STH48-2504AC steppers on XY ;---/ ; -/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/-- ; THIS MACRO ONLY WORKS WITH RRF 3.5.0b1 AND LATER!! ;--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/-- ;-/ ; ====================--------------------------------------------------------- ; Settings section ; ==================== ; Nozzle clearance (gets overridden if you have global.Nozzle_CL) var Clearance = 5 ; The "safe" clearance you want to have between the noszzle and bed before moving the printhead ; XY driver numbers var X = 0.0 ; The driver number for your X (B) stepper var Y = 0.1 ; The driver number for your Y (A) stepper ; Sensorless homing sensitivity var Sen = 80 ; Stall detection sensitivity ; Step Back Distance var SBD = 2 ; The distance in mm that the head moves back before homing ; XY Currrent Reduction var CR = 20 ; The % of the XY stepper max current you want to be set during homing ; Don't touch anyting beyond this point(unless you know what you're doing)!! ; ====================--------------------------------------------------------- if exists(global.Nozzle_CL) set var.Clearance = {global.Nozzle_CL} ; LED status if exists(global.sb_leds) set global.sb_leds = "homing" ; ====================--------------------------------------------------------- ; Lower Z axis ; ==================== ; If Z isn't allready been lowered if !exists(param.Z) ; Lower Z if needed if !move.axes[2].homed ; If Z isn't homed ; Lower Z currents, speed & accel if fileexists("/sys/lib/current/z_current_low.g") M98 P"/sys/lib/current/z_current_low.g" ; Set low Z currents else M913 Z60 ; Set Z motors to n% of their max current if fileexists("/sys/lib/speed/speed_probing.g") M98 P"/sys/lib/speed/speed_probing.g" ; set low speed & accel else M204 P500 T1500 ; Set printing acceleration and travel accelerations (mm/s²) G91 ; Relative positioning G1 Z{var.Clearance} F9000 H1 ; Lower Z(bed) relative to current position G90 ; Absolute positioning if fileexists("/sys/lib/current/z_current_high.g") M98 P"/sys/lib/current/z_current_high.g" ; Restore normal Z currents else M913 Z100 ; Set Z motors to 100% of their max current elif move.axes[2].userPosition < {var.Clearance} ; If Z is homed but less than var.Clearance ; Lower Z currents, speed & accel if fileexists("/sys/lib/current/z_current_low.g") M98 P"/sys/lib/current/z_current_low.g" ; Set low Z currents else M913 Z60 ; Set Z motors to n% of their max current if fileexists("/sys/lib/speed/speed_probing.g") M98 P"/sys/lib/speed/speed_probing.g" ; set low speed & accel else M204 P500 T1500 ; Set printing acceleration and travel accelerations (mm/s²) G1 Z{var.Clearance} F9000 ; Move to Z var.Clearance if fileexists("/sys/lib/current/z_current_high.g") M98 P"/sys/lib/current/z_current_high.g" ; Restore normal Z currents else M913 Z100 ; Set Z motors to 100% of their max current ; ====================--------------------------------------------------------- ; Home Y axis ; ==================== ; Turn off the Y stepper M84 Y ; Disable Y axis stepper(don't know why, but it's needed for now) M400 ; Wait for moves to finish ; Enable stealthChop on XY steppers M569 P{var.X} S0 D3 V10 ; Set X axis driver in stealthChop mode M569 P{var.Y} S0 D3 V10 ; Set Y axis driver in stealthChop mode ; Enable sensorless homing M574 X2 Y2 S4 ; Configure sensorless endstop for high end on X & Y ; Lower XY currents, speed & accel if fileexists("/sys/lib/current/xy_current_low.g") M98 P"/sys/lib/current/xy_current_low.g" C{var.CR} ; Set low XY currents and pass param.C with the values set here else M913 X{var.CR} Y{var.CR} ; Set X Y motors to var.CR% of their max current if fileexists("/sys/lib/speed/speed_probing.g") M98 P"/sys/lib/speed/speed_probing.g" ; Set low speed & accel else M204 P500 T1500 ; Set printing acceleration and travel accelerations (mm/s²) M400 ; Wait for current moves to finish ; Stall detection parameters M915 X Y S{var.Sen} F0 R0 H200 ; Set stall detection sensitivity(-128 to +127), filter mode, action type and minimum motor full steps per second P{var.X}:{var.Y} M400 ; Wait for moves to finish G91 ; Relative positioning ; Unflag stalls G1 X-1.0 Y1.0 F300 H2 ; Energise motors and move them 1mm in the -Y direction to ensure they are not stalled ; Home Y axis G1 Y600 F3000 H1 ; Move Y axis max and stop there G1 Y{0 -var.SBD} F2000 ; Move away from axis max G1 Y600 F3000 H1 ; Move Y axis max and stop there G1 Y{0 -var.SBD} F2000 ; Move away from axis max M400 ; Wait for moves to finish G90 ; Absolute positioning ; Enable spread cycle on XY steppers M569 P{var.X} S0 D2 ; Set X axis driver in spread cycle mode M569 P{var.Y} S0 D2 ; Set Y axis driver in spread cycle mode ; ====================--------------------------------------------------------- ; Finish up ; ==================== ; Restore XY currents, speed & accel if fileexists("/sys/lib/current/xy_current_high.g") M98 P"/sys/lib/current/xy_current_high.g" ; Set high XY currents else M913 X100 Y100 ; Set X Y motors to var.100% of their max current if fileexists("/sys/lib/speed/speed_printing.g") M98 P"/sys/lib/speed/speed_printing.g" ; Set high speed & accel else M204 P1500 T3000 ; Set printing acceleration and travel accelerations (mm/s²) ; LED status if exists(global.sb_leds) set global.sb_leds = "ready"
homez.g:
; /sys/homez.g v2.5 ; Called to home the Z axis with probe K0 ;---/ ; -/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/-- ; THIS MACRO ONLY WORKS WITH RRF 3.5.0b1 AND LATER!! ;--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/-- ;-/ ; ====================--------------------------------------------------------- ; Settings section ; ==================== ; Nozzle clearance (gets overridden if you have global.Nozzle_CL) var Clearance = 5 ; The "safe" clearance you want to have between the noszzle and bed before moving the printhead ; Don't touch anyting bellow this point(unless you know what you're doing)!! ; ====================--------------------------------------------------------- if exists(global.Nozzle_CL) set var.Clearance = {global.Nozzle_CL} ; LED status if exists(global.sb_leds) set global.sb_leds = "homing" ; ====================--------------------------------------------------------- ; Lower Z axis ; ==================== ; If Z isn't allready been lowered if !exists(param.Z) ; Lower Z if needed if !move.axes[2].homed ; If Z isn't homed ; Lower Z currents, speed & accel if fileexists("/sys/lib/current/z_current_low.g") M98 P"/sys/lib/current/z_current_low.g" ; Set low Z currents else M913 Z60 ; Set Z motors to n% of their max current if fileexists("/sys/lib/speed/speed_probing.g") M98 P"/sys/lib/speed/speed_probing.g" ; set low speed & accel else M204 P500 T1500 ; Set printing acceleration and travel accelerations (mm/s²) G91 ; Relative positioning G1 Z{var.Clearance} F9000 H1 ; Lower Z(bed) relative to current position G90 ; Absolute positioning if fileexists("/sys/lib/current/z_current_high.g") M98 P"/sys/lib/current/z_current_high.g" ; Restore normal Z currents else M913 Z100 ; Set Z motors to 100% of their max current elif move.axes[2].userPosition < {var.Clearance} ; If Z is homed but less than var.Clearance ; Lower Z currents, speed & accel if fileexists("/sys/lib/current/z_current_low.g") M98 P"/sys/lib/current/z_current_low.g" ; Set low Z currents else M913 Z60 ; Set Z motors to n% of their max current if fileexists("/sys/lib/speed/speed_probing.g") M98 P"/sys/lib/speed/speed_probing.g" ; set low speed & accel else M204 P500 T1500 ; Set printing acceleration and travel accelerations (mm/s²) G1 Z{var.Clearance} F9000 ; Move to Z var.Clearance if fileexists("/sys/lib/current/z_current_high.g") M98 P"/sys/lib/current/z_current_high.g" ; Restore normal Z currents else M913 Z100 ; Set Z motors to 100% of their max current ; ====================--------------------------------------------------------- ; Home Z axis ; ==================== ; Lower currents M98 P"/sys/lib/current/xy_current_low.g" ; Set low XY currents ; Move to bed center and home Z M98 P"/sys/lib/goto/bed_center.g" ; Move to bed center M98 P"/sys/lib/speed/speed_probing.g" ; Set low speed & accel G30 K0 Z-99999 ; Probe the center of the bed M400 ; Wait for moves to finish ; ====================--------------------------------------------------------- ; Finish up ; ==================== ; Full currents, speed & accel M98 P"/sys/lib/current/z_current_high.g" ; Restore normal Z currents M98 P"/sys/lib/current/xy_current_high.g" ; Set high XY currents M98 P"/sys/lib/speed/speed_printing.g" ; Restore normal speed & accels ; Uncomment the following lines to lower Z(bed) after probing G90 ; Absolute positioning G1 Z{var.Clearance} F2400 ; Move to Z var.Clearance ; If using Voron TAP, report that probing is completed if exists(global.TAPPING) set global.TAPPING = false M402 P0 ; Return the hotend to the temperature it had before probing ;LED status if exists(global.sb_leds) set global.sb_leds = "ready"
xy_current_low.g:
; /sys/lib/current/xy_current_low.g v2.2 ; Called when homing and probing ; Used to set X Y motor currents for homing and probing ; Stepper current % var PCT = 40 ; Set the % of the stepper max current you want to be set! ; Don't touch anyting bellow this point! ; ----------------------------------------------------------------------------- ; External reduction if exists(param.C) set var.PCT = {param.C} ; Set var.PCT to the value from the external parameter M913 X{var.PCT} Y{var.PCT} ; Set X Y motors to var.PCT % of their max current echo "XY steppers at " ^ var.PCT ^ "% of max current!" if exists(global.xy_current) set global.xy_current = move.axes[0].current
I still haven't heated up the chamber to see how stallguard reacts when the steppers is at 50-65°C+, but that's next test.
Edit
No issues with a heat soaked chamber at 67°C . A 22sec video say more than a couple 100 lines of code, so here you go!
-
undefined Exerqtor has marked this topic as solved