From 12a270fd2964c088acb93b4ecfe1b35c3df97654 Mon Sep 17 00:00:00 2001 From: teemuatlut Date: Sat, 8 Jun 2019 22:34:50 +0300 Subject: [PATCH] Fix TMC5160 and TMC2160 PWMCONF init --- Marlin/src/module/stepper_indirection.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/Marlin/src/module/stepper_indirection.cpp b/Marlin/src/module/stepper_indirection.cpp index 02b6af60f..b50383a1c 100644 --- a/Marlin/src/module/stepper_indirection.cpp +++ b/Marlin/src/module/stepper_indirection.cpp @@ -297,11 +297,14 @@ st.en_pwm_mode(stealth); - PWMCONF_t pwmconf{0}; - pwmconf.pwm_freq = 0b01; // f_pwm = 2/683 f_clk + TMC2160_n::PWMCONF_t pwmconf{0}; + pwmconf.pwm_lim = 12; + pwmconf.pwm_reg = 8; + pwmconf.pwm_autograd = true; pwmconf.pwm_autoscale = true; - pwmconf.pwm_grad = 5; - pwmconf.pwm_ampl = 180; + pwmconf.pwm_freq = 0b01; + pwmconf.pwm_grad = 14; + pwmconf.pwm_ofs = 36; st.PWMCONF(pwmconf.sr); #if ENABLED(HYBRID_THRESHOLD) @@ -651,11 +654,14 @@ st.en_pwm_mode(stealth); - PWMCONF_t pwmconf{0}; - pwmconf.pwm_freq = 0b01; // f_pwm = 2/683 f_clk + TMC2160_n::PWMCONF_t pwmconf{0}; + pwmconf.pwm_lim = 12; + pwmconf.pwm_reg = 8; + pwmconf.pwm_autograd = true; pwmconf.pwm_autoscale = true; - pwmconf.pwm_grad = 5; - pwmconf.pwm_ampl = 180; + pwmconf.pwm_freq = 0b01; + pwmconf.pwm_grad = 14; + pwmconf.pwm_ofs = 36; st.PWMCONF(pwmconf.sr); #if ENABLED(HYBRID_THRESHOLD)