klipper icon indicating copy to clipboard operation
klipper copied to clipboard

tmc: Add `overvoltage_threshold` and `overtemperature_warning_threshold` for TMC2240

Open yunline opened this issue 1 year ago • 4 comments

This PR adds overvoltage_threshold and overtemperature_warning_threshold to the config of tmc2240 driver.

overvoltage_threshold

Accroding to tmc2240 datasheet:

A stepper motor application can generate significant overvoltage, especially when the motor becomes quickly decelerated from a high velocity, or when the motor stalls To protect the driver as well as connected circuitry, the TMC2240 has an overvoltage detection and protection mechanism. The OV output allows attaching an NPN or MOSFET with a power resistor (brake resistor) to dump the excess energy into the resistor. The transistor chops with approximately 3kHz to 4kHz (depending on the clock frequency) to keep the supply within the limits.

By setting the overvoltage_threshold in config, we can determine the the threshold of the overvoltage detection of tmc2240 to adapt different supply voltage.

overtemperature_warning_threshold

This config sets the threshold of overtemperature warning. When the temperature of tmc2240 reaches this threshold, a overtemperature warning will be reported.

Example config

[tmc2240 stepper_x]
...
overvoltage_threshold: 13.0 
# 13V overvoltage threshold for a 12V system.

overtemperature_warning_threshold: 100
# When temperature reaches 100℃, a warning will be reported.
...

yunline avatar Sep 03 '24 11:09 yunline

Thank you for submitting a PR, please provide a signed off by line as outlined in https://github.com/Klipper3d/klipper/blob/master/docs/CONTRIBUTING.md

Thanks

James

JamesH1978 avatar Sep 05 '24 22:09 JamesH1978

Thank you for submitting a PR, please provide a signed off by line as outlined in https://github.com/Klipper3d/klipper/blob/master/docs/CONTRIBUTING.md

Updated

yunline avatar Sep 06 '24 13:09 yunline

Thank you for your contribution to Klipper. Unfortunately, a reviewer has not assigned themselves to this GitHub Pull Request. All Pull Requests are reviewed before merging, and a reviewer will need to volunteer. Further information is available at: https://www.klipper3d.org/CONTRIBUTING.html

There are some steps that you can take now:

  1. Perform a self-review of your Pull Request by following the steps at: https://www.klipper3d.org/CONTRIBUTING.html#what-to-expect-in-a-review If you have completed a self-review, be sure to state the results of that self-review explicitly in the Pull Request comments. A reviewer is more likely to participate if the bulk of a review has already been completed.
  2. Consider opening a topic on the Klipper Discourse server to discuss this work. The Discourse server is a good place to discuss development ideas and to engage users interested in testing. Reviewers are more likely to prioritize Pull Requests with an active community of users.
  3. Consider helping out reviewers by reviewing other Klipper Pull Requests. Taking the time to perform a careful and detailed review of others work is appreciated. Regular contributors are more likely to prioritize the contributions of other regular contributors.

Unfortunately, if a reviewer does not assign themselves to this GitHub Pull Request then it will be automatically closed. If this happens, then it is a good idea to move further discussion to the Klipper Discourse server. Reviewers can reach out on that forum to let you know if they are interested and when they are available.

Best regards, ~ Your friendly GitIssueBot

PS: I'm just an automated script, not a human being.

github-actions[bot] avatar Sep 21 '24 00:09 github-actions[bot]

I didn't find a significant quality improvement with overvoltage_threshold set to 13v (my power supply is 12v) or 30v. That could because the printer is running at a low speed (200mm/s 10000mm/s^2), or because the design of circuit of the driver module is not good. Or maybe, changing overvoltage_threshold doesn't really matter to the print quality?

Anyway, before this PR, there is no way to access field overtempprewarning_vth and overvoltage_vth. This is the importances of this PR.

yunline avatar Dec 17 '24 02:12 yunline