From 5ee72d320cade30aee62c532fbcac79f66c27258 Mon Sep 17 00:00:00 2001 From: Alex Voinea Date: Thu, 30 Mar 2023 18:08:56 +0200 Subject: [PATCH] tmc: Configurable `multistep_filt` Signed-off-by: Alex Voinea --- docs/Config_Changes.md | 3 +++ docs/Config_Reference.md | 4 ++++ klippy/extras/tmc2208.py | 3 ++- klippy/extras/tmc2209.py | 3 ++- klippy/extras/tmc2240.py | 5 +++-- klippy/extras/tmc5160.py | 3 ++- 6 files changed, 16 insertions(+), 5 deletions(-) diff --git a/docs/Config_Changes.md b/docs/Config_Changes.md index 5b7b5aef..9ad7ce24 100644 --- a/docs/Config_Changes.md +++ b/docs/Config_Changes.md @@ -20,6 +20,9 @@ parameters if `[input_shaper]` was enabled already. 20230407: The `stalled_bytes` counter in the log and in the `printer.mcu.last_stats` field has been renamed to `upcoming_bytes`. +20230323: On tmc5160 drivers `multistep_filt` is now enabled by default. Set +`driver_MULTISTEP_FILT: False` in the tmc5160 config for the previous behavior. + 20230304: The `SET_TMC_CURRENT` command now properly adjusts the globalscaler register for drivers that have it. This removes a limitation where on tmc5160, the currents could not be raised higher with `SET_TMC_CURRENT` than the diff --git a/docs/Config_Reference.md b/docs/Config_Reference.md index 549b96ec..1cc0bc8f 100644 --- a/docs/Config_Reference.md +++ b/docs/Config_Reference.md @@ -3202,6 +3202,7 @@ run_current: # set, "stealthChop" mode will be enabled if the stepper motor # velocity is below this value. The default is 0, which disables # "stealthChop" mode. +#driver_MULTISTEP_FILT: True #driver_IHOLDDELAY: 8 #driver_TPOWERDOWN: 20 #driver_TBL: 2 @@ -3243,6 +3244,7 @@ run_current: # The address of the TMC2209 chip for UART messages (an integer # between 0 and 3). This is typically used when multiple TMC2209 # chips are connected to the same UART pin. The default is zero. +#driver_MULTISTEP_FILT: True #driver_IHOLDDELAY: 8 #driver_TPOWERDOWN: 20 #driver_TBL: 2 @@ -3417,6 +3419,7 @@ run_current: # to tune a motor with unbalanced coils. See the `Sine Wave Lookup Table` # section in the datasheet for information about this field and how to tune # it. +#driver_MULTISTEP_FILT: True #driver_IHOLDDELAY: 6 #driver_IRUNDELAY: 4 #driver_TPOWERDOWN: 10 @@ -3532,6 +3535,7 @@ run_current: # values used by the driver. The value must be specified as a decimal integer # (hex form is not supported). In order to compute the wave table fields, # see the tmc2130 "Calculation Sheet" from the Trinamic website. +#driver_MULTISTEP_FILT: True #driver_IHOLDDELAY: 6 #driver_TPOWERDOWN: 10 #driver_TBL: 2 diff --git a/klippy/extras/tmc2208.py b/klippy/extras/tmc2208.py index bedf8092..421c5378 100644 --- a/klippy/extras/tmc2208.py +++ b/klippy/extras/tmc2208.py @@ -197,10 +197,11 @@ class TMC2208: self.get_status = cmdhelper.get_status # Setup basic register values self.fields.set_field("mstep_reg_select", True) - self.fields.set_field("multistep_filt", True) tmc.TMCStealthchopHelper(config, self.mcu_tmc, TMC_FREQUENCY) # Allow other registers to be set from the config set_config_field = self.fields.set_config_field + # GCONF + set_config_field(config, "multistep_filt", True) # CHOPCONF set_config_field(config, "toff", 3) set_config_field(config, "hstrt", 5) diff --git a/klippy/extras/tmc2209.py b/klippy/extras/tmc2209.py index 1afa280c..c248c2d6 100644 --- a/klippy/extras/tmc2209.py +++ b/klippy/extras/tmc2209.py @@ -73,10 +73,11 @@ class TMC2209: self.get_status = cmdhelper.get_status # Setup basic register values self.fields.set_field("mstep_reg_select", True) - self.fields.set_field("multistep_filt", True) tmc.TMCStealthchopHelper(config, self.mcu_tmc, TMC_FREQUENCY) # Allow other registers to be set from the config set_config_field = self.fields.set_config_field + # GCONF + set_config_field(config, "multistep_filt", True) # CHOPCONF set_config_field(config, "toff", 3) set_config_field(config, "hstrt", 5) diff --git a/klippy/extras/tmc2240.py b/klippy/extras/tmc2240.py index 45482509..19e62ab7 100644 --- a/klippy/extras/tmc2240.py +++ b/klippy/extras/tmc2240.py @@ -354,12 +354,13 @@ class TMC2240: self.get_phase_offset = cmdhelper.get_phase_offset self.get_status = cmdhelper.get_status # Setup basic register values - self.fields.set_field("multistep_filt", True) tmc.TMCWaveTableHelper(config, self.mcu_tmc) self.fields.set_config_field(config, "offset_sin90", 0) tmc.TMCStealthchopHelper(config, self.mcu_tmc, TMC_FREQUENCY) - # CHOPCONF set_config_field = self.fields.set_config_field + # GCONF + set_config_field(config, "multistep_filt", True) + # CHOPCONF set_config_field(config, "toff", 3) set_config_field(config, "hstrt", 5) set_config_field(config, "hend", 2) diff --git a/klippy/extras/tmc5160.py b/klippy/extras/tmc5160.py index 1e8266b3..b82b5fec 100644 --- a/klippy/extras/tmc5160.py +++ b/klippy/extras/tmc5160.py @@ -334,10 +334,11 @@ class TMC5160: self.get_phase_offset = cmdhelper.get_phase_offset self.get_status = cmdhelper.get_status # Setup basic register values - self.fields.set_field("multistep_filt", True) tmc.TMCWaveTableHelper(config, self.mcu_tmc) tmc.TMCStealthchopHelper(config, self.mcu_tmc, TMC_FREQUENCY) set_config_field = self.fields.set_config_field + # GCONF + set_config_field(config, "multistep_filt", True) # CHOPCONF set_config_field(config, "toff", 3) set_config_field(config, "hstrt", 5)