Duet3D / RepRapFirmware

OO C++ RepRap Firmware
GNU General Public License v3.0
945 stars 535 forks source link

[FeatureRequest]: Achieve quieter motors by setting current scaler and hyteresis directly #1037

Open AndyEveritt opened 2 months ago

AndyEveritt commented 2 months ago

Is your feature request related to a problem? Please describe.

The existing implementation to set the motor current is as per the TMC datasheet.

This sets the current accurately, but for some motors (specifically low inductance) or when using higher voltage power supplies (eg 48/60V) it produces optimal hysteresis values that are outside the recommended range. By reducing CS, you can reduce the required hysteresis values which can produce a quieter motor.

In testing this seems to have the biggest impact on noise at low speed. When using a LDO2804AC motor at 48V I was able to get the following noise reductions by tuning CS, HSTRT, and HEND 20mm/s: 72 dB -> 65 dB (noise floor of my office) 100 mm/s: 68 -> 69 dB 200 mm/s: 72 dB -> 71 dB

Describe the solution you propose.

Describe alternatives you've considered

No response

Provide any additional context or information.

No response

dc42 commented 2 months ago

Wouldn't it be better to set CS automatically, to the extent possible, if the user doesn't provide a value for CS? We know what values of hysteresis are used (either the default values or the values set by the user), and we can read the VIN voltage. There's a possible issue if we read the VIN voltage too early while it is still rising.

dc42 commented 2 months ago

It's also occurred to me that we could perhaps provide an option to calculate good values for CS and hysteresis in RRF when setting the motor current. We would need to measure the voltage, and we'd need the user to provide the phase inductance and resistance values via M569.