Trinamic stepper motor driver “step on both edges” optimization

Basic Information:

Printer Model:
MCU / Printerboard:
klippy.log

Might be a silly question, but what is “Trinamic stepper motor driver “step on both edges” optimization”?

I have an idea, but…

Is/was there any discussion about it, where can I read about this? Is there anybody, who may guide me?

Thanks in advance.

Kind regards, hcet14

Not a lot of tests or info on this regard. The explanation:

Along with this change, TMC drivers configured via UART or SPI mode will automatically enable new optimizations for generating step pulses. In particular, the DEDGE=1 driver setting is enabled so that steps are taken on both rising and falling edges of the step gpio pin. These optimizations make it possible for the default mcu build to obtain dramatically higher step rates on 32-bit micro-controllers. (Many of these chips will now be able to reach over a million steps per second.)
-Kevin

It’s also at least partially self-diagnostic:

Add an optimized step function for drivers that support stepping on
both rising and falling edges of the step pin.  Enable this
optimization on 32bit ARM micro-controllers.  Automatically detect
this capability in the host code and enable on TMC drivers running in
SPI/UART mode.

There’s not much else that can be referenced. I never got bottlenecked by my MCU cap[abilities, so I can’t really say anything about this possible upgrade.

2 Likes

Traditional stepper motor drivers move one step (turn the motor a small distance) on either the rising or falling edge of the “step pin” (that is, when the voltage on the wire goes from low to high, or high to low). The Trinamic drivers support a mode where it will move a step both when the pin voltages rises and when it falls. Taking advantage of that mode reduces the overhead in the micro-controller.

In addition to the links above, the benchmark updates commit can be found at docs: Update benchmarks after stepper and scheduler changes · Klipper3d/klipper@cf811e5 · GitHub

-Kevin

1 Like

Thank you both, that also was my first idea. Using both edges. Datasheet of TMC2209 says “dedge=1” “enable double edge step pulses”. Cool for slower µCs! Very good feature of Klipper!

oh cool, that’s a fantastic improvement. my machine is sitting on a tradeoff between microsteps and velocity limited by maximum step rate, so I’m looking forward to trying this out

Is this feature supported on ATmega2560 based boards?

The 8-bit AVR chips have a separate set of optimizations (those chips have an optimization to “step” and “unstep” in the same event handler). As a result, the “step on both edge” optimization is not needed nor utilized.

-Kevin