#diag1_pin:
# The micro-controller pin attached to one of the DIAG lines of the
# TMC2240 chip. Only a single diag pin should be specified. The pin
# is "active low" and is thus normally prefaced with "^!". Setting
# this creates a "tmc2240_stepper_x:virtual_endstop" virtual pin
# which may be used as the stepper's endstop_pin. Doing this enables
# "sensorless homing". (Be sure to also set driver_SGT to an
# appropriate sensitivity value.) The default is to not enable
# sensorless homing.
Adding my two cents here. I don’t have any experience with the '2240 but I do have quite a bit with the TMC2209 and sensorless homing.
First off, please post your klippy.log as well as more information about your printer. You were asked for your klippy.log with the original post and you haven’t put it in here. The information about your set up is woefully inadequate - you haven’t even indicated what kind of printer architecture you’re working with. I’m going to assume a Cartesian (separate X and Y) based on what I see here; if I’m wrong, please correct me. As the last piece of required information, please identify the '2240 driver modules you’re working with; I suspect the discussion about which diag pin is in use is irrelevant and leading in the wrong direction as, according to the datasheet, diag1 is also the UART pin.
You need to provide more information so that we can suggest appropriate courses of action.
Secondly, could you confirm the jumpers for your X/Y axes? You should have two jumpers for each of the axes, one for the serial communications and one for diag. @hcet14 put up a marked up section of the M5P’s schematic and I’ve added where the UART pins should be jumpered here:
The best way to confirm that you’ve put in the jumpers correctly is to post an image of the board with the driver module removed (so the jumper underneath it can be seen).
Third, please document how you’ve tested sensorless homing with different printer.cfg parameters. Putting the information together in a table is very helpful and will lead to getting things running for you faster.
A few comments from what I’ve seen of the conversation:
I’m confused by the use of “1 to +64” and “-1 to -64” for the SGT thresholds in the '2240. When I look at the bit definition in the datasheet:
it appears to me that the correct values should be 127 to 0. I know the datasheet specifies this, but I’m not sure how things are coded in Klipper (the documentation doesn’t list value ranges). I suggest that you assume the values are 127 (high sensitivity) to 0 until this is proven in error.
When I set up sensorless homing, I find that it is a balance between stepper current and the threshold value. I suggest that you reduce your current and try a middle of the range value for SGT to see if the stall is detected.
This goes back to the first comment but I don’t know how Klipper has coded things and I can’t find any examples of anybody getting sensorless homing working with the '2240. You correctly note that '2240’s DIAG output is opposite to the '2209’s but I don’t know if that is accounted for in the Klipper code. You should be checking the diag input as inverted and non-inverted.
I’m sure you’ll get '2240 sensorless homing to work, but it takes a bit of careful stepping through your options and documenting things so there’s no confusion.
Hello friends
it’s a coreXY system and all jumpers are correct.
I tested Sensorless Homing with TMC 2226 (TMC2209) drivers in UART mode
and with TMC 2130 drivers in SPI mode and everything was fine.
Then I wanted to try the TMC 2240 drivers in SPI mode from Makerbase but it didn’t work. Of course I tried the whole rosah -64 to 63 for the driver_SGT: parameter and changing the diag1_pin parameter: ^! but without result.
I ordered new 2240 drivers so I’ll wait for them to arrive and continue testing.
Hi, thank you.
As I wrote above, guidance worked precisely with TMC 2209 and TMC 2130,
but no SGT value worked for TMC2240, so I am ordering new drivers.
Thanks everyone, I’ll get back to you when I have the new drivers.
[homing_override]
axes: z
set_position_z: 0
gcode:
##### get user defines position endstop Z or probe #####
{% set z_endstop_x = 130 %}
{% set z_endstop_y = 150 %}
{% set z_hop = 4 %}
# Always use consistent run_current on A/B steppers during sensorless homing
{% set RUN_CURRENT_X = printer.configfile.settings['tmc2240 stepper_x'].run_current|float %}
{% set RUN_CURRENT_Y = printer.configfile.settings['tmc2240 stepper_y'].run_current|float %}
{% set HOME_CURRENT = 0.700 %}
# Z-hop befor homing - lift nozzle
G91; set relative
# G0 Z{z_hop} F900
G90; set absolute
# Set current during Home XY
SET_TMC_CURRENT STEPPER=stepper_x CURRENT={HOME_CURRENT}
SET_TMC_CURRENT STEPPER=stepper_y CURRENT={HOME_CURRENT}
{% if "x" not in printer.toolhead.homed_axes %}
G4 P2000 # Wait just a second… (give StallGuard registers time to clear)
G28 X0
G1 X10 F1200
{% endif %}
{% if "y" not in printer.toolhead.homed_axes %}
G4 P2000 # Wait just a second… (give StallGuard registers time to clear)
G28 Y0
G1 Y10 F1200
{% endif %}
# Set current during print
SET_TMC_CURRENT STEPPER=stepper_x CURRENT={RUN_CURRENT_X}
SET_TMC_CURRENT STEPPER=stepper_y CURRENT={RUN_CURRENT_Y}
## XY Location of the Z probe
G0 X{z_endstop_x} Y{z_endstop_y} F7200
## HOME Z
# G28 Z0
## Elevator Z
# G0 Z{z_hop} F1800
```