[Solved] Stall detection for homing issue

  • Hello,
    i have some trouble to find the correct setting for configuring the stall detection on the X axe.
    When i hit the HomeX button the Xcarriage move back about 5 or 10mm before trigg the stall and set the X=0
    For now i only want to run it on the X.
    My setup:

    • Print type: CoreXY

    • PSU: 12V

    • Firmware: 1.20

    • GT2 pulley: 20 tooth

    • Nema17:

      • Model: 42BYGHW811
      • Step angle: 1.8°
      • Steps per rev: 200
      • Rate Voltage: 3.1 V
      • Rate Current: 2.5 A
      • Phase Resistance: 1.25 Ω
      • Phase Inductance: 1.8 mH
      • Holding Torque: 4.8 kg.cm = 0.47Nm
      • Rotor Inertia: 68 g.cm²
      • Detent Torque: 0.280 kg.cm
    • Desired speed during home: 5000(mm/min) = 85mm/sec

    • Max belt speed during diagonal movement: 85/sqrt(2) = 60.1mm/sec

    • Revs per second: 60.1/(2 * 20) = 1.5

    • Peak back emf with 1A (60% rated current for cold motor):
      revs_per_second * pi * motor_current * motor_inductance * N/2
      1.5 * 3.1415926 * 1 * 1.8e-3 * 200/2 =** 0.85V**

    • Approximate back emf due to rotation:
      sqrt(2) * pi * rated_holding_torque * revs_per_second / rated_current
      1.414 * 3.1415926 * 0.47 * 1.5 / 2.5 = 1.25V

    So i think my 12v are enouth to run stall detection but i can't find a value for get it run good.

    My config.g:

    # code block
    M667 S1						; set CoreXY mode
    M569 P0 S1					; X motor runs forwards
    M569 P1 S1	 	 	 	 	; Y motor runs forwards
    M569 P2 S0	 	 	 	 	; Z Drive 2 goes forwards
    M569 P3 S1	 	 	 	 	; E Drive 3 goes forwards
    M915 X S5 F1 H200 R0				; set stall detection for X axis
    M574 X1 S3		            		; set endstop configuration (X1 is at MIN end. (stall detection = S3)
    M574 Y2 S0					; set endstop configuration (Y2 is at MAX end. (active low mec.switch = S0)
    M574 Z1 S2					; set endstop configuration (Z1 is at MIN end. (Z probe = S2)
    M350 X16 Y16 Z16 E16 I1				; Set 16x microstepping with interpolation
    M92 X80 Y80 Z800            			; Set axis steps/mm.
    M92 E837:100	            			; Set extruder steps/mm. Change this to match your extruder.
    M906 X1000 Y1000 Z1000 E600			; Set motor currents (mA). Increase if motor is to weak.

    My home x:

    # code block
    ; homex.g
    ;homing using a x-MIN endstop
    M400						; make sure everything has stopped before we make changes
    M913 X40					; drop X motor currents to 40%
    G91						; use relative positioning
    G1 Z10 F2000			 	 	; lowers bed 10mm to avoid dragging nozzle over the bed
    G1 S1 X-400  F5000				; move X all the way left and stop at end
    G1 X10						; move to edge of the glass
    G92 X0						; set X0 at the edge of the glass
    G1 Z-10						; rise bed for clearance
    G90						; back to absolute positioning
    M400						; make sure everything has stopped before we reset the motor currents
    M913 X100					; X motor currents back to 100%

    i have tryed different thing:

    • in M915 X S5 F1 H200 R0, i have changed S from 0 to 60, changed F with 0 and 1
    • in M913 X40 i have tryed from X40 to X100

    What can be the problem?
    Can it be that i have to run the stall detect also in the Y because of the coreXY geometry?

  • Stall detection is tricky, but I have got it working nicely and I am very happy with it. With 12V I could home X and Y on a Cartesian, but noz Z. After I switched to 24 V I could home all three axis with Stall.

    On you configuration file

    M915 X S5 F1 H200 R0				; set stall detection for X axis

    Modify/disable the Filter Mode (Replace F1 by F0) . According to Trinamic:

    SFILT=O The filtering is disabled and a change of load is detected within a quarter electrical period that is one full step.
    SFILT=1 The filtering is enabled and a change of load is detected within an electrical period. For higher dynamic change of load the SFILT needs to be switched off.

    Stall depends on the motor parameters, supply voltage, speed, current, and amount of mechanical load. Some additional tuning that you might want to do:

    • The stallGuard trigger value depends on the amplitude of the motor current linked to the supply voltage. Try to further reduce the current and see if you get better results. If the current is too low you will get quick False stalls, from that point increase slowly until the false stalls dissapear.
    • The trigger value varies with the velocity because it bases on the Back-EMF of the stepper motor. You want to hit the endstop at some speed, but with good dynamic margin. Just enough to break the back-EMF is the mest settings that I have found as they allow for lower trigger values (higher sensitivity). Try reducing the speed a little (3000 mm/min) and check again.

  • administrators

    1. Please upgrade your firmware to 1.21. There was a fix done to CoreXY stall detect homing, and I think it may have been implemented after version 1.20.

    2. On a CoreXY machine you must set the same stall parameters (M915) and motor current fraction (M913) on both the X and Y motors before you attempt stall detect homing.

  • Thank you! I have updated to firmware 1.21 and now works fine with:

    M915 X Y S5 F0 H200 R0                   ; set stall detection for XY axis


Looks like your connection to Duet3D was lost, please wait while we try to reconnect.