Browse Source

[2.0.x] TMC2130 support for LPC platform (#9114)

teemuatlut 6 years ago
parent
commit
5c69d45f5b
55 changed files with 328 additions and 12 deletions
  1. 6
    0
      Marlin/Configuration_adv.h
  2. 1
    1
      Marlin/src/HAL/HAL_LPC1768/HAL.h
  3. 16
    0
      Marlin/src/HAL/HAL_LPC1768/HAL_spi.cpp
  4. 1
    1
      Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.cpp
  5. 44
    0
      Marlin/src/HAL/HAL_LPC1768/LPC_SPI.h
  6. 1
    1
      Marlin/src/HAL/HAL_LPC1768/SoftwareSerial.cpp
  7. 1
    1
      Marlin/src/HAL/HAL_LPC1768/SoftwareSerial.h
  8. 1
    1
      Marlin/src/HAL/HAL_LPC1768/WInterrupts.cpp
  9. 1
    1
      Marlin/src/HAL/HAL_LPC1768/fastio.h
  10. 0
    0
      Marlin/src/HAL/HAL_LPC1768/include/Arduino.h
  11. 1
    1
      Marlin/src/HAL/HAL_LPC1768/main.cpp
  12. 2
    2
      Marlin/src/HAL/HAL_TEENSY35_36/HAL_Teensy.h
  13. 4
    0
      Marlin/src/HAL/SPI.h
  14. 6
    0
      Marlin/src/config/default/Configuration_adv.h
  15. 6
    0
      Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h
  16. 6
    0
      Marlin/src/config/examples/Anet/A6/Configuration_adv.h
  17. 6
    0
      Marlin/src/config/examples/Anet/A8/Configuration_adv.h
  18. 6
    0
      Marlin/src/config/examples/Azteeg/X5GT/Configuration_adv.h
  19. 6
    0
      Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h
  20. 6
    0
      Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h
  21. 6
    0
      Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h
  22. 6
    0
      Marlin/src/config/examples/Cartesio/Configuration_adv.h
  23. 6
    0
      Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h
  24. 6
    0
      Marlin/src/config/examples/Felix/Configuration_adv.h
  25. 6
    0
      Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h
  26. 6
    0
      Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h
  27. 6
    0
      Marlin/src/config/examples/MakerParts/Configuration_adv.h
  28. 6
    0
      Marlin/src/config/examples/Malyan/M150/Configuration_adv.h
  29. 6
    0
      Marlin/src/config/examples/Malyan/M200/Configuration_adv.h
  30. 6
    0
      Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h
  31. 6
    0
      Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h
  32. 6
    0
      Marlin/src/config/examples/RigidBot/Configuration_adv.h
  33. 6
    0
      Marlin/src/config/examples/SCARA/Configuration_adv.h
  34. 6
    0
      Marlin/src/config/examples/Sanguinololu/Configuration_adv.h
  35. 6
    0
      Marlin/src/config/examples/TinyBoy2/Configuration_adv.h
  36. 6
    0
      Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h
  37. 6
    0
      Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h
  38. 6
    0
      Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h
  39. 6
    0
      Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h
  40. 6
    0
      Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h
  41. 6
    0
      Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h
  42. 6
    0
      Marlin/src/config/examples/delta/generic/Configuration_adv.h
  43. 6
    0
      Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h
  44. 6
    0
      Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h
  45. 6
    0
      Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h
  46. 6
    0
      Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h
  47. 6
    0
      Marlin/src/config/examples/makibox/Configuration_adv.h
  48. 6
    0
      Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h
  49. 6
    0
      Marlin/src/config/examples/wt150/Configuration_adv.h
  50. 5
    1
      Marlin/src/module/stepper_indirection.cpp
  51. 10
    0
      Marlin/src/pins/pins_ARCHIM2.h
  52. 15
    0
      Marlin/src/pins/pins_RAMPS_RE_ARM.h
  53. 1
    1
      frameworks/CMSIS/LPC1768/lib/LiquidCrystal.cpp
  54. 1
    1
      frameworks/CMSIS/LPC1768/lib/Stream.cpp
  55. 1
    0
      platformio.ini

+ 6
- 0
Marlin/Configuration_adv.h View File

1086
   #define E4_MICROSTEPS       16
1086
   #define E4_MICROSTEPS       16
1087
 
1087
 
1088
   /**
1088
   /**
1089
+   * Use software SPI for TMC2130.
1090
+   * SW SPI pins are defined the respective pins files.
1091
+   */
1092
+  //#define TMC_USE_SW_SPI
1093
+
1094
+  /**
1089
    * Use Trinamic's ultra quiet stepping mode.
1095
    * Use Trinamic's ultra quiet stepping mode.
1090
    * When disabled, Marlin will use spreadCycle stepping mode.
1096
    * When disabled, Marlin will use spreadCycle stepping mode.
1091
    */
1097
    */

+ 1
- 1
Marlin/src/HAL/HAL_LPC1768/HAL.h View File

56
 #define B01 1
56
 #define B01 1
57
 #define B10 2
57
 #define B10 2
58
 
58
 
59
-#include "include/arduino.h"
59
+#include "include/Arduino.h"
60
 
60
 
61
 #include "pinmapping.h"
61
 #include "pinmapping.h"
62
 #include "fastio.h"
62
 #include "fastio.h"

+ 16
- 0
Marlin/src/HAL/HAL_LPC1768/HAL_spi.cpp View File

56
 //#include "../../../MarlinConfig.h"  //works except in U8g
56
 //#include "../../../MarlinConfig.h"  //works except in U8g
57
 #include "spi_pins.h"
57
 #include "spi_pins.h"
58
 #include "fastio.h"
58
 #include "fastio.h"
59
+#include "LPC_SPI.h"
60
+#include "../SPI.h"
59
 
61
 
60
 // --------------------------------------------------------------------------
62
 // --------------------------------------------------------------------------
61
 // Public Variables
63
 // Public Variables
191
     WRITE(SS_PIN, HIGH);
193
     WRITE(SS_PIN, HIGH);
192
   }
194
   }
193
 
195
 
196
+  void SPIClass::begin() { spiBegin(); }
197
+
198
+  uint8_t SPIClass::transfer(uint8_t B) {
199
+    return spiTransfer(B);
200
+  }
201
+  uint16_t SPIClass::transfer16(uint16_t data) {
202
+    uint16_t buffer;
203
+    buffer = transfer((data>>8) & 0xFF) << 8;
204
+    buffer |= transfer(data & 0xFF) && 0xFF;
205
+    return buffer;
206
+  }
207
+
208
+  SPIClass SPI;
209
+
194
 #else
210
 #else
195
 
211
 
196
   // hardware SPI
212
   // hardware SPI

+ 1
- 1
Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.cpp View File

74
 #include "../../inc/MarlinConfig.h"
74
 #include "../../inc/MarlinConfig.h"
75
 #include <lpc17xx_pinsel.h>
75
 #include <lpc17xx_pinsel.h>
76
 #include "LPC1768_PWM.h"
76
 #include "LPC1768_PWM.h"
77
-#include "arduino.h"
77
+#include "Arduino.h"
78
 
78
 
79
 #define NUM_ISR_PWMS 20
79
 #define NUM_ISR_PWMS 20
80
 
80
 

+ 44
- 0
Marlin/src/HAL/HAL_LPC1768/LPC_SPI.h View File

1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+#ifdef TARGET_LPC1768
24
+#include <stdint.h>
25
+
26
+#define MSBFIRST 0
27
+#define SPI_MODE3 0
28
+
29
+class SPISettings {
30
+  public:
31
+    SPISettings(int a, int b, int c) {};
32
+};
33
+
34
+class SPIClass {
35
+  public:
36
+    void begin();
37
+    void beginTransaction(SPISettings foo) {};
38
+    void endTransaction() {};
39
+    uint8_t transfer(uint8_t data);
40
+    uint16_t transfer16(uint16_t data);
41
+};
42
+
43
+extern SPIClass SPI;
44
+#endif

+ 1
- 1
Marlin/src/HAL/HAL_LPC1768/SoftwareSerial.cpp View File

39
 #include "../../inc/MarlinConfig.h"
39
 #include "../../inc/MarlinConfig.h"
40
 #include <stdint.h>
40
 #include <stdint.h>
41
 #include <stdarg.h>
41
 #include <stdarg.h>
42
-#include "include/arduino.h"
42
+#include "include/Arduino.h"
43
 #include "pinmapping.h"
43
 #include "pinmapping.h"
44
 #include "fastio.h"
44
 #include "fastio.h"
45
 #include "SoftwareSerial.h"
45
 #include "SoftwareSerial.h"

+ 1
- 1
Marlin/src/HAL/HAL_LPC1768/SoftwareSerial.h View File

33
 #ifndef SOFTWARESERIAL_H
33
 #ifndef SOFTWARESERIAL_H
34
 #define SOFTWARESERIAL_H
34
 #define SOFTWARESERIAL_H
35
 
35
 
36
-#include "include/arduino.h"
36
+#include "include/Arduino.h"
37
 #include <stdint.h>
37
 #include <stdint.h>
38
 //#include "serial.h"
38
 //#include "serial.h"
39
 #include <Stream.h>
39
 #include <Stream.h>

+ 1
- 1
Marlin/src/HAL/HAL_LPC1768/WInterrupts.cpp View File

19
 #ifdef TARGET_LPC1768
19
 #ifdef TARGET_LPC1768
20
 
20
 
21
 #include "../../inc/MarlinConfig.h"
21
 #include "../../inc/MarlinConfig.h"
22
-#include "include/arduino.h"
22
+#include "include/Arduino.h"
23
 #include "pinmapping.h"
23
 #include "pinmapping.h"
24
 //#include "HAL_timers.h"
24
 //#include "HAL_timers.h"
25
 #include "fastio.h"
25
 #include "fastio.h"

+ 1
- 1
Marlin/src/HAL/HAL_LPC1768/fastio.h View File

36
 #define _FASTIO_LPC1768_H
36
 #define _FASTIO_LPC1768_H
37
 
37
 
38
 #include <LPC17xx.h>
38
 #include <LPC17xx.h>
39
-#include "include/arduino.h"
39
+#include "include/Arduino.h"
40
 #include "pinmapping.h"
40
 #include "pinmapping.h"
41
 
41
 
42
 bool useable_hardware_PWM(pin_t pin);
42
 bool useable_hardware_PWM(pin_t pin);

Marlin/src/HAL/HAL_LPC1768/include/arduino.h → Marlin/src/HAL/HAL_LPC1768/include/Arduino.h View File


+ 1
- 1
Marlin/src/HAL/HAL_LPC1768/main.cpp View File

30
 #include "HAL_timers.h"
30
 #include "HAL_timers.h"
31
 #include <stdio.h>
31
 #include <stdio.h>
32
 #include <stdarg.h>
32
 #include <stdarg.h>
33
-#include "include/arduino.h"
33
+#include "include/Arduino.h"
34
 #include "serial.h"
34
 #include "serial.h"
35
 #include "LPC1768_PWM.h"
35
 #include "LPC1768_PWM.h"
36
 
36
 

+ 2
- 2
Marlin/src/HAL/HAL_TEENSY35_36/HAL_Teensy.h View File

82
 #define CRITICAL_SECTION_START  unsigned char _sreg = SREG; cli();
82
 #define CRITICAL_SECTION_START  unsigned char _sreg = SREG; cli();
83
 #define CRITICAL_SECTION_END    SREG = _sreg;
83
 #define CRITICAL_SECTION_END    SREG = _sreg;
84
 
84
 
85
-// On AVR this is in math.h?
86
-#define square(x) ((x)*(x))
85
+#undef sq
86
+#define sq(x) ((x)*(x))
87
 
87
 
88
 #ifndef strncpy_P
88
 #ifndef strncpy_P
89
   #define strncpy_P(dest, src, num) strncpy((dest), (src), (num))
89
   #define strncpy_P(dest, src, num) strncpy((dest), (src), (num))

+ 4
- 0
Marlin/src/HAL/SPI.h View File

79
 /** Begin SPI transaction, set clock, bit order, data mode */
79
 /** Begin SPI transaction, set clock, bit order, data mode */
80
 void spiBeginTransaction(uint32_t spiClock, uint8_t bitOrder, uint8_t dataMode);
80
 void spiBeginTransaction(uint32_t spiClock, uint8_t bitOrder, uint8_t dataMode);
81
 
81
 
82
+#ifdef TARGET_LPC1768
83
+  #include "HAL_LPC1768/LPC_SPI.h"
84
+#endif
85
+
82
 #endif // _SPI_H_
86
 #endif // _SPI_H_

+ 6
- 0
Marlin/src/config/default/Configuration_adv.h View File

1086
   #define E4_MICROSTEPS       16
1086
   #define E4_MICROSTEPS       16
1087
 
1087
 
1088
   /**
1088
   /**
1089
+   * Use software SPI for TMC2130.
1090
+   * SW SPI pins are defined the respective pins files.
1091
+   */
1092
+  //#define TMC_USE_SW_SPI
1093
+
1094
+  /**
1089
    * Use Trinamic's ultra quiet stepping mode.
1095
    * Use Trinamic's ultra quiet stepping mode.
1090
    * When disabled, Marlin will use spreadCycle stepping mode.
1096
    * When disabled, Marlin will use spreadCycle stepping mode.
1091
    */
1097
    */

+ 6
- 0
Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h View File

1086
   #define E4_MICROSTEPS       16
1086
   #define E4_MICROSTEPS       16
1087
 
1087
 
1088
   /**
1088
   /**
1089
+   * Use software SPI for TMC2130.
1090
+   * SW SPI pins are defined the respective pins files.
1091
+   */
1092
+  //#define TMC_USE_SW_SPI
1093
+
1094
+  /**
1089
    * Use Trinamic's ultra quiet stepping mode.
1095
    * Use Trinamic's ultra quiet stepping mode.
1090
    * When disabled, Marlin will use spreadCycle stepping mode.
1096
    * When disabled, Marlin will use spreadCycle stepping mode.
1091
    */
1097
    */

+ 6
- 0
Marlin/src/config/examples/Anet/A6/Configuration_adv.h View File

1086
   #define E4_MICROSTEPS       16
1086
   #define E4_MICROSTEPS       16
1087
 
1087
 
1088
   /**
1088
   /**
1089
+   * Use software SPI for TMC2130.
1090
+   * SW SPI pins are defined the respective pins files.
1091
+   */
1092
+  //#define TMC_USE_SW_SPI
1093
+
1094
+  /**
1089
    * Use Trinamic's ultra quiet stepping mode.
1095
    * Use Trinamic's ultra quiet stepping mode.
1090
    * When disabled, Marlin will use spreadCycle stepping mode.
1096
    * When disabled, Marlin will use spreadCycle stepping mode.
1091
    */
1097
    */

+ 6
- 0
Marlin/src/config/examples/Anet/A8/Configuration_adv.h View File

1086
   #define E4_MICROSTEPS       16
1086
   #define E4_MICROSTEPS       16
1087
 
1087
 
1088
   /**
1088
   /**
1089
+   * Use software SPI for TMC2130.
1090
+   * SW SPI pins are defined the respective pins files.
1091
+   */
1092
+  //#define TMC_USE_SW_SPI
1093
+
1094
+  /**
1089
    * Use Trinamic's ultra quiet stepping mode.
1095
    * Use Trinamic's ultra quiet stepping mode.
1090
    * When disabled, Marlin will use spreadCycle stepping mode.
1096
    * When disabled, Marlin will use spreadCycle stepping mode.
1091
    */
1097
    */

+ 6
- 0
Marlin/src/config/examples/Azteeg/X5GT/Configuration_adv.h View File

1087
   #define E4_MICROSTEPS       16
1087
   #define E4_MICROSTEPS       16
1088
 
1088
 
1089
   /**
1089
   /**
1090
+   * Use software SPI for TMC2130.
1091
+   * SW SPI pins are defined the respective pins files.
1092
+   */
1093
+  //#define TMC_USE_SW_SPI
1094
+
1095
+  /**
1090
    * Use Trinamic's ultra quiet stepping mode.
1096
    * Use Trinamic's ultra quiet stepping mode.
1091
    * When disabled, Marlin will use spreadCycle stepping mode.
1097
    * When disabled, Marlin will use spreadCycle stepping mode.
1092
    */
1098
    */

+ 6
- 0
Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h View File

1086
   #define E4_MICROSTEPS       16
1086
   #define E4_MICROSTEPS       16
1087
 
1087
 
1088
   /**
1088
   /**
1089
+   * Use software SPI for TMC2130.
1090
+   * SW SPI pins are defined the respective pins files.
1091
+   */
1092
+  //#define TMC_USE_SW_SPI
1093
+
1094
+  /**
1089
    * Use Trinamic's ultra quiet stepping mode.
1095
    * Use Trinamic's ultra quiet stepping mode.
1090
    * When disabled, Marlin will use spreadCycle stepping mode.
1096
    * When disabled, Marlin will use spreadCycle stepping mode.
1091
    */
1097
    */

+ 6
- 0
Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h View File

1086
   #define E4_MICROSTEPS       16
1086
   #define E4_MICROSTEPS       16
1087
 
1087
 
1088
   /**
1088
   /**
1089
+   * Use software SPI for TMC2130.
1090
+   * SW SPI pins are defined the respective pins files.
1091
+   */
1092
+  //#define TMC_USE_SW_SPI
1093
+
1094
+  /**
1089
    * Use Trinamic's ultra quiet stepping mode.
1095
    * Use Trinamic's ultra quiet stepping mode.
1090
    * When disabled, Marlin will use spreadCycle stepping mode.
1096
    * When disabled, Marlin will use spreadCycle stepping mode.
1091
    */
1097
    */

+ 6
- 0
Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h View File

1086
   #define E4_MICROSTEPS       16
1086
   #define E4_MICROSTEPS       16
1087
 
1087
 
1088
   /**
1088
   /**
1089
+   * Use software SPI for TMC2130.
1090
+   * SW SPI pins are defined the respective pins files.
1091
+   */
1092
+  //#define TMC_USE_SW_SPI
1093
+
1094
+  /**
1089
    * Use Trinamic's ultra quiet stepping mode.
1095
    * Use Trinamic's ultra quiet stepping mode.
1090
    * When disabled, Marlin will use spreadCycle stepping mode.
1096
    * When disabled, Marlin will use spreadCycle stepping mode.
1091
    */
1097
    */

+ 6
- 0
Marlin/src/config/examples/Cartesio/Configuration_adv.h View File

1086
   #define E4_MICROSTEPS       16
1086
   #define E4_MICROSTEPS       16
1087
 
1087
 
1088
   /**
1088
   /**
1089
+   * Use software SPI for TMC2130.
1090
+   * SW SPI pins are defined the respective pins files.
1091
+   */
1092
+  //#define TMC_USE_SW_SPI
1093
+
1094
+  /**
1089
    * Use Trinamic's ultra quiet stepping mode.
1095
    * Use Trinamic's ultra quiet stepping mode.
1090
    * When disabled, Marlin will use spreadCycle stepping mode.
1096
    * When disabled, Marlin will use spreadCycle stepping mode.
1091
    */
1097
    */

+ 6
- 0
Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h View File

1086
   #define E4_MICROSTEPS       16
1086
   #define E4_MICROSTEPS       16
1087
 
1087
 
1088
   /**
1088
   /**
1089
+   * Use software SPI for TMC2130.
1090
+   * SW SPI pins are defined the respective pins files.
1091
+   */
1092
+  //#define TMC_USE_SW_SPI
1093
+
1094
+  /**
1089
    * Use Trinamic's ultra quiet stepping mode.
1095
    * Use Trinamic's ultra quiet stepping mode.
1090
    * When disabled, Marlin will use spreadCycle stepping mode.
1096
    * When disabled, Marlin will use spreadCycle stepping mode.
1091
    */
1097
    */

+ 6
- 0
Marlin/src/config/examples/Felix/Configuration_adv.h View File

1086
   #define E4_MICROSTEPS       16
1086
   #define E4_MICROSTEPS       16
1087
 
1087
 
1088
   /**
1088
   /**
1089
+   * Use software SPI for TMC2130.
1090
+   * SW SPI pins are defined the respective pins files.
1091
+   */
1092
+  //#define TMC_USE_SW_SPI
1093
+
1094
+  /**
1089
    * Use Trinamic's ultra quiet stepping mode.
1095
    * Use Trinamic's ultra quiet stepping mode.
1090
    * When disabled, Marlin will use spreadCycle stepping mode.
1096
    * When disabled, Marlin will use spreadCycle stepping mode.
1091
    */
1097
    */

+ 6
- 0
Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h View File

1086
   #define E4_MICROSTEPS       16
1086
   #define E4_MICROSTEPS       16
1087
 
1087
 
1088
   /**
1088
   /**
1089
+   * Use software SPI for TMC2130.
1090
+   * SW SPI pins are defined the respective pins files.
1091
+   */
1092
+  //#define TMC_USE_SW_SPI
1093
+
1094
+  /**
1089
    * Use Trinamic's ultra quiet stepping mode.
1095
    * Use Trinamic's ultra quiet stepping mode.
1090
    * When disabled, Marlin will use spreadCycle stepping mode.
1096
    * When disabled, Marlin will use spreadCycle stepping mode.
1091
    */
1097
    */

+ 6
- 0
Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h View File

1086
   #define E4_MICROSTEPS       16
1086
   #define E4_MICROSTEPS       16
1087
 
1087
 
1088
   /**
1088
   /**
1089
+   * Use software SPI for TMC2130.
1090
+   * SW SPI pins are defined the respective pins files.
1091
+   */
1092
+  //#define TMC_USE_SW_SPI
1093
+
1094
+  /**
1089
    * Use Trinamic's ultra quiet stepping mode.
1095
    * Use Trinamic's ultra quiet stepping mode.
1090
    * When disabled, Marlin will use spreadCycle stepping mode.
1096
    * When disabled, Marlin will use spreadCycle stepping mode.
1091
    */
1097
    */

+ 6
- 0
Marlin/src/config/examples/MakerParts/Configuration_adv.h View File

1087
   #define E4_MICROSTEPS       16
1087
   #define E4_MICROSTEPS       16
1088
 
1088
 
1089
   /**
1089
   /**
1090
+   * Use software SPI for TMC2130.
1091
+   * SW SPI pins are defined the respective pins files.
1092
+   */
1093
+  //#define TMC_USE_SW_SPI
1094
+
1095
+  /**
1090
    * Use Trinamic's ultra quiet stepping mode.
1096
    * Use Trinamic's ultra quiet stepping mode.
1091
    * When disabled, Marlin will use spreadCycle stepping mode.
1097
    * When disabled, Marlin will use spreadCycle stepping mode.
1092
    */
1098
    */

+ 6
- 0
Marlin/src/config/examples/Malyan/M150/Configuration_adv.h View File

1086
   #define E4_MICROSTEPS       16
1086
   #define E4_MICROSTEPS       16
1087
 
1087
 
1088
   /**
1088
   /**
1089
+   * Use software SPI for TMC2130.
1090
+   * SW SPI pins are defined the respective pins files.
1091
+   */
1092
+  //#define TMC_USE_SW_SPI
1093
+
1094
+  /**
1089
    * Use Trinamic's ultra quiet stepping mode.
1095
    * Use Trinamic's ultra quiet stepping mode.
1090
    * When disabled, Marlin will use spreadCycle stepping mode.
1096
    * When disabled, Marlin will use spreadCycle stepping mode.
1091
    */
1097
    */

+ 6
- 0
Marlin/src/config/examples/Malyan/M200/Configuration_adv.h View File

1086
   #define E4_MICROSTEPS       16
1086
   #define E4_MICROSTEPS       16
1087
 
1087
 
1088
   /**
1088
   /**
1089
+   * Use software SPI for TMC2130.
1090
+   * SW SPI pins are defined the respective pins files.
1091
+   */
1092
+  //#define TMC_USE_SW_SPI
1093
+
1094
+  /**
1089
    * Use Trinamic's ultra quiet stepping mode.
1095
    * Use Trinamic's ultra quiet stepping mode.
1090
    * When disabled, Marlin will use spreadCycle stepping mode.
1096
    * When disabled, Marlin will use spreadCycle stepping mode.
1091
    */
1097
    */

+ 6
- 0
Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h View File

1086
   #define E4_MICROSTEPS       16
1086
   #define E4_MICROSTEPS       16
1087
 
1087
 
1088
   /**
1088
   /**
1089
+   * Use software SPI for TMC2130.
1090
+   * SW SPI pins are defined the respective pins files.
1091
+   */
1092
+  //#define TMC_USE_SW_SPI
1093
+
1094
+  /**
1089
    * Use Trinamic's ultra quiet stepping mode.
1095
    * Use Trinamic's ultra quiet stepping mode.
1090
    * When disabled, Marlin will use spreadCycle stepping mode.
1096
    * When disabled, Marlin will use spreadCycle stepping mode.
1091
    */
1097
    */

+ 6
- 0
Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h View File

1094
   #define E4_MICROSTEPS       16
1094
   #define E4_MICROSTEPS       16
1095
 
1095
 
1096
   /**
1096
   /**
1097
+   * Use software SPI for TMC2130.
1098
+   * SW SPI pins are defined the respective pins files.
1099
+   */
1100
+  //#define TMC_USE_SW_SPI
1101
+
1102
+  /**
1097
    * Use Trinamic's ultra quiet stepping mode.
1103
    * Use Trinamic's ultra quiet stepping mode.
1098
    * When disabled, Marlin will use spreadCycle stepping mode.
1104
    * When disabled, Marlin will use spreadCycle stepping mode.
1099
    */
1105
    */

+ 6
- 0
Marlin/src/config/examples/RigidBot/Configuration_adv.h View File

1086
   #define E4_MICROSTEPS       16
1086
   #define E4_MICROSTEPS       16
1087
 
1087
 
1088
   /**
1088
   /**
1089
+   * Use software SPI for TMC2130.
1090
+   * SW SPI pins are defined the respective pins files.
1091
+   */
1092
+  //#define TMC_USE_SW_SPI
1093
+
1094
+  /**
1089
    * Use Trinamic's ultra quiet stepping mode.
1095
    * Use Trinamic's ultra quiet stepping mode.
1090
    * When disabled, Marlin will use spreadCycle stepping mode.
1096
    * When disabled, Marlin will use spreadCycle stepping mode.
1091
    */
1097
    */

+ 6
- 0
Marlin/src/config/examples/SCARA/Configuration_adv.h View File

1086
   #define E4_MICROSTEPS       16
1086
   #define E4_MICROSTEPS       16
1087
 
1087
 
1088
   /**
1088
   /**
1089
+   * Use software SPI for TMC2130.
1090
+   * SW SPI pins are defined the respective pins files.
1091
+   */
1092
+  //#define TMC_USE_SW_SPI
1093
+
1094
+  /**
1089
    * Use Trinamic's ultra quiet stepping mode.
1095
    * Use Trinamic's ultra quiet stepping mode.
1090
    * When disabled, Marlin will use spreadCycle stepping mode.
1096
    * When disabled, Marlin will use spreadCycle stepping mode.
1091
    */
1097
    */

+ 6
- 0
Marlin/src/config/examples/Sanguinololu/Configuration_adv.h View File

1086
   #define E4_MICROSTEPS       16
1086
   #define E4_MICROSTEPS       16
1087
 
1087
 
1088
   /**
1088
   /**
1089
+   * Use software SPI for TMC2130.
1090
+   * SW SPI pins are defined the respective pins files.
1091
+   */
1092
+  //#define TMC_USE_SW_SPI
1093
+
1094
+  /**
1089
    * Use Trinamic's ultra quiet stepping mode.
1095
    * Use Trinamic's ultra quiet stepping mode.
1090
    * When disabled, Marlin will use spreadCycle stepping mode.
1096
    * When disabled, Marlin will use spreadCycle stepping mode.
1091
    */
1097
    */

+ 6
- 0
Marlin/src/config/examples/TinyBoy2/Configuration_adv.h View File

1086
   #define E4_MICROSTEPS       16
1086
   #define E4_MICROSTEPS       16
1087
 
1087
 
1088
   /**
1088
   /**
1089
+   * Use software SPI for TMC2130.
1090
+   * SW SPI pins are defined the respective pins files.
1091
+   */
1092
+  //#define TMC_USE_SW_SPI
1093
+
1094
+  /**
1089
    * Use Trinamic's ultra quiet stepping mode.
1095
    * Use Trinamic's ultra quiet stepping mode.
1090
    * When disabled, Marlin will use spreadCycle stepping mode.
1096
    * When disabled, Marlin will use spreadCycle stepping mode.
1091
    */
1097
    */

+ 6
- 0
Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h View File

1086
   #define E4_MICROSTEPS       16
1086
   #define E4_MICROSTEPS       16
1087
 
1087
 
1088
   /**
1088
   /**
1089
+   * Use software SPI for TMC2130.
1090
+   * SW SPI pins are defined the respective pins files.
1091
+   */
1092
+  //#define TMC_USE_SW_SPI
1093
+
1094
+  /**
1089
    * Use Trinamic's ultra quiet stepping mode.
1095
    * Use Trinamic's ultra quiet stepping mode.
1090
    * When disabled, Marlin will use spreadCycle stepping mode.
1096
    * When disabled, Marlin will use spreadCycle stepping mode.
1091
    */
1097
    */

+ 6
- 0
Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h View File

1099
   #define E4_MICROSTEPS       16
1099
   #define E4_MICROSTEPS       16
1100
 
1100
 
1101
   /**
1101
   /**
1102
+   * Use software SPI for TMC2130.
1103
+   * SW SPI pins are defined the respective pins files.
1104
+   */
1105
+  //#define TMC_USE_SW_SPI
1106
+
1107
+  /**
1102
    * Use Trinamic's ultra quiet stepping mode.
1108
    * Use Trinamic's ultra quiet stepping mode.
1103
    * When disabled, Marlin will use spreadCycle stepping mode.
1109
    * When disabled, Marlin will use spreadCycle stepping mode.
1104
    */
1110
    */

+ 6
- 0
Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h View File

1086
   #define E4_MICROSTEPS       16
1086
   #define E4_MICROSTEPS       16
1087
 
1087
 
1088
   /**
1088
   /**
1089
+   * Use software SPI for TMC2130.
1090
+   * SW SPI pins are defined the respective pins files.
1091
+   */
1092
+  //#define TMC_USE_SW_SPI
1093
+
1094
+  /**
1089
    * Use Trinamic's ultra quiet stepping mode.
1095
    * Use Trinamic's ultra quiet stepping mode.
1090
    * When disabled, Marlin will use spreadCycle stepping mode.
1096
    * When disabled, Marlin will use spreadCycle stepping mode.
1091
    */
1097
    */

+ 6
- 0
Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h View File

1088
   #define E4_MICROSTEPS       16
1088
   #define E4_MICROSTEPS       16
1089
 
1089
 
1090
   /**
1090
   /**
1091
+   * Use software SPI for TMC2130.
1092
+   * SW SPI pins are defined the respective pins files.
1093
+   */
1094
+  //#define TMC_USE_SW_SPI
1095
+
1096
+  /**
1091
    * Use Trinamic's ultra quiet stepping mode.
1097
    * Use Trinamic's ultra quiet stepping mode.
1092
    * When disabled, Marlin will use spreadCycle stepping mode.
1098
    * When disabled, Marlin will use spreadCycle stepping mode.
1093
    */
1099
    */

+ 6
- 0
Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h View File

1088
   #define E4_MICROSTEPS       16
1088
   #define E4_MICROSTEPS       16
1089
 
1089
 
1090
   /**
1090
   /**
1091
+   * Use software SPI for TMC2130.
1092
+   * SW SPI pins are defined the respective pins files.
1093
+   */
1094
+  //#define TMC_USE_SW_SPI
1095
+
1096
+  /**
1091
    * Use Trinamic's ultra quiet stepping mode.
1097
    * Use Trinamic's ultra quiet stepping mode.
1092
    * When disabled, Marlin will use spreadCycle stepping mode.
1098
    * When disabled, Marlin will use spreadCycle stepping mode.
1093
    */
1099
    */

+ 6
- 0
Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h View File

1088
   #define E4_MICROSTEPS       16
1088
   #define E4_MICROSTEPS       16
1089
 
1089
 
1090
   /**
1090
   /**
1091
+   * Use software SPI for TMC2130.
1092
+   * SW SPI pins are defined the respective pins files.
1093
+   */
1094
+  //#define TMC_USE_SW_SPI
1095
+
1096
+  /**
1091
    * Use Trinamic's ultra quiet stepping mode.
1097
    * Use Trinamic's ultra quiet stepping mode.
1092
    * When disabled, Marlin will use spreadCycle stepping mode.
1098
    * When disabled, Marlin will use spreadCycle stepping mode.
1093
    */
1099
    */

+ 6
- 0
Marlin/src/config/examples/delta/generic/Configuration_adv.h View File

1088
   #define E4_MICROSTEPS       16
1088
   #define E4_MICROSTEPS       16
1089
 
1089
 
1090
   /**
1090
   /**
1091
+   * Use software SPI for TMC2130.
1092
+   * SW SPI pins are defined the respective pins files.
1093
+   */
1094
+  //#define TMC_USE_SW_SPI
1095
+
1096
+  /**
1091
    * Use Trinamic's ultra quiet stepping mode.
1097
    * Use Trinamic's ultra quiet stepping mode.
1092
    * When disabled, Marlin will use spreadCycle stepping mode.
1098
    * When disabled, Marlin will use spreadCycle stepping mode.
1093
    */
1099
    */

+ 6
- 0
Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h View File

1088
   #define E4_MICROSTEPS       16
1088
   #define E4_MICROSTEPS       16
1089
 
1089
 
1090
   /**
1090
   /**
1091
+   * Use software SPI for TMC2130.
1092
+   * SW SPI pins are defined the respective pins files.
1093
+   */
1094
+  //#define TMC_USE_SW_SPI
1095
+
1096
+  /**
1091
    * Use Trinamic's ultra quiet stepping mode.
1097
    * Use Trinamic's ultra quiet stepping mode.
1092
    * When disabled, Marlin will use spreadCycle stepping mode.
1098
    * When disabled, Marlin will use spreadCycle stepping mode.
1093
    */
1099
    */

+ 6
- 0
Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h View File

1093
   #define E4_MICROSTEPS       16
1093
   #define E4_MICROSTEPS       16
1094
 
1094
 
1095
   /**
1095
   /**
1096
+   * Use software SPI for TMC2130.
1097
+   * SW SPI pins are defined the respective pins files.
1098
+   */
1099
+  //#define TMC_USE_SW_SPI
1100
+
1101
+  /**
1096
    * Use Trinamic's ultra quiet stepping mode.
1102
    * Use Trinamic's ultra quiet stepping mode.
1097
    * When disabled, Marlin will use spreadCycle stepping mode.
1103
    * When disabled, Marlin will use spreadCycle stepping mode.
1098
    */
1104
    */

+ 6
- 0
Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h View File

1088
   #define E4_MICROSTEPS       16
1088
   #define E4_MICROSTEPS       16
1089
 
1089
 
1090
   /**
1090
   /**
1091
+   * Use software SPI for TMC2130.
1092
+   * SW SPI pins are defined the respective pins files.
1093
+   */
1094
+  //#define TMC_USE_SW_SPI
1095
+
1096
+  /**
1091
    * Use Trinamic's ultra quiet stepping mode.
1097
    * Use Trinamic's ultra quiet stepping mode.
1092
    * When disabled, Marlin will use spreadCycle stepping mode.
1098
    * When disabled, Marlin will use spreadCycle stepping mode.
1093
    */
1099
    */

+ 6
- 0
Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h View File

1086
   #define E4_MICROSTEPS       16
1086
   #define E4_MICROSTEPS       16
1087
 
1087
 
1088
   /**
1088
   /**
1089
+   * Use software SPI for TMC2130.
1090
+   * SW SPI pins are defined the respective pins files.
1091
+   */
1092
+  //#define TMC_USE_SW_SPI
1093
+
1094
+  /**
1089
    * Use Trinamic's ultra quiet stepping mode.
1095
    * Use Trinamic's ultra quiet stepping mode.
1090
    * When disabled, Marlin will use spreadCycle stepping mode.
1096
    * When disabled, Marlin will use spreadCycle stepping mode.
1091
    */
1097
    */

+ 6
- 0
Marlin/src/config/examples/makibox/Configuration_adv.h View File

1086
   #define E4_MICROSTEPS       16
1086
   #define E4_MICROSTEPS       16
1087
 
1087
 
1088
   /**
1088
   /**
1089
+   * Use software SPI for TMC2130.
1090
+   * SW SPI pins are defined the respective pins files.
1091
+   */
1092
+  //#define TMC_USE_SW_SPI
1093
+
1094
+  /**
1089
    * Use Trinamic's ultra quiet stepping mode.
1095
    * Use Trinamic's ultra quiet stepping mode.
1090
    * When disabled, Marlin will use spreadCycle stepping mode.
1096
    * When disabled, Marlin will use spreadCycle stepping mode.
1091
    */
1097
    */

+ 6
- 0
Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h View File

1086
   #define E4_MICROSTEPS       16
1086
   #define E4_MICROSTEPS       16
1087
 
1087
 
1088
   /**
1088
   /**
1089
+   * Use software SPI for TMC2130.
1090
+   * SW SPI pins are defined the respective pins files.
1091
+   */
1092
+  //#define TMC_USE_SW_SPI
1093
+
1094
+  /**
1089
    * Use Trinamic's ultra quiet stepping mode.
1095
    * Use Trinamic's ultra quiet stepping mode.
1090
    * When disabled, Marlin will use spreadCycle stepping mode.
1096
    * When disabled, Marlin will use spreadCycle stepping mode.
1091
    */
1097
    */

+ 6
- 0
Marlin/src/config/examples/wt150/Configuration_adv.h View File

1087
   #define E4_MICROSTEPS       16
1087
   #define E4_MICROSTEPS       16
1088
 
1088
 
1089
   /**
1089
   /**
1090
+   * Use software SPI for TMC2130.
1091
+   * SW SPI pins are defined the respective pins files.
1092
+   */
1093
+  //#define TMC_USE_SW_SPI
1094
+
1095
+  /**
1090
    * Use Trinamic's ultra quiet stepping mode.
1096
    * Use Trinamic's ultra quiet stepping mode.
1091
    * When disabled, Marlin will use spreadCycle stepping mode.
1097
    * When disabled, Marlin will use spreadCycle stepping mode.
1092
    */
1098
    */

+ 5
- 1
Marlin/src/module/stepper_indirection.cpp View File

137
   #include "planner.h"
137
   #include "planner.h"
138
   #include "../core/enum.h"
138
   #include "../core/enum.h"
139
 
139
 
140
-  #define _TMC2130_DEFINE(ST) TMC2130Stepper stepper##ST(ST##_ENABLE_PIN, ST##_DIR_PIN, ST##_STEP_PIN, ST##_CS_PIN)
140
+  #if ENABLED(TMC_USE_SW_SPI)
141
+    #define _TMC2130_DEFINE(ST) TMC2130Stepper stepper##ST(ST##_ENABLE_PIN, ST##_DIR_PIN, ST##_STEP_PIN, ST##_CS_PIN, TMC_SW_MOSI, TMC_SW_MISO, TMC_SW_SCK)
142
+  #else
143
+    #define _TMC2130_DEFINE(ST) TMC2130Stepper stepper##ST(ST##_ENABLE_PIN, ST##_DIR_PIN, ST##_STEP_PIN, ST##_CS_PIN)
144
+  #endif
141
 
145
 
142
   // Stepper objects of TMC2130 steppers used
146
   // Stepper objects of TMC2130 steppers used
143
   #if ENABLED(X_IS_TMC2130)
147
   #if ENABLED(X_IS_TMC2130)

+ 10
- 0
Marlin/src/pins/pins_ARCHIM2.h View File

94
 #define E1_DIAG_PIN        25   // PD0 E2_DIAG
94
 #define E1_DIAG_PIN        25   // PD0 E2_DIAG
95
 
95
 
96
 //
96
 //
97
+// Software SPI pins for TMC2130 stepper drivers.
98
+// Required for the Archim2 board.
99
+//
100
+#if ENABLED(TMC_USE_SW_SPI)
101
+  #define TMC_SW_MOSI      28   // PD3
102
+  #define TMC_SW_MISO      26   // PD1
103
+  #define TMC_SW_SCK       27   // PD2
104
+#endif
105
+
106
+//
97
 // Temperature Sensors
107
 // Temperature Sensors
98
 //
108
 //
99
 #define TEMP_0_PIN         10   // D10 PB19 THERM AN1 *
109
 #define TEMP_0_PIN         10   // D10 PB19 THERM AN1 *

+ 15
- 0
Marlin/src/pins/pins_RAMPS_RE_ARM.h View File

68
 #define X_STEP_PIN         P2_01  // (54)
68
 #define X_STEP_PIN         P2_01  // (54)
69
 #define X_DIR_PIN          P0_11  // (55)
69
 #define X_DIR_PIN          P0_11  // (55)
70
 #define X_ENABLE_PIN       P0_10  // (38)
70
 #define X_ENABLE_PIN       P0_10  // (38)
71
+#define X_CS_PIN           P1_01  // ETH
71
 
72
 
72
 #define Y_STEP_PIN         P2_02  // (60)
73
 #define Y_STEP_PIN         P2_02  // (60)
73
 #define Y_DIR_PIN          P0_20  // (61)
74
 #define Y_DIR_PIN          P0_20  // (61)
74
 #define Y_ENABLE_PIN       P0_19  // (56)
75
 #define Y_ENABLE_PIN       P0_19  // (56)
76
+#define Y_CS_PIN           P1_04  // ETH
75
 
77
 
76
 #define Z_STEP_PIN         P2_03  // (46)
78
 #define Z_STEP_PIN         P2_03  // (46)
77
 #define Z_DIR_PIN          P0_22  // (48)
79
 #define Z_DIR_PIN          P0_22  // (48)
78
 #define Z_ENABLE_PIN       P0_21  // (62)
80
 #define Z_ENABLE_PIN       P0_21  // (62)
81
+#define Z_CS_PIN           P1_10  // ETH
79
 
82
 
80
 #define E0_STEP_PIN        P2_00  // (26)
83
 #define E0_STEP_PIN        P2_00  // (26)
81
 #define E0_DIR_PIN         P0_05  // (28)
84
 #define E0_DIR_PIN         P0_05  // (28)
82
 #define E0_ENABLE_PIN      P0_04  // (24)
85
 #define E0_ENABLE_PIN      P0_04  // (24)
86
+#define E0_CS_PIN          P1_14  // ETH
83
 
87
 
84
 #define E1_STEP_PIN        P2_08  // (36)
88
 #define E1_STEP_PIN        P2_08  // (36)
85
 #define E1_DIR_PIN         P2_13  // (34)
89
 #define E1_DIR_PIN         P2_13  // (34)
86
 #define E1_ENABLE_PIN      P4_29  // (30)
90
 #define E1_ENABLE_PIN      P4_29  // (30)
91
+#define E1_CS_PIN          -1
87
 
92
 
88
 #define E2_STEP_PIN        P2_08  // (36)
93
 #define E2_STEP_PIN        P2_08  // (36)
89
 #define E2_DIR_PIN         P2_13  // (34)
94
 #define E2_DIR_PIN         P2_13  // (34)
90
 #define E2_ENABLE_PIN      P4_29  // (30)
95
 #define E2_ENABLE_PIN      P4_29  // (30)
96
+#define E2_CS_PIN          -1
97
+
98
+//
99
+// Software SPI pins for TMC2130 stepper drivers
100
+//
101
+#if ENABLED(TMC_USE_SW_SPI)
102
+  #define TMC_SW_MOSI      P1_00  // ETH
103
+  #define TMC_SW_MISO      P1_08  // ETH
104
+  #define TMC_SW_SCK       P1_09  // ETH
105
+#endif
91
 
106
 
92
 //
107
 //
93
 // Temperature Sensors
108
 // Temperature Sensors

+ 1
- 1
frameworks/CMSIS/LPC1768/lib/LiquidCrystal.cpp View File

3
 #include <stdio.h>
3
 #include <stdio.h>
4
 #include <string.h>
4
 #include <string.h>
5
 #include <inttypes.h>
5
 #include <inttypes.h>
6
-#include <arduino.h>
6
+#include <Arduino.h>
7
 
7
 
8
 // When the display powers up, it is configured as follows:
8
 // When the display powers up, it is configured as follows:
9
 //
9
 //

+ 1
- 1
frameworks/CMSIS/LPC1768/lib/Stream.cpp View File

23
  */
23
  */
24
 
24
 
25
 #include <stdlib.h>
25
 #include <stdlib.h>
26
-#include <arduino.h>
26
+#include <Arduino.h>
27
 
27
 
28
 #include "Stream.h"
28
 #include "Stream.h"
29
 
29
 

+ 1
- 0
platformio.ini View File

113
 lib_extra_dirs  = frameworks
113
 lib_extra_dirs  = frameworks
114
 lib_deps        = CMSIS-LPC1768
114
 lib_deps        = CMSIS-LPC1768
115
   U8glib-HAL
115
   U8glib-HAL
116
+  TMC2130Stepper@>=2.1.1
116
 extra_scripts   = Marlin/src/HAL/HAL_LPC1768/lpc1768_flag_script.py
117
 extra_scripts   = Marlin/src/HAL/HAL_LPC1768/lpc1768_flag_script.py
117
 src_filter      = ${common.default_src_filter}
118
 src_filter      = ${common.default_src_filter}
118
 
119
 

Loading…
Cancel
Save