Welcome! Log In Create A New Profile


Unable to get TMC2130 sensorless homing working

Posted by wamonite 
Unable to get TMC2130 sensorless homing working
April 15, 2018 09:32AM
I've replaced my stepper drivers on my RAMPS board with TMC2130s and they're working nicely except I can't seem to get sensorless homing working and unsure how to further debug.

Drivers were bought direct from Watterrot and M122 is returning valid looking driver register values, so it's not an SPI mode or CFG4/CFG5 issue on the driver boards. SPI CS pins were moved to AUX2 as I have an LCD panel. I've double checked that the DIAG1 pin is correct (closest to the potentiometer) and that the cables to endstop min pins are ok.

Stealthchop is working very well with my existing endstops, but with senseless homing enabled (even with sensitivity -63) both X and Y run into the ends and don't stop until reset. Once it's working, will try with spreadcycle using the modification mentioned here.

Marlin is at the latest bugfix-1.1.x (as of 2018/04/15), platformio is reporting libraries up to date, and here's my config (EEPROM values loaded from defaults) .

M122 output

                X       Y       Z       E0
Enabled         false   false   false   false
Set current     600     600     1000    600
RMS current     581     581     994     581
MAX current     819     819     1402    819
Run current     18/31   18/31   17/31   18/31
Hold current    9/31    9/31    8/31    9/31
CS actual               9/31    9/31    8/31    9/31
PWM scale       68      64      47      36
vsense          1=.18   1=.18   0=.325  1=.18
stealthChop     true    true    true    true
msteps          16      16      16      16
tstep           1048575 1048575 1048575 1048575
threshold               0       0       0       0
[mm/s]          -       -       -       -
OT prewarn      false   false   false   false
OT prewarn has
been triggered  false   false   false   false
off time                5       5       5       5
blank time      24      24      24      24
-end            2       2       2       2
-start          3       3       3       3
Stallguard thrs 8       8       0       0
DRVSTATUS       X       Y       Z       E0
stallguard              X       X
sg_result               0       0       0       0
stst            X       X       X       X
Driver registers:       X = 0x81:09:00:00
        Y = 0x81:09:00:00
        Z = 0x80:08:00:00
        E0 = 0x80:09:00:00

M119 output

Reporting endstop status
x_min: open
y_min: open
z_min: open

Happy to look at the code or try alternative sketches, but unsure where to look first. Any pointers would be appreciated.
Re: Unable to get TMC2130 sensorless homing working
April 15, 2018 05:48PM
Stripped the RAMPS board down to a single TMC2130, took the belt off a stepper motor and installed the stallGuard example sketch. The serial plotter output showed stallGuard was working fine and behaved as expected with different thresholds (2 looked a reasonable value). Even wired an LED/resistor to DIAG1 and that was lighting up as expected. Glad it's working in this setup, but also confused and will see if I can add some debug to the Marlin code.
Re: Unable to get TMC2130 sensorless homing working
April 16, 2018 08:19AM
Ok, I'm getting somewhere. The stallGuard example sketch calls diag1_active_high(1) however Marlin does not call diag1_active_high or diag1_pushpull. From the TMC2130 datasheet (page 72) the default output type is low active open drain, which suggests I should enable endstop pull-ups and invert the endstop logic. This is confusing however as several YouTube videos demonstrating configuration and sensorless homing for Marlin specifically disable the pull-ups.

Does anyone know of anyone documentation regarding endstop pull-ups and inverted logic settings for TMC2130 sensorless homing and/or if the behaviour changed in recent releases? As most replies to TMC2130 issues on github start with 'have you tried bugfix-1.1.x as we may have fixed it`, that's what I'm currently running (at 110e6316).

I'm going to wire DIAG1 to a RAMPS digital input with the pull-up enabled and edit the stallGuard example to not enable active high and log the input value. If I'm wrong this could potentially damage the chip, so fingers crossed!
Re: Unable to get TMC2130 sensorless homing working
April 16, 2018 05:04PM
Yep, that was it. Enabling endstop pullups and inverting endstop logic for my TMC2130s fixed my sensorless homing issues. This would have worked in 1.1.8 (although I was having other TMC2130 issues) and changed in bugfix-1.1.x (at 53757444). Thanks for listening winking smiley
Re: Unable to get TMC2130 sensorless homing working
April 16, 2018 08:59PM
You are welcome!!

Did not know you knew I was here. I learn by trial an error or my mistakes (watching in the background learning), in this particular case through your learning process.

Edited 1 time(s). Last edit at 04/16/2018 09:00PM by Roberts_Clif.
Sorry, only registered users may post in this forum.

Click here to login