Sensorless homing X axis going the wrong way sporadically



  • The problem is similar to the one in this post but the thread was locked so I'll try again here : https://forum.duet3d.com/topic/4830/sensorless-homing-oddness/14

    I have a core xy with 400x400mm movement. The Probe scripts works sometimes but often the X axis is going the wrong direction and it ends up crashing. I've tried to increase the current up to 100% but it still wanders off to X minus when everything is set for X positive. Anyone else had this problem?

    This is in the config.g file:
    M574 X2 Y1 Z0 S3
    M584 X0 Y1 Z2:5:6 E3:4
    M915 P0:1 S5 R1

    and this is in my X home script:

    M0 ; make sure everything has stopped before we make changes
    M913 X100 Y100 ; reduce motor current to 50% to prevent belts slipping
    G91 ; use relative positioning
    G1 S1 X500 F2410 ; move all carriages up 500mm, stopping at the endstop
    G90 ; back to absolute positioning
    M400 ; make sure everything has stopped before we reset the motor currents
    M913 X100 Y100 ; motor currents back to normal
    G1 X1 F5000 ; centre the head and set a reasonable feed rate
    M400 ;wait for current moves to finnish
    G92 X0 ; giving 1mm clearance on bumpstop.

    The steppers are 42BYGHW804 1.8degree, 3.6V/1.2A, resistance 3ohm, 5mH inductance, 4800G.cm holding torque

    Firmware Name: RepRapFirmware for Duet 2 WiFi/Ethernet
    Firmware Electronics: Duet WiFi 1.0 or 1.01 + DueX2
    Firmware Version: 2.02RC3(RTOS) (2018-10-17b2)
    WiFi Server Version: 1.21
    Web Interface Version: 1.22.4-b1

    https://lokalhost.org/3d/homex.txt <-- homex.g
    https://lokalhost.org/3d/config.txt <-- config.g

    Edit:
    Now when I lower current to 20% I can always home to correct direction on the first "Home X" after i reset the printer. The second time it always goes the wrong way. I also tried a M18 to "release" the X home position but it still goes the wrong way.


  • administrators

    What I think is happening is that when you send the G1 S1 X command to do the homing move, sometimes the stall flag is already set. Try doing a G1 S2 Xnn Ynn Fxxx move immediately before that G1 S1 move, to enable the motors and clear the stall flag. Choose a positive or negative value of nn so that the move is at least 2 full steps long.

    Alternatively, after the G1 S1 X move, back off a few mm and repeat it.



  • Is there any way to check if the stall flag is set? Now I home it and then I move the X axis to center of axis just so I have time to stop it if it goes the wrong way so it shouldn’t be stalling. So it’s not like it’s stopped at the end stop or anything.

    If it’s a feature and not a bug I can’t really use sensorless homing as it’s not fun watching your printer go by random in and hammer on the wrong end of the axis without stopping 😛

    It works perfect now that I know I have to reset my printer with the emergency button before homing. If I try to home after home has been set it always goes the wrong way and hammer on the axis until I’m able to stop it.


  • administrators

    Did you try my suggestions?



  • Yes I tried it now. I added G1 S2 X2 Y2 F500 upfront and it works as a workaround but how can I see if the stall flag is set? Can I make it a condition in the home code somehow?


  • administrators

    The M122 command reports the motor status, including stall.



  • I'll do some testing with this later tonight. If this is the case could I suggest for later releases to just throw a homing error if it detects a stall at the start of homing? It's easy to break stuff when it suddenly goes hard into the wrong side without stopping upon stall. The sensorless homing is awesome when it works 😄



  • After a X homeing + moving it +50 on the jog buttons.
    Driver 0: standstill, SG min/max 328/1023
    Driver 1: standstill, SG min/max 308/1023
    Driver 2: standstill, SG min/max not available
    Driver 3: standstill, SG min/max not available
    Driver 4: standstill, SG min/max not available
    Driver 5: standstill, SG min/max not available
    Driver 6: standstill, SG min/max not available
    Expansion motor(s) stall indication: yes

    After executing G1 X2 F200
    Driver 0: standstill, SG min/max not available
    Driver 1: standstill, SG min/max not available
    Driver 2: standstill, SG min/max not available
    Driver 3: standstill, SG min/max not available
    Driver 4: standstill, SG min/max not available
    Driver 5: standstill, SG min/max not available
    Driver 6: standstill, SG min/max not available
    Expansion motor(s) stall indication: yes

    I assume that min/max is related to stall? This is the only difference I Can find in the M122 command.


  • administrators

    The min/max is the min and max readouts of the stallguard register since you last ran M122. The values for other drives are not available because you haven't moved them yet.


 

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