-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TMC2130 SENSORLESS_HOMING only once after power reset #8890
Comments
stallGaurd is read from the DRV_STATUS register which is read only. |
Switching off the motors on the LCD an do a new homing doesn't help. According to the datasheet at least one full step is necessary to clean the flag in DRV_STATUS. Since I'm using auto bed leveling this is done by z safe home, but the flag isn't cleared. In the meantime I made some tests on my X axis. With X_HOMING_SENSITIVITY=25 the flag is cleared and the homing starts, but it detects the collision with the frame to late with this high sensitivity value. After a power reset X_HOMING_SENSITIVITY=8 works the first time, so in my opinion it should also work for futher homings without power reset. |
It seems I've found the cause. I'd disabled STEALTHCHOP and in Marlin_main.cpp in the function void tmc_sensorless_homing(TMC &st, bool enable=true) there is an #ifdef for STEALTHCHOP which also sets the coolstep_min_speed. When I change it like this it works: void tmc_sensorless_homing(TMC &st, bool enable=true) {
if (enable) {
st.coolstep_min_speed(1024UL * 1024UL - 1UL);
#if ENABLED(STEALTHCHOP)
st.stealthChop(0);
#endif
}
else {
st.coolstep_min_speed(0);
#if ENABLED(STEALTHCHOP)
st.stealthChop(1);
#endif
}
st.diag1_stall(enable ? 1 : 0);
} |
i can confirm this behaviour in Marlin 1.1.8. |
+1 - Enabled stealthchop which fixed things for me. Edit: Went with your code change since I'm using a TMC2130 for a direct drive extruder and stealthchop doesn't cut it. |
I encountered this problem as well. I toggle stealth mode on and off in order to reset the stallguard flag. Could not find a better way to do it! This is what my "tmc2130_sensorless_homing" looks like (apologies for all the macros). #define LULZBOT_ENABLE_COOLSTEP_WITH_STALLGUARD(st) \
/* Disable steathchop */ \
st.stealthChop(0); \
/* Enable coolstep for all velocities */ \
st.coolstep_min_speed(1024UL * 1024UL - 1UL); \
st.sg_min(1); \
st.sg_max(3);
#define LULZBOT_ENABLE_STEALTHCHOP(st) \
/* Enable steathchop */ \
st.stealthChop(1); \
/* Disable coolstep */ \
st.coolstep_min_speed(0); \
st.sg_min(0); \
st.sg_max(0);
void tmc2130_sensorless_homing(TMC2130Stepper &st, bool enable=true) {
#if defined(LULZBOT_SENSORLESS_HOMING_TOGGLE)
if (enable) { \
/* Sometimes the X axis refuses to move at the start of G28, */ \
/* because the stallguard is triggered. Toggling in and out */ \
/* of STEALHCHOP mode seems to resolve this. */ \
LULZBOT_ENABLE_STEALTHCHOP(st) \
LULZBOT_ENABLE_COOLSTEP_WITH_STALLGUARD(st) \
} else { \
LULZBOT_DEFAULT_OPERATING_MODE_XY(st) \
}
#elif ENABLED(STEALTHCHOP)
if (enable) {
st.coolstep_min_speed(1024UL * 1024UL - 1UL);
st.stealthChop(0);
}
else {
st.coolstep_min_speed(0);
st.stealthChop(1);
}
#endif
st.diag1_stall(enable ? 1 : 0);
} |
Please test with the latest |
Same problem in here.
with spreadCycle On after a power cycle:
After the first G28, another G28 will result:
Motherboard: Gen-L 1.0, tmc2130 |
Hi, I also have the same problem on the latest 1.1.x Bugfix. In stealchchop the printer performed as expected, but when I switch to spredcycle (comment // enable_stealthchop) sensorless homing doesn't work as espected. Instead of going to the end of the axis, it stops in the middle, the crashed into the opposite side |
Please start a new issue entitled "TMC2130 SpreadCycle breaks sensorless homing" or similar. |
+1 Changing 'Marlin_main.cpp.tmc_sensorless_homing' to the following code helped; void tmc_sensorless_homing(TMC &st, bool enable=true) {
st.coolstep_min_speed(enable ? 1024UL * 1024UL - 1UL : 0);
#if ENABLED(STEALTHCHOP)
st.stealthChop(enable ? 0 : 1);
#endif
st.diag1_stall(enable ? 1 : 0);
} |
@olafherzig : Yes, the TMC chip does seem to have a problem with the stallguard flag staying set. It seems like they should have added an option to clear it programmatically. Going in and out of stealth chop is the only way I have found to clear it. |
Interesting. What is the added effect of always setting the #if ENABLED(STEALTHCHOP)
st.coolstep_min_speed(enable ? 1024UL * 1024UL - 1UL : 0);
st.stealthChop(!enable);
#endif
st.diag1_stall(enable ? 1 : 0); |
@JimStar — Would the same workaround apply to the current |
@thinkyhead After I've done those two little changes in 1.1.8 - it never fails homing, it works just perfectly. But without these changes - I got my hot nozzle diving deep into the printed model several times, when I pressed "Auto home" after printing had been finished... |
Thanks for the feedback! I'll put together a patch tonight for both bugfix branches. |
I've applied the suggested patch. This should also help with sensorless probing once we go forward with that. |
Amazing, thank you, @thinkyhead! |
Is this fixed in the latest bugfix 2.0 ? |
Should be. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Bug Report
Reseting by turning off and on again and it works again for the first homing. A soft reset doesn't help.
EEPROM was reseted after flashing Marlin with this setting enabled.
I've just made a test with M122. It seems after power reset M122 always reports stallguard false for all axis, after the first home it always reports true. I think clearing this register before each home should fix this bug. But I didn't found out how after looking into the tmc library so far.
The text was updated successfully, but these errors were encountered: