TMC2226 UART Control Rotation Distance Issue

A while back I replaced the Trigorilla main board in my Anycubic Mega Pro with a BTT Manta M8P and TMC2226 stepper drivers. I never adjusted the current on them because none of the steppers had issues losing steps or getting warm. I also being new to Klipper never realized I didn’t setup the UART control for these drivers in my config, but all was well regardless.

Fast forward to now, I am moving to direct drive with a pancake motor for the extruder which would most certainly get too warm with the same current value as the bigger steppers. This is where I realized these drivers can have the current set through the UART that I never set up. So I used the TMC2209 config to set the run current for all of the steppers.

Now it seems that all of my steppers are only moving half as far as they’re supposed to (at least the X and Y, the Z is a bit harder to tell by eye and I haven’t measured it).

My understanding of these drivers is that if the UART isn’t used they will use default values, some of which are one time programmable, and then when using the UART config Klipper overwrites all of the registers with either the value specified in the config or Klipper’s default. The only thing I can think of is that some setting in the Klipper defaults is different from the defaults in the drivers themselves, but I can’t figure out what it might be for the life of me. I’ve tried turning interpolate off but that didn’t make a difference other than being a bit louder. Most of the other settings are a bit over my head at this point.

Does anyone have any idea what might be causing this issue? Or is there any way for me to query the driver for what it’s default settings are?

I figure I can just adjust my rotation distance to work around this but that seems like more of a work around than a fix.

Here is the config for my x stepper. Like this it runs half the distance it should have, if I comment out the tmc2209 section it goes back to normal.

[stepper_x]
step_pin: PE2
dir_pin: !PB4
enable_pin: !PC11
microsteps: 16
rotation_distance: 80
endstop_pin: !PF3
position_endstop: 0
position_max: 210
homing_speed: 25

[tmc2209 stepper_x]
uart_pin: PC10
run_current: 1

Hello,

You are using 2209 config for 2226 drivers? It seems like there is no 2226 driver supported for klipper, I would just double your rotation distance.

Also, it is easy enough to go in and set the uart jumpers for the Manta M8P. I did it. Why don’t you? On Page 14 of the M8P’s manual it shows how to set the jumpers for uart mode drivers.

Here is my config for my CR-10 V2 for uart pins:

[stepper_x]
step_pin: PE2
dir_pin: !PB4
enable_pin: !PC11
microsteps: 32
rotation_distance: 40
full_steps_per_rotation: 200
endstop_pin: tmc2209_stepper_x:virtual_endstop
position_endstop: -2
position_max: 316
position_min: -2
homing_speed: 50
homing_retract_dist: 0

[tmc2209 stepper_x]
uart_pin: PC10
diag_pin: PF3
driver_SGTHRS: 125
run_current: 0.800
#stealthchop_threshold: 999999

[stepper_y]
step_pin: PF12
dir_pin: !PF11
enable_pin: !PB3
microsteps: 32
rotation_distance: 40
full_steps_per_rotation: 200
endstop_pin: tmc2209_stepper_y:virtual_endstop
position_endstop: -6
position_max: 322
position_min: -6
homing_speed: 50
homing_retract_dist: 0

[tmc2209 stepper_y]
uart_pin: PF13
diag_pin: PF4
driver_SGTHRS: 125
run_current: 1.000
#stealthchop_threshold: 999999

[stepper_z]
step_pin: PD7
dir_pin: PD6
enable_pin: !PF10
microsteps: 16
rotation_distance: 8
full_steps_per_rotation: 200
endstop_pin: probe:z_virtual_endstop
#position_endstop: 0
position_max: 400
position_min: -6
homing_speed: 8
second_homing_speed: 3
homing_retract_dist: 3

[tmc2209 stepper_z]
uart_pin: PF9
##diag_pin: PF5
run_current: 0.650
stealthchop_threshold: 999999

#[stepper_z1]
#step_pin: PD3
#dir_pin: PD2
#enable_pin: PD5
#microsteps: 16
#rotation_distance: 8
#endstop_pin: probe:z_virtual_endstop
#position_endstop: 0
#position_max: 270
#position_min: -5.0
#homing_speed: 8
#second_homing_speed: 3
#homing_retract_dist: 3

#[tmc2209 stepper_z1]
#uart_pin: PD4
##diag_pin: PC0
#run_current: 0.650
#stealthchop_threshold: 999999

########################################
# Extruder and Heatbed Setup
########################################

[extruder]
step_pin: PC9
dir_pin: PC8
enable_pin: !PD1
microsteps: 16
rotation_distance: 7.5
full_steps_per_rotation: 200
nozzle_diameter: 0.4
filament_diameter: 1.75
max_extrude_only_distance: 100
heater_pin: PB5 # HE1
sensor_pin: PA1 # T0
sensor_type: Generic 3950
control: pid
pid_Kp: 22.2
pid_Ki: 1.08
pid_Kd: 114
min_temp: 10
max_temp: 300
pressure_advance: .000

[verify_heater extruder]
#max_error: 120
#   The maximum "cumulative temperature error" before raising an
#   error. Smaller values result in stricter checking and larger
#   values allow for more time before an error is reported.
#   Specifically, the temperature is inspected once a second and if it
#   is close to the target temperature then an internal "error
#   counter" is reset; otherwise, if the temperature is below the
#   target range then the counter is increased by the amount the
#   reported temperature differs from that range. Should the counter
#   exceed this "max_error" then an error is raised. The default is
#   120.
check_gain_time: 60
#   This controls heater verification during initial heating. Smaller
#   values result in stricter checking and larger values allow for
#   more time before an error is reported. Specifically, during
#   initial heating, as long as the heater increases in temperature
#   within this time frame (specified in seconds) then the internal
#   "error counter" is reset. The default is 20 seconds for extruders
#   and 60 seconds for heater_bed.
#hysteresis: 5
#   The maximum temperature difference (in Celsius) to a target
#   temperature that is considered in range of the target. This
#   controls the max_error range check. It is rare to customize this
#   value. The default is 5.
#heating_gain: 2
#   The minimum temperature (in Celsius) that the heater must increase
#   by during the check_gain_time check. It is rare to customize this
#   value. The default is 2.


[tmc2209 extruder]
uart_pin: PD0
run_current: 0.800
stealthchop_threshold: 999999

You may also look at this.
See:
https://www.klipper3d.org/Rotation_Distance.html?h=rotat
and look at the “obtaining rotation distance by looking at hardware” section.

Happy Printing,
Blake

I did set the jumpers when I put it together, but I never realized there was a separate section you need to put in the config for it and it worked fine without it so I never looked further. Adding the tmc2209 section is what causes it to not move correctly.

I am rather embarrassed though to say that it does seem that my rotation distance is just wrong. I have 20 tooth pulleys and a GT2 belt so if my math is correct that would be 40mm per rotation not 80mm as I have in the config. So I suppose that’s just simply what the problem is. What I don’t get is why removing the tmc2209 section of the config makes a difference for that but I suppose it doesn’t really matter.

Thank you for your help. I see you have the diag pin specified, do you use sensorless homing? The only reason I didn’t connect that was that the M8P manual seems to say to leave it not connected if you’re not using sensorless homing, though that might just be a weird translation issue.

Regarding the 2226 vs 2209, I found this saying the 2226 is just 2209 in a different package so they use the same config section. Klipper support for TMC2225 and TMC2226 · Issue #3751 · Klipper3d/klipper · GitHub

Hello,

Yes, I use sensorlsess homing. I would not set the diag jumper unless you plan on using it. I sound like I put glue in my cereal, however, rotation distance is weird. Don’t be embarassed. I would just change rotation distance.

Happy Printing,
Blake

1 Like

Indeed,

  • TMC2225 equals TMC2208
  • TMC2226 equals TMC2209

If you have, e.g. TMC2226 driver, you should definitively add the respective TMC2209 sections in your printer.cfg
If you do not, you will have no possibility to:

  • set stealth-chop or spread-cycle
  • set the run current
  • use sensorless homing
  • turn on / off interpolation
  • receive status / warnings / error messages from the drivers

This is a typical combination and results in a rotation_distance of 40.

1 Like