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

Set hybrid edit range to 999 #27473

Merged
merged 5 commits into from
Nov 12, 2024

Conversation

vovodroid
Copy link
Contributor

@vovodroid vovodroid commented Oct 12, 2024

Currently TMC hybrid threshold is edited as uint8. This PR uses unit16 and range up to 999.

P.S. Should min value be >0?

@thinkyhead
Copy link
Member

The description from ChatGPT is below. In practice, Marlin uses the values specified by the TMCStepper library and not necessarily the native range of the stepper drivers. So we need to look first at how TMCStepper interprets these values for all the stepper drivers that it supports, and then adjust the code so it can adapt to the type of stepper drivers that are installed.


The Hybrid Threshold on Trinamic stepper drivers determines the speed at which the driver switches between stealthChop (quiet mode) and spreadCycle (performance mode). Different models of Trinamic drivers have different ranges for this parameter. Here is a summary of the ranges for some common Trinamic drivers:

  • TMC2130: The Hybrid Threshold value can range from 0 to 65535. This corresponds to a step frequency threshold where switching between modes occurs.

  • TMC2208 / TMC2225: The Hybrid Threshold value typically ranges from 0 to 255 steps per second. These drivers are commonly used in silent 3D printers, and the range is narrower compared to other models.

  • TMC2209: Like the TMC2208, it also supports a range from 0 to 255 steps per second for the Hybrid Threshold.

  • TMC2660: This driver allows setting the Hybrid Threshold up to 65535 steps per second, providing a broad range for switching between stealthChop and spreadCycle modes.

  • TMC5160: The range for Hybrid Threshold on this model is from 0 to 65535, similar to the TMC2130 and TMC2660.

The specific threshold values you set depend on the application, such as the speed and torque requirements of your setup. Higher thresholds keep the motor in stealthChop longer, which is quieter but less powerful, while lower thresholds switch to spreadCycle earlier, providing more torque at higher speeds.

@vovodroid
Copy link
Contributor Author

vovodroid commented Oct 19, 2024 via email

@thinkyhead
Copy link
Member

Yes, it does appear that the value is transformed.

12,650,000 * microsteps / (256 * thrs * steps_per_mm)

…however it doesn't appear to be scaled based on the driver type. If the driver type has a range from 0 to 65535, then presumably the value should be scaled to that range as well before sending it to TPWMTHRS. I'm looking into it. Possibly @teemuatlut can provide some guidance.

@thinkyhead thinkyhead merged commit e6099fd into MarlinFirmware:bugfix-2.1.x Nov 12, 2024
64 checks passed
@vovodroid vovodroid deleted the hybrid-edit-pr branch November 13, 2024 08:19
bsdnomad pushed a commit to bsdnomad/Marlin that referenced this pull request Nov 25, 2024
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

Successfully merging this pull request may close these issues.

2 participants