I’ve been wanting to try out the TMC2240 and I finally have a few cycles to do so.
I’ve loaded four of them up on a Manta M4P and started working on the printer.cfg for a single one to see if SPI communications would work.
The expectation that I have to verify that SPI communications with the TMC2240 was working was a) I wouldn’t get any Klipper startup errors and b) its temperature would be reported on the Mainsail dashboard.
This is the only exception in the Klipper code, they are defined as “temperature_monitors”
So, they are only active if motors are enabled.
This is done that way because it is possible that the user can disable the power of the stepper driver with motor disable, and so the SPI read would fail.
Hope that clarifies a thing.
Btw, because of how they are used inside the code, they do use SG2 (like TMC5160), instead of SG4 (like TMC2209). Also, they do support jerkless switch of stealth to spread and vise versa.
IIRC they do support SPI 10MHz, so you can check the signal quality by trying to increase it from the current default of 4MHz
BTW2:
This funny thing can actually show how good your stepper motors are in a way
TMC_CALIBRATE STEPPER=stepper_0
If both coils are symmetrical, they are pretty decent, I would say.
(phase offsets are in degrees).
Okay, thanx that’s really helpful - so, with what I’ve done above, I couldn’t be sure if I was actually communicating with the TMC2240.
Moving forward but not quite where I want to be yet.
I can enable the stepper and the temperature starts displaying (about 20C higher than I would expect and 10C higher than what I see using my thermal imager) - at the same time, the stepper output shaft cannot be moved easily, so I’m comfortable that this is working.
Next, I set the position to 0 and then move 20 mm (which is 180 degrees shaft rotation) which is expected.
When I try to do a homing operation (using MANUAL_STEPPER MOVE=40 STOP_ON_ENDSTOP=1 STEPPER=stepper_0) no movement and no error messages. I started with SGT set to 0 and then 32 and -32 to see if it was a range problem. There’s no movement regardless of the SGT value.
Yeah, I referenced that when I was first trying things - that’s why I started with diag0_pin set to 0 as that’s what @DrumClock used for his SGT value.
I moved the stepper to the “Y” driver and everything worked without the issue reported previously.
NOTE: “X” and “Y” are how the drivers are referenced in the User Manual, schematics and pinout drawing, so I’m following that convention here even though when you look at how I set up the manual_stepper definitions I used stepper_0 and stepper_1
I then went through the test process for run_current of 0.58A and 0.30A, as well as stealthchop_threshold of 0 and 999999 to find what I thought was the right SGT value.
The results are as follows (using my half-assed binary search approach):
driver_SGT: 32 # 0.30A/stealthchop_threshold: 0/Check 1/Move to Grind against post with message "No trigger on manual_stepper stepper_1 after full movement"
driver_SGT: 16 # 0.30A/stealthchop_threshold: 0/Check 2/Move to Grind against post with message "No trigger on manual_stepper stepper_1 after full movement"
driver_SGT: 8 # 0.30A/stealthchop_threshold: 0/Check 3/Move to Grind against post with message "No trigger on manual_stepper stepper_1 after full movement"
driver_SGT: 4 # 0.30A/stealthchop_threshold: 0/Check 4/Move to Grind against post with message "No trigger on manual_stepper stepper_1 after full movement"
driver_SGT: 2 # 0.30A/stealthchop_threshold: 0/Check 5/Seems to work Correctly <== This is the middle point
driver_SGT: 0 # 0.30A/stealthchop_threshold: 0/Check 6/Partial move - no message
driver_SGT: 1 # 0.30A/stealthchop_threshold: 0/Check 7/Seems to work Correctly
driver_SGT: 3 # 0.30A/stealthchop_threshold: 0/Check 8/Seems to work Correctly
driver_SGT: 32 # 0.30A/stealthchop_threshold: 999999/Check 1/Move to Grind against post with message "No trigger on manual_stepper stepper_1 after full movement"
driver_SGT: 16 # 0.30A/stealthchop_threshold: 999999/Check 2/Move to Grind against post with message "No trigger on manual_stepper stepper_1 after full movement"
driver_SGT: 8 # 0.30A/stealthchop_threshold: 999999/Check 3/Move to Grind against post with message "No trigger on manual_stepper stepper_1 after full movement"
driver_SGT: 4 # 0.30A/stealthchop_threshold: 999999/Check 4/Move to Grind against post with message "No trigger on manual_stepper stepper_1 after full movement"
driver_SGT: 0 # 0.30A/stealthchop_threshold: 999999/Check 5/Partial move - no message
driver_SGT: 2 # 0.30A/stealthchop_threshold: 999999/Check 6/Seems to work Correctly <== This is the middle point
driver_SGT: 1 # 0.30A/stealthchop_threshold: 999999/Check 7/Seems to work Correctly
driver_SGT: 3 # 0.30A/stealthchop_threshold: 999999/Check 8/Seems to work Correctly
driver_SGT: 32 # 0.58A/stealthchop_threshold: 999999/Check 1/Move to Grind against post with message "No trigger on manual_stepper stepper_1 after full movement"
driver_SGT: 16 # 0.58A/stealthchop_threshold: 999999/Check 2/Move to Grind against post with message "No trigger on manual_stepper stepper_1 after full movement"
driver_SGT: 8 # 0.58A/stealthchop_threshold: 999999/Check 3/Move to Grind against post with message "No trigger on manual_stepper stepper_1 after full movement"
driver_SGT: 4 # 0.58A/stealthchop_threshold: 999999/Check 4/Seems to work Correctly
driver_SGT: 2 # 0.58A/stealthchop_threshold: 999999/Check 5/Seems to work Correctly
driver_SGT: 0 # 0.58A/stealthchop_threshold: 999999/Check 6/Partial move - no message
driver_SGT: 1 # 0.58A/stealthchop_threshold: 999999/Check 7/Partial move - no message
driver_SGT: 3 # 0.58A/stealthchop_threshold: 999999/Check 8/Seems to work Correctly <== This is the middle point
driver_SGT: 5 # 0.58A/stealthchop_threshold: 999999/Check 9/Move to Grind against post with message "No trigger on manual_stepper stepper_1 after full movement"
So, I seemed to get a SGT value range of 3 for sensorless homing to work with the TMC2240 - this was surprising as I’m more familiar with the TMC2209 which has a threshold range of 20 to 40, depending on the application. The comment “This is the middle point” was put in when I determined that is was actually the middle point by seeing that the adjacent values also seemed to work correctly.
For poops and giggles, I connected another stepper motor to the “X” port (where I was having the problems reported above) - my expectation was I’d see the same results and I’d replace the TMC2240 driver module.
To my surprise, the original “X” axis driver ran fine and matched the results found for the “Y” axis driver.
Three comments:
I was surprised to see that the rreported TMC2240 operating temperature was dependent on the run_current specification - the higher the run_current, the higher the initial and ongoing temperature.
The SGT range is very narrow on the TMC2240. It seems to be rock solid in terms of repeatability. If you’re going to use the TMC2240 with sensorless homing, then you’re going to have to use an approach like I did above and determine all the SGT values that provide working sensorless homing and select one that’s in the middle.
I have no idea why I had the “A” side short to ground. As I indicated, I turned off the drivers last night but left the board powered up. Mainsail was still active and I was still logged in with SSH so there doesn’t seem to have been a power glitch or any other problem. I’m going to watch this driver going forward…
So, the next step is to wire this M4P with the TMC2240s into a printer and see how it works.