Bug? stealtchop ignoring run_current setting

Basic Information:

Printer Model: Any, tested on Voron V0
MCU / Printerboard: Any, tested on SKR Mini e3v3
klippy (1).zip (295.3 KB)

klippy.log

Fill out above information and in all cases attach your klippy.log file (use zip to compress it, if too big). Pasting your printer.cfg is not needed
Be sure to check our “Knowledge Base” Category first. Most relevant items, e.g. error messages, are covered there

Describe your issue:

An issue was raised in the Voron discord that recently (maybe v0.12 +?) klipper seems to be ignoring the run_current value if you enable stealthchop, and the motor runs at full blast generating a lot of heat.

Example:

Using
[tmc2209 extruder] uart_pin: PC11 tx_pin: PC10 uart_address: 3 interpolate: False run_current: 0.1 sense_resistor: 0.110 stealthchop_threshold: 0
and the extruder motor can’t even spin because the run_current is so low (which would be expected).

But using:
[tmc2209 extruder] uart_pin: PC11 tx_pin: PC10 uart_address: 3 interpolate: False run_current: 0.1 sense_resistor: 0.110 stealthchop_threshold: 999999
and the extruder will push filament perfectly well even at high flows even though it shouldn’t be able to.

Obviously no-one runs at 0.1A current, but it demonstrates that stealthchop is doing something strange. There have been reports (second hand by the time it gets to me unfortunately) that motors are getting unreasonably hot with stealthchop enabled, which would make sense if they are running at max current or something.

1 Like

The question is: How shall Klipper know the maximum value of current of the used TMC?

For the extruder you may not use stealthchop.

You may read:
https://www.klipper3d.org/TMC_Drivers.html#can-i-use-stealthchop-mode-on-an-extruder-with-pressure-advance

1 Like

The issue I am raising isn’t about “how can I run stealthchop on my extruder”, I don’t care about that. I’m just trying to raise a potential bug where enabling stealthchop seems to be ignoring the set run_current: value from the printer.cfg.

This is not just happening on extruder motors, it’s just that the extruder motor is the easiest and safest one to test on. The same behaviour happens on any stepper.

The “broken” behaviour seems to be the same as you would see if you don’t have the [tmcxxxx motor] section entirely, of if you had the wrong UART pin set in the section.

While I already find this report quite unlikely to begin with, I cannot confirm on my test printer.

The following screenshots have been made using GitHub - zapta/ble_stepper_motor_analyzer: A low cost stepper motor analyzer that uses wireless BLE link to display the data in real time on a Windows/Mac/Linux PC. on a TMC2209 with 1A RMS setting on my x-axis

Spread Cycle:

Stealth Chop:

3 Likes

That is an amazing device, need to get me one.
Are you able to test with a “shouldn’t be able to turn” current of 0.1A or something? That’s what I’ve been using to test as a sort of go/no-go gauge (as I’ve had no other testing tools)

Interesting. Tested with 0.2A (at 0.1 my x-axis craps out)

Spread Cycle

Stealth Chop

There is indeed a difference that did not show at the regular run_currents

I cannot truly explain why this is happening, but one thing is clear:
These drivers are using the R-Sense resistor and an ADC circuit to measure the current. A regular TMC2209 has an RMS value of 1.7A and when you reduce the current so much, you also reduce its ability to control the current. Why this results in a different behavior between SC and SS, I cannot explain.

Hmm, may not be an issue then, as long as at “normal run currents” stealthchop is still playing by the rules.
I will add that using TMC Autotune in “silent” mode, it behaves the same as with stealthchop off (low current == no spinny). So either the tmc autotune implementation of stealth mode is different to “normal” stealthchop or there is something else going on.
But if it’s looking fine at normal run currents then it might be a non issue.

I’m going to do a couple more tests on different boards just to see if they behave differently (the skr mini e3v3 has integrated drivers, so I’ll try on my spider with stepstick style drivers). But thanks for testing with actual current monitoring!

