Sensorless Homing/StallGuard

Hello,
recently i bought a few TMC2130 drivers for my corexy printer. I've managed to made them run, but I'm having some troubles with the sensorless homing function. I've connected diag1 to x_min and y_min(I'm using negative homing, also the sensors are defined as existing in the configuration), so when I initiate a homing command for X or Y, the axis moves to x/y_min and the grinding noise of the motors starts, it takes 10 or more seconds to acknowledge the homing and then it homes. I've tried tweaking the TMC2130_TCOOLTHRS and TMC2130_STALLGUARD but nothing changes no matter what values I set. So  I wouldn't mind any suggestions, and thanks in advance.
P.S. here is my config.


#define DRV_TMC2130

// Uncomment if you use the stall guard for homing. Only for cartesian printers and xy direction
#define SENSORLESS_HOMING

// The drivers with set CS pin will be used, all others are normal step/dir/enable drivers
#define TMC2130_X_CS_PIN 44
#define TMC2130_Y_CS_PIN 64
#define TMC2130_Z_CS_PIN 40
#define TMC2130_EXT0_CS_PIN 42
#define TMC2130_EXT1_CS_PIN -1
#define TMC2130_EXT2_CS_PIN -1

// Per-axis current setting in mA { X, Y, Z, E0, E1, E2}
#define MOTOR_CURRENT { 1000,1000,1000,1000,1000,1000 }

/**  Global settings - these apply to all configured drivers
Per-axis values will override these
*/
#define TMC2130_STEALTHCHOP         1  // Enable extremely quiet stepping
#define TMC2130_INTERPOLATE_256  1  // Enable internal driver microstep interpolation
#define TMC2130_STALLGUARD          0  // Sensorless homing sensitivity (between -63 and +64)

/** PWM values for chopper tuning
only change if you know what you're doing
*/
#define TMC2130_PWM_AMPL          255
#define TMC2130_PWM_GRAD            1
#define TMC2130_PWM_AUTOSCALE    1
#define TMC2130_PWM_FREQ            2

/**  Per-axis parameters

To define different values for certain parameters on each axis,
append either _X, _Y, _Z, _EXT0, _EXT1 or _EXT2
to the name of the global parameter.

Examples for the X axis:

#define TMC2130_STEALTHCHOP_X         1
#define TMC2130_INTERPOLATE_256_X  true
*/

/** Minimum speeds for stall detection.

These values may need to be adjusted if SENSORLESS_HOMING is enabled,
but endstops trigger prematurely or don't trigger at all.
The exact value is dependent on the duration of one microstep,
but good approximations can be determined by experimentation.
*/
#define TMC2130_TCOOLTHRS_X 300
#define TMC2130_TCOOLTHRS_Y 300
#define TMC2130_TCOOLTHRS_Z 300
........................................................................
// ################ Endstop configuration #####################

#define MULTI_ZENDSTOP_HOMING 0
#define ENDSTOP_PULLUP_X_MIN true
#define ENDSTOP_X_MIN_INVERTING true
#define MIN_HARDWARE_ENDSTOP_X true
#define ENDSTOP_PULLUP_Y_MIN true
#define ENDSTOP_Y_MIN_INVERTING true
#define MIN_HARDWARE_ENDSTOP_Y true
#define ENDSTOP_PULLUP_Z_MIN true
#define ENDSTOP_Z_MIN_INVERTING true
#define MIN_HARDWARE_ENDSTOP_Z true
#define ENDSTOP_PULLUP_Z2_MINMAX true
#define ENDSTOP_Z2_MINMAX_INVERTING false
#define MINMAX_HARDWARE_ENDSTOP_Z2 false
#define ENDSTOP_PULLUP_X_MAX true
#define ENDSTOP_X_MAX_INVERTING false
#define MAX_HARDWARE_ENDSTOP_X false
#define ENDSTOP_PULLUP_Y_MAX true
#define ENDSTOP_Y_MAX_INVERTING false
#define MAX_HARDWARE_ENDSTOP_Y false
#define ENDSTOP_PULLUP_Z_MAX true
#define ENDSTOP_Z_MAX_INVERTING false
#define MAX_HARDWARE_ENDSTOP_Z false
#define ENDSTOP_PULLUP_X2_MIN true
#define ENDSTOP_PULLUP_Y2_MIN true
#define ENDSTOP_PULLUP_Z2_MINMAX true
#define ENDSTOP_PULLUP_X2_MAX true
#define ENDSTOP_PULLUP_Y2_MAX true
#define ENDSTOP_X2_MIN_INVERTING false
#define ENDSTOP_Y2_MIN_INVERTING false
#define ENDSTOP_X2_MAX_INVERTING false
#define ENDSTOP_Y2_MAX_INVERTING false
#define MIN_HARDWARE_ENDSTOP_X2 false
#define MIN_HARDWARE_ENDSTOP_Y2 false
#define MAX_HARDWARE_ENDSTOP_X2 false
#define MAX_HARDWARE_ENDSTOP_Y2 false
#define X2_MIN_PIN -1
#define X2_MAX_PIN -1
#define Y2_MIN_PIN -1
#define Y2_MAX_PIN -1
#define Z2_MINMAX_PIN -1



#define max_software_endstop_r true

#define min_software_endstop_x false
#define min_software_endstop_y false
#define min_software_endstop_z false
#define max_software_endstop_x true
#define max_software_endstop_y true
#define max_software_endstop_z true
#define DOOR_PIN -1
#define DOOR_PULLUP 1
#define DOOR_INVERTING 1
#define ENDSTOP_X_BACK_MOVE 5
#define ENDSTOP_Y_BACK_MOVE 5
#define ENDSTOP_Z_BACK_MOVE 2
#define ENDSTOP_X_RETEST_REDUCTION_FACTOR 3
#define ENDSTOP_Y_RETEST_REDUCTION_FACTOR 3
#define ENDSTOP_Z_RETEST_REDUCTION_FACTOR 3
#define ENDSTOP_X_BACK_ON_HOME 3
#define ENDSTOP_Y_BACK_ON_HOME 3
#define ENDSTOP_Z_BACK_ON_HOME 0
#define ALWAYS_CHECK_ENDSTOPS 0
#define MOVE_X_WHEN_HOMED 0
#define MOVE_Y_WHEN_HOMED 0
#define MOVE_Z_WHEN_HOMED 0

// ################# XYZ movements ###################

#define X_ENABLE_ON 0
#define Y_ENABLE_ON 0
#define Z_ENABLE_ON 0
#define DISABLE_X 0
#define DISABLE_Y 0
#define DISABLE_Z 0
#define DISABLE_E 0
#define INVERT_X_DIR 1
#define INVERT_X2_DIR 0
#define INVERT_Y_DIR 1
#define INVERT_Y2_DIR 0
#define INVERT_Z_DIR 1
#define INVERT_Z2_DIR 0
#define INVERT_Z3_DIR 0
#define INVERT_Z4_DIR 0
#define X_HOME_DIR -1
#define Y_HOME_DIR -1
#define Z_HOME_DIR -1
#define X_MAX_LENGTH 220
#define Y_MAX_LENGTH 220
#define Z_MAX_LENGTH 250
#define X_MIN_POS 0
#define Y_MIN_POS 0
#define Z_MIN_POS 0
#define PARK_POSITION_X 0
#define PARK_POSITION_Y 10
#define PARK_POSITION_Z_RAISE 10




Comments

  • Forgot to say that I'm using arduino mega 2560 with ramps 1.5 shield
  • Not sure in how far homing a CoreXY printer is different from a Cartesian, because the comment says "Only for cartesian printers and xy direction", but I assume it should work just fine.

    TMC2130_TCOOLTHRS sets the speed above which StallGuard (= your homing signal) will be enabled (BUT: high TCOOLTHRS value = low speed). During homing, you need StallGuard to be enabled no matter what, so TMC2130_TCOOLTHRS should be set to max (like it is done in Marlin). If the homing speed is too low for StallGuard to work reliably, you might have to increase the homing speed - at least TCOOLTHRS  cannot help with that, IMHO.
        #define TMC2130_TCOOLTHRS_X 1048575
        #define TMC2130_TCOOLTHRS_Y 1048575

    Next, there is TMC2130_STALLGUARD, which can be set via the M914 command. Note that the value range extends to negative values, M914 X-63 Y-63 being the most sensitive (= should cause premature home triggering). If you cannot find a good TMC2130_STALLGUARD value, one which does never result in premature triggering but always detects the homing position instantly, then it is time to play with the motor current and homing speed. Higher motor currents and higher speeds should make StallGuard trigger more reliably. If that does not help, then it might just be that other TMC2130 settings are not suitable for your motors (e.g. PWM freq too high, etc.).














  • I'm not so sure it is the same. A normal cartesian has x move and x motor stalls which gets tested as end stop. For core xy always both motors are active so which is then the x or y end stop. Do they simply stall both same time, are there tests for this special case. 
  • The homing logic might be different, but it should not matter how the endstops are implemented (i.e. via hardware switch or sensorless), because the MCU just sees digital signals in both cases. The difference might be that a hardware endstop possibly allows the motor to move a tiny bit further before stalling, but I cannot see how this would prevent sensorless homing from working. I assume the OP had the setup working with hardware switches before, and now just connected the min/max endstop inputs to the respective DIAG1 outputs instead of the hardware switches, in which case it is just a problem of the driver not signalling the stall.
    If I understand correctly, the firmware does not seem to make a difference between a CoreXY and a Cartesian as far as the high-level homing logic is concerned. However, during X homing StallGuard is activated only for the X motor, during Y homing it is activated only for the Y motor. So depending on which endstops are expected to trigger, e.g. when doing the X homing, this might be an issue (possibly X and Y endstop inputs need to be connected cross-wise to Y and X drivers?). 


  • The problems wasn't in the firmware or in the configuration it was in the drivers, some of the connections on the driver were loose (I bought them from a local shop, and it looks like the drivers were a chinese copy :/ ), so I've resoldered all the connections, and now everything works fine. Also thanks for the responses :)
Sign In or Register to comment.