Browse Source

Fix TMC5160 and TMC2160 PWMCONF init

teemuatlut 5 years ago
parent
commit
12a270fd29
1 changed files with 14 additions and 8 deletions
  1. 14
    8
      Marlin/src/module/stepper_indirection.cpp

+ 14
- 8
Marlin/src/module/stepper_indirection.cpp View File

@@ -297,11 +297,14 @@
297 297
 
298 298
     st.en_pwm_mode(stealth);
299 299
 
300
-    PWMCONF_t pwmconf{0};
301
-    pwmconf.pwm_freq = 0b01; // f_pwm = 2/683 f_clk
300
+    TMC2160_n::PWMCONF_t pwmconf{0};
301
+    pwmconf.pwm_lim = 12;
302
+    pwmconf.pwm_reg = 8;
303
+    pwmconf.pwm_autograd = true;
302 304
     pwmconf.pwm_autoscale = true;
303
-    pwmconf.pwm_grad = 5;
304
-    pwmconf.pwm_ampl = 180;
305
+    pwmconf.pwm_freq = 0b01;
306
+    pwmconf.pwm_grad = 14;
307
+    pwmconf.pwm_ofs = 36;
305 308
     st.PWMCONF(pwmconf.sr);
306 309
 
307 310
     #if ENABLED(HYBRID_THRESHOLD)
@@ -651,11 +654,14 @@
651 654
 
652 655
     st.en_pwm_mode(stealth);
653 656
 
654
-    PWMCONF_t pwmconf{0};
655
-    pwmconf.pwm_freq = 0b01; // f_pwm = 2/683 f_clk
657
+    TMC2160_n::PWMCONF_t pwmconf{0};
658
+    pwmconf.pwm_lim = 12;
659
+    pwmconf.pwm_reg = 8;
660
+    pwmconf.pwm_autograd = true;
656 661
     pwmconf.pwm_autoscale = true;
657
-    pwmconf.pwm_grad = 5;
658
-    pwmconf.pwm_ampl = 180;
662
+    pwmconf.pwm_freq = 0b01;
663
+    pwmconf.pwm_grad = 14;
664
+    pwmconf.pwm_ofs = 36;
659 665
     st.PWMCONF(pwmconf.sr);
660 666
 
661 667
     #if ENABLED(HYBRID_THRESHOLD)

Loading…
Cancel
Save