If you are referring to https://github.com/andrewmcgr/klipper_tmc_autotune:
I have tested this as well and IMO does it does strange things. YMMV

yeah, was talking about that.
The test in the initial post were all done with autotune disabled though.

If the internal sense resistors of the TMC drivers are being used then the 100 mA are below what is recommended and might cause some strange behaviours:

3 Likes

I suggest a hard coded min for sens resist when stealchop is enable to prevent melting of parts /damage of motors / burn injury.

very good feedback

Extra info:
I was the one who kicked up the stink over this; did testing with user tigster and OP afterwards; OP was very helpful in hearing me out & collecting data including tmc dumps and making this thread; greatly appreciated

Further info:
There are edgecase scinarios of needing a very weak helper motor;

mine in particular was: unspooling 2kg spool from a drybox; very low amperage helper motor is needed- & infact- skipping steps and soft spongey behaviour of stealthchop is preferred in order to not cause synchronization issues;

I’m not sure that this analysis is correct. It somehow contradicts my observations:

  • TMC dumps on my side suggest that the current is correctly set on the driver. So Klipper is doing what it is supposed to do
  • There is a difference between running the driver in SC vs SS mode → Both use the same R-sense and both use the current set by Klipper
  • There is actually a difference between both modes but at least to my measurements not in a range that would endanger the steppers (~0.2A vs ~0.4A)

WRT the Internal Sense Resistor:

  • This is an alternative to the external sense resistor
  • It requires the correct hardware provisions, i.e. BRA and BRB pins tied to GND instead of putting the external sense resistor there
  • So if there are external sense resistors, then there are external sense resistors. You cannot configure the software to behave as if they have changed or are suddenly gone
  • Needs to be enabled by setting the respective registers

Overall, these observations suggest that it is some driver internal thing that is going on.

To add to the above:

  • These driver ICs are complex current regulators
  • They use the R-Sense resistors to measure the current via a voltage drop and convert it to a digital value for their internal processing
  • With the R-Sense value you are specifying IN HARDWARE what current is expected and up to which current the driver shall do its regulation
  • For the typical TMC2209 with 0.11 Ohm you end up at a peak current of ~2.4A
  • If you now limit the actual current to a peak value of 0.14A, you are running your hardware effectively outside its specification by a factor of 17. Or to put it differently: From a regulation range of 100% (=2.4A) you are left with a range of not even 6%

This means in the first instance that you have a hardware design mistake: You specified 2.4A but use only 0.14A.

According to a chat I had with an AD representative the drivers have measures to cope with such, e.g. switching from fine voltage sensing to coarse voltage sensing (VSENSE=1 to VSENSE=0) and things like that but of course there are limits.

IMO this is a marketing driven insanity among the manufactures: With every driver they release to the market they are going to yet another extreme of currents, e.g. Pre-Sale FYSETC Spider king motherboard Core Replaceable 10-axis Indu – FYSETC OFFICIAL WEBSITE → Up to 6A!

I have yet to see printer designs that commonly use NEMA 34 steppers that would start profiting from such.
In all other cases you are just limiting the drivers ability to efficiently control the current.

1 Like

I understand now; operating a stepper motor at such low currents, specifically below 0.1 amps through a TMC driver, can lead to suboptimal performance. This is because manufacturers typically do not design these systems to handle such small currents efficiently, as it represents a very niche scenario that isn’t generally intended.

( as manufacturers would not do something silly like design a secondary low-tier amplification circut )

For my application, it would be more appropriate to adjust the gear ratio or implement a hardware buffer system to compensate for any discrepancies. This approach seems quite straightforward.

Moreover, to prevent misunderstandings like mine, it might be beneficial if Klipper included safeguards or at least warnings for users attempting to operate motors outside of the recommended specifications, especially at 0.1 amp or lower. When StealthChop mode is active and the current is set this low, it can cause the motor to operate at its maximum capacity, leading to overheating, which is far from ideal. Given that many users have encountered this issue, it would be prudent to address this in the documentation, particularly in the StealthChop section, or by providing a warning when such settings are applied.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.