ソースを参照

Init CS pins before loading settings (#9566)

teemuatlut 7年前
コミット
5990266724
3個のファイルの変更50行の追加0行の削除
  1. 7
    0
      Marlin/src/Marlin.cpp
  2. 39
    0
      Marlin/src/feature/tmc_util.cpp
  3. 4
    0
      Marlin/src/feature/tmc_util.h

+ 7
- 0
Marlin/src/Marlin.cpp ファイルの表示

@@ -689,6 +689,13 @@ void setup() {
689 689
   SERIAL_PROTOCOLLNPGM("start");
690 690
   SERIAL_ECHO_START();
691 691
 
692
+  #if ENABLED(HAVE_TMC2130)
693
+    tmc_init_cs_pins();
694
+  #endif
695
+  #if ENABLED(HAVE_TMC2208)
696
+    tmc2208_serial_begin();
697
+  #endif
698
+
692 699
   // Check startup - does nothing if bootloader sets MCUSR to 0
693 700
   byte mcu = HAL_get_reset_source();
694 701
   if (mcu &  1) SERIAL_ECHOLNPGM(MSG_POWERUP);

+ 39
- 0
Marlin/src/feature/tmc_util.cpp ファイルの表示

@@ -582,4 +582,43 @@ void _tmc_say_sgt(const char name[], const uint32_t sgt) {
582 582
 
583 583
 #endif // SENSORLESS_HOMING
584 584
 
585
+#if ENABLED(HAVE_TMC2130)
586
+  #define SET_CS_PIN(st) OUT_WRITE(st##_CS_PIN, HIGH)
587
+  void tmc_init_cs_pins() {
588
+    #if ENABLED(X_IS_TMC2130)
589
+      SET_CS_PIN(X);
590
+    #endif
591
+    #if ENABLED(Y_IS_TMC2130)
592
+      SET_CS_PIN(Y);
593
+    #endif
594
+    #if ENABLED(Z_IS_TMC2130)
595
+      SET_CS_PIN(Z);
596
+    #endif
597
+    #if ENABLED(X2_IS_TMC2130)
598
+      SET_CS_PIN(X2);
599
+    #endif
600
+    #if ENABLED(Y2_IS_TMC2130)
601
+      SET_CS_PIN(Y2);
602
+    #endif
603
+    #if ENABLED(Z2_IS_TMC2130)
604
+      SET_CS_PIN(Z2);
605
+    #endif
606
+    #if ENABLED(E0_IS_TMC2130)
607
+      SET_CS_PIN(E0);
608
+    #endif
609
+    #if ENABLED(E1_IS_TMC2130)
610
+      SET_CS_PIN(E1);
611
+    #endif
612
+    #if ENABLED(E2_IS_TMC2130)
613
+      SET_CS_PIN(E2);
614
+    #endif
615
+    #if ENABLED(E3_IS_TMC2130)
616
+      SET_CS_PIN(E3);
617
+    #endif
618
+    #if ENABLED(E4_IS_TMC2130)
619
+      SET_CS_PIN(E4);
620
+    #endif
621
+  }
622
+#endif // HAVE_TMC2130
623
+
585 624
 #endif // HAS_TRINAMIC

+ 4
- 0
Marlin/src/feature/tmc_util.h ファイルの表示

@@ -100,4 +100,8 @@ void monitor_tmc_driver();
100 100
   void tmc_sensorless_homing(TMC2130Stepper &st, bool enable=true);
101 101
 #endif
102 102
 
103
+#if ENABLED(HAVE_TMC2130)
104
+  void tmc_init_cs_pins();
105
+#endif
106
+
103 107
 #endif // _TMC_UTIL_H_

読み込み中…
キャンセル
保存