Skip to content
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

Setting wrong motor stallguard settings on sensorless per-axis homing under some conditions. #9

Open
wakass opened this issue Jan 23, 2023 · 3 comments

Comments

@wakass
Copy link

wakass commented Jan 23, 2023

Found some odd behaviour when trying per axis homing, while having sensorless enabled on partial axes. I suspect the trinamic_on_homing function has some strange logic leading to this.

static void trinamic_on_homing (axes_signals_t axes, float rate, bool pulloff)

To trigger the bug it is required to enable the tmc drivers on all drivers (3 in my case).

The bug seems triggered when setting partial sensorless homing axes using $339:
e.g. (debug added in my build)

This is the correct output when enabling all sensorless axes:

$339=7
ok
$HX
[SG: Motor: 2]
[SG: TCOOLTHRS set: 135]
[SG: Sens set: 80]
[SG: Motor: 1]
[SG: TCOOLTHRS set: 281]
[SG: Sens set: 30]
[SG: Motor: 0]
[SG: TCOOLTHRS set: 281]
[SG: Sens set: 100]

Its sets only the last motor parameters (motor 2) and stops.
$339=4
ok
$HX
[SG: Motor: 2]
[SG: TCOOLTHRS set: 135]
[SG: Sens set: 80]

@troth530
Copy link

@wakass can you please identify how you added the extra debug output.

@wakass
Copy link
Author

wakass commented Jan 27, 2023

I just peppered the trinamic and tmc drivers with hal.write.stream.
trinamic_debug.patch
motors_debug.patch

@terjeio
Copy link
Contributor

terjeio commented Jan 27, 2023

There is a bug, only the axis/axes homed in the active cycle should have the parameters changed.
$HX with $339=4 (Z axis) should not modify any.

axes.mask = driver_enabled.mask & trinamic.homing_enable.mask;

should be:

axes.mask &= (driver_enabled.mask & trinamic.homing_enable.mask);

terjeio added a commit that referenced this issue Jan 28, 2023
wakass pushed a commit to wakass/Plugins_motor that referenced this issue Jan 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants