I'm trying to set up sensorless homing with a Duet2 board. According to the schematics all the SG_TST outputs are or'ed together into PB5. The datasheet of the TMC2660 says it outputs high on SG_TST if a stall is detected. Sitting idle the endstops are triggered, so PB5 is high. Do I need to configure something to reset the drivers so I'm low/not triggered if idle and before homing?
#TMC2660 sensorless homing on Duet2
12 messages · Page 1 of 1 (latest)
Little follow-up: If I power cycle the board, PB5 is low until the next Stallguard trigger. Doesn't reset though. So there is some kind of reset needed?
So the TMC2660 seems to only reset the Stallguard flag once the stepper moved at least one step in any direction. This problem could probably be resolved with some macro trickery.
Yep, it works like that. Here's the relevant stuff for whoever is looking for this.
Example motor config, most important is the endstop_pin.
[duplicate_pin_override]
pins: PC6, PB5
###############################################
# B Motor #
###############################################
[stepper_x]
step_pin: PD5
dir_pin: PA1
enable_pin: !PC6
microsteps: 64
homing_speed: 40
homing_retract_dist: 0
rotation_distance: 40
position_endstop: 250
position_max: 250
endstop_pin: ~PB5
[tmc2660 stepper_x]
cs_pin: PC17
spi_bus: usart1
run_current: 0.849
sense_resistor: 0.051
interpolate: False
driver_SGT: 2
In your homing_override macro you should include a tiny move on x and y to reset the TMC2660 before doing the actual homing.
Oh man. I need to try this. I have the Duet2 and I’m switching to klipper to allow CanBUS. Thanks for testing this.
Curious why you have pc6 as a duplicate pin?
oh I see, PC6 is the common enable pin. My config was fine with it duplicated. The stepper config you posted worked perfectly. Thank you so much!
You're very welcome!
Do you know if there is a way to continuously check the SG value and tune the stallguard with SGT, speed, and current? The tmc2660 DS says this is how to tune it.
That's a good question. I'm not sure if this is possible with Klipper inbetween. I tuned it the "official" way by manually adjusting SGT, speed and current until I was happy with the result. It's a bit more rough than with the newer Stallguard versions, but it worked just fine.
k, thanks. I was having mixed results with 40mm/s homing speed. I increased the speed as high as 100mm/s and I think it was better. I also have been trying SFLT (filtering) because I have 0.9deg motors.
Yes I needed pretty high speed for okayish results. Reducing current helped a lot too