Skip to content

Conversation

@dbuezas
Copy link
Contributor

@dbuezas dbuezas commented Dec 30, 2025

Description

TMC2208 Direction-Flip Delay

Some TMC2208 / TMC2208_STANDALONE setups may require a short delay after a DIR change
to avoid timing-sensitive glitches, especially when using stealthChop.

When enabled for an axis, FT Motion will "pause" that axis for > 750µs after a detected
direction flip by holding its trajectory coordinate constant for a multiple of FTM_TS
frames. For the default FTM_FS = 1000, it is a single 1ms frame.
Other axes keep moving normally, and the wait is cancelled if the axis flips again.

NOTE: Typically only needed if you actually use stealthChop on that axis.

Requirements

Benefits

Configurations

FTM + 2208 drivers in stealthchop

Related Issues

Hopefully fixes #28248

@dbuezas dbuezas changed the title Fix 2208 attempt FTMotion: Fix TMC2208 timing bug (attempt) Dec 30, 2025
@thisiskeithb thisiskeithb added Needs: Testing Testing is needed for this change F: Trinamic labels Dec 31, 2025
@yrabbit
Copy link

yrabbit commented Jan 2, 2026

The situation with TMC2225 (TMC2208) has been corrected. My settings for FTM, Creality 4.2.7 board:

#define X_DRIVER_TYPE  TMC2208_STANDALONE
#define Y_DRIVER_TYPE  TMC2208_STANDALONE
#define Z_DRIVER_TYPE  TMC2208_STANDALONE
#define E0_DRIVER_TYPE TMC2208_STANDALONE

#define FTM_IS_DEFAULT_MOTION 
#define NO_STANDARD_MOTION 

#define FTM_DEFAULT_SHAPER_X      ftMotionShaper_ZVD
#define FTM_SHAPING_DEFAULT_FREQ_X   40.0f

#define FTM_DEFAULT_SHAPER_Y      ftMotionShaper_ZVD
#define FTM_SHAPING_DEFAULT_FREQ_Y   40.0f

#define FTM_DEFAULT_SHAPER_Z      ftMotionShaper_NONE
#define FTM_SHAPING_DEFAULT_FREQ_Z   21.0f

#define FTM_SHAPER_E
#define FTM_DEFAULT_SHAPER_E      ftMotionShaper_NONE
#define FTM_SHAPING_DEFAULT_FREQ_E   21.0f 

#define FTM_SMOOTHING
#define FTM_SMOOTHING_TIME_E        0.06f

#define FTM_POLYS 
#define FTM_TRAJECTORY_TYPE POLY5 

#define FTM_BUFFER_SIZE             2048
#define FTM_FS  

Before the fixes related to TMC2225 (TMC2208), the extruder would stop:

n-1.mp4

After corrections in this PR, stoppages due to TMC2225 (TMC2208) are no longer observed.

@narno2202
Copy link
Contributor

narno2202 commented Jan 6, 2026

@dbuezas , I missed @yrabbit success. In my mind this should be mandatory if a faulty driver is present: TMC2208 or TMC5160.

You could remove the related code in Configuration_adv.h and do if you want in drivers.h

#define _OR_ADTX(N,T)   || AXIS_DRIVER_TYPE_X##N(T)
#define HAS_X_DRIVER(T) (0 RREPEAT2(NUM_X_STEPPERS, _OR_ADTX, T))
#define _OR_ADTY(N,T)   || AXIS_DRIVER_TYPE_Y##N(T)
#define HAS_Y_DRIVER(T) (0 RREPEAT2(NUM_Y_STEPPERS, _OR_ADTY, T))
#define _OR_ADTZ(N,T)   || AXIS_DRIVER_TYPE_Z##N(T)
#define HAS_Z_DRIVER(T) (0 RREPEAT2(NUM_Z_STEPPERS, _OR_ADTZ, T))

then at the end of this file

#if ENABLED(FT_MOTION)
  #if HAS_X_DRIVER(TMC2208) || HAS_X_DRIVER(TMC2208_STANDALONE) || HAS_X_DRIVER(TMC5160) || HAS_X_DRIVER(TMC5160_STANDALONE)
      #define APPLY_TIMING_HACK_ON_X
    #endif
    #if HAS_Y_DRIVER(TMC2208) || HAS_Y_DRIVER(TMC2208_STANDALONE) || HAS_Y_DRIVER(TMC5160) || HAS_Y_DRIVER(TMC5160_STANDALONE)
      #define APPLY_TIMING_HACK_ON_Y
    #endif
    #if HAS_Z_DRIVER(TMC2208) || HAS_Z_DRIVER(TMC2208_STANDALONE) || HAS_Z_DRIVER(TMC5160) || HAS_Z_DRIVER(TMC5160_STANDALONE)
      #define APPLY_TIMING_HACK_ON_Z
    #endif
    #if HAS_E_DRIVER(TMC2208) || HAS_E_DRIVER(TMC2208_STANDALONE) || HAS_E_DRIVER(TMC5160) || HAS_E_DRIVER(TMC5160_STANDALONE)
      #define APPLY_TIMING_HACK_ON_E
    #endif
#endif // FT_MOTION

@dbuezas
Copy link
Contributor Author

dbuezas commented Jan 6, 2026

The issue only appears on stealthchop only, so better be configurable to avoid it applying on machines set to spreadcycle

@narno2202
Copy link
Contributor

At least for standalone drivers (stealthchop by default and not modifiable).

@dbuezas
Copy link
Contributor Author

dbuezas commented Jan 7, 2026

Well, for non standalone too if the user set them as stealthchop, and I don't think the 5160s are affected.
Anyway this is experimental, we don't yet know if it works well

@oliof
Copy link
Contributor

oliof commented Jan 7, 2026

Well, for non standalone too if the user set them as stealthchop, and I don't think the 5160s are affected. Anyway this is experimental, we don't yet know if it works well

Most standalone drivers are set to stealthchop, you usually need to solder a pair of pads to enable spreadcycle if stepsticks. With onboard drivers, all bets are off.

* Other axes keep moving normally, and the wait is cancelled if the axis flips again.
*
*/
#if AXIS_DRIVER_TYPE_X(TMC2208) || AXIS_DRIVER_TYPE_X(TMC2208_STANDALONE)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does TMC2209 / TMC2225 differ so that it doesn't stall?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll have to ask tmc. It's a known bug of the 2208

@thinkyhead thinkyhead force-pushed the dbuezas/FTMotion-tmc2208-fix branch from b0f6e09 to e4aba1b Compare January 9, 2026 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

F: Trinamic Needs: Testing Testing is needed for this change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] FTM. Complete stoppage of the extruder at a random moment in time.

6 participants