Browse Source

L6470 SPI daisy chain support (#12895)

Bob Kuhn 5 years ago
parent
commit
2f35747f29
95 changed files with 7844 additions and 1429 deletions
  1. 75
    16
      Marlin/Configuration_adv.h
  2. 144
    0
      Marlin/src/HAL/shared/HAL_spi_L6470.cpp
  3. 38
    18
      Marlin/src/Marlin.cpp
  4. 265
    0
      Marlin/src/Marlin.h
  5. 75
    16
      Marlin/src/config/default/Configuration_adv.h
  6. 75
    16
      Marlin/src/config/examples/3DFabXYZ/Migbot/Configuration_adv.h
  7. 75
    16
      Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h
  8. 75
    16
      Marlin/src/config/examples/Anet/A2/Configuration_adv.h
  9. 75
    16
      Marlin/src/config/examples/Anet/A2plus/Configuration_adv.h
  10. 75
    16
      Marlin/src/config/examples/Anet/A6/Configuration_adv.h
  11. 75
    16
      Marlin/src/config/examples/Anet/A8/Configuration_adv.h
  12. 75
    16
      Marlin/src/config/examples/ArmEd/Configuration_adv.h
  13. 75
    16
      Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration_adv.h
  14. 75
    16
      Marlin/src/config/examples/BIBO/TouchX/default/Configuration_adv.h
  15. 75
    16
      Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h
  16. 75
    16
      Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h
  17. 75
    16
      Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h
  18. 75
    16
      Marlin/src/config/examples/Cartesio/Configuration_adv.h
  19. 75
    16
      Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h
  20. 75
    16
      Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h
  21. 75
    16
      Marlin/src/config/examples/Creality/CR-10mini/Configuration_adv.h
  22. 75
    16
      Marlin/src/config/examples/Creality/CR-8/Configuration_adv.h
  23. 75
    16
      Marlin/src/config/examples/Creality/Ender-2/Configuration_adv.h
  24. 75
    16
      Marlin/src/config/examples/Creality/Ender-3/Configuration_adv.h
  25. 75
    16
      Marlin/src/config/examples/Creality/Ender-4/Configuration_adv.h
  26. 75
    16
      Marlin/src/config/examples/Einstart-S/Configuration_adv.h
  27. 75
    16
      Marlin/src/config/examples/Felix/Configuration_adv.h
  28. 75
    16
      Marlin/src/config/examples/FlashForge/CreatorPro/Configuration_adv.h
  29. 75
    16
      Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h
  30. 75
    16
      Marlin/src/config/examples/Formbot/Raptor/Configuration_adv.h
  31. 75
    16
      Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration_adv.h
  32. 75
    16
      Marlin/src/config/examples/Formbot/T_Rex_3/Configuration_adv.h
  33. 75
    16
      Marlin/src/config/examples/Geeetech/MeCreator2/Configuration_adv.h
  34. 75
    16
      Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration_adv.h
  35. 75
    16
      Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration_adv.h
  36. 75
    16
      Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h
  37. 75
    16
      Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h
  38. 75
    16
      Marlin/src/config/examples/MakerParts/Configuration_adv.h
  39. 75
    16
      Marlin/src/config/examples/Malyan/M150/Configuration_adv.h
  40. 75
    16
      Marlin/src/config/examples/Malyan/M200/Configuration_adv.h
  41. 75
    16
      Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h
  42. 75
    16
      Marlin/src/config/examples/Mks/Robin/Configuration_adv.h
  43. 75
    16
      Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h
  44. 75
    16
      Marlin/src/config/examples/RapideLite/RL200/Configuration_adv.h
  45. 75
    16
      Marlin/src/config/examples/RigidBot/Configuration_adv.h
  46. 75
    16
      Marlin/src/config/examples/SCARA/Configuration_adv.h
  47. 75
    16
      Marlin/src/config/examples/Sanguinololu/Configuration_adv.h
  48. 75
    16
      Marlin/src/config/examples/TheBorg/Configuration_adv.h
  49. 75
    16
      Marlin/src/config/examples/TinyBoy2/Configuration_adv.h
  50. 75
    16
      Marlin/src/config/examples/Tronxy/X3A/Configuration_adv.h
  51. 75
    16
      Marlin/src/config/examples/UltiMachine/Archim1/Configuration_adv.h
  52. 75
    16
      Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h
  53. 75
    16
      Marlin/src/config/examples/VORONDesign/Configuration_adv.h
  54. 75
    16
      Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h
  55. 75
    16
      Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h
  56. 75
    16
      Marlin/src/config/examples/WASP/PowerWASP/Configuration_adv.h
  57. 75
    16
      Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration_adv.h
  58. 75
    16
      Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration_adv.h
  59. 75
    16
      Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h
  60. 75
    16
      Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h
  61. 75
    16
      Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h
  62. 75
    16
      Marlin/src/config/examples/delta/Geeetech/Rostock 301/Configuration_adv.h
  63. 75
    16
      Marlin/src/config/examples/delta/MKS/SBASE/Configuration_adv.h
  64. 75
    16
      Marlin/src/config/examples/delta/Tevo Little Monster/Configuration_adv.h
  65. 75
    16
      Marlin/src/config/examples/delta/generic/Configuration_adv.h
  66. 75
    16
      Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h
  67. 75
    16
      Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h
  68. 75
    16
      Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h
  69. 75
    16
      Marlin/src/config/examples/makibox/Configuration_adv.h
  70. 75
    16
      Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h
  71. 75
    16
      Marlin/src/config/examples/wt150/Configuration_adv.h
  72. 4
    0
      Marlin/src/core/enum.h
  73. 7
    0
      Marlin/src/core/utility.cpp
  74. 2
    0
      Marlin/src/core/utility.h
  75. 1
    1
      Marlin/src/feature/pause.cpp
  76. 12
    0
      Marlin/src/gcode/calibrate/G28.cpp
  77. 1
    1
      Marlin/src/gcode/control/M17_M18_M84.cpp
  78. 115
    0
      Marlin/src/gcode/feature/L6470/M122.cpp
  79. 259
    0
      Marlin/src/gcode/feature/L6470/M906.cpp
  80. 544
    0
      Marlin/src/gcode/feature/L6470/M916-918.cpp
  81. 8
    0
      Marlin/src/gcode/gcode.cpp
  82. 10
    0
      Marlin/src/gcode/gcode.h
  83. 62
    0
      Marlin/src/gcode/host/M114.cpp
  84. 1
    1
      Marlin/src/inc/Conditionals_post.h
  85. 105
    0
      Marlin/src/libs/L6470/000_l6470_read_me.md
  86. 793
    0
      Marlin/src/libs/L6470/L6470_Marlin.cpp
  87. 93
    0
      Marlin/src/libs/L6470/L6470_Marlin.h
  88. 50
    11
      Marlin/src/module/stepper.cpp
  89. 152
    129
      Marlin/src/module/stepper_indirection.cpp
  90. 59
    177
      Marlin/src/module/stepper_indirection.h
  91. 15
    0
      Marlin/src/pins/pinsDebug_list.h
  92. 1
    1
      Marlin/src/pins/pins_EINSY_RAMBO.h
  93. 1
    1
      Marlin/src/pins/pins_EINSY_RETRO.h
  94. 1
    0
      buildroot/share/tests/LPC1768_tests
  95. 1
    1
      platformio.ini

+ 75
- 16
Marlin/Configuration_adv.h View File

@@ -1509,62 +1509,121 @@
1509 1509
 /**
1510 1510
  * L6470 Stepper Driver options
1511 1511
  *
1512
- * The Arduino-L6470 library is required for this stepper driver.
1512
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1513 1513
  * https://github.com/ameyer/Arduino-L6470
1514
+ *
1515
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1516
+ *     L6470_CHAIN_SCK_PIN
1517
+ *     L6470_CHAIN_MISO_PIN
1518
+ *     L6470_CHAIN_MOSI_PIN
1519
+ *     L6470_CHAIN_SS_PIN
1520
+ *     L6470_RESET_CHAIN_PIN  (optional)
1514 1521
  */
1515 1522
 #if HAS_DRIVER(L6470)
1516 1523
 
1517
-  #define X_MICROSTEPS        16 // number of microsteps
1518
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1519
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1524
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1525
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1526
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1527
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1528
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1520 1529
 
1521
-  #define X2_MICROSTEPS       16
1530
+  #define X2_MICROSTEPS      128
1522 1531
   #define X2_OVERCURRENT    2000
1523 1532
   #define X2_STALLCURRENT   1500
1533
+  #define X2_MAX_VOLTAGE     127
1534
+  #define X2_CHAIN_POS         0
1524 1535
 
1525
-  #define Y_MICROSTEPS        16
1536
+  #define Y_MICROSTEPS       128
1526 1537
   #define Y_OVERCURRENT     2000
1527 1538
   #define Y_STALLCURRENT    1500
1539
+  #define Y_MAX_VOLTAGE      127
1540
+  #define Y_CHAIN_POS          0
1528 1541
 
1529
-  #define Y2_MICROSTEPS       16
1542
+  #define Y2_MICROSTEPS      128
1530 1543
   #define Y2_OVERCURRENT    2000
1531 1544
   #define Y2_STALLCURRENT   1500
1545
+  #define Y2_MAX_VOLTAGE     127
1546
+  #define Y2_CHAIN_POS         0
1532 1547
 
1533
-  #define Z_MICROSTEPS        16
1548
+  #define Z_MICROSTEPS       128
1534 1549
   #define Z_OVERCURRENT     2000
1535 1550
   #define Z_STALLCURRENT    1500
1551
+  #define Z_MAX_VOLTAGE      127
1552
+  #define Z_CHAIN_POS          0
1536 1553
 
1537
-  #define Z2_MICROSTEPS       16
1554
+  #define Z2_MICROSTEPS      128
1538 1555
   #define Z2_OVERCURRENT    2000
1539 1556
   #define Z2_STALLCURRENT   1500
1557
+  #define Z2_MAX_VOLTAGE     127
1558
+  #define Z2_CHAIN_POS         0
1540 1559
 
1541
-  #define Z3_MICROSTEPS       16
1560
+  #define Z3_MICROSTEPS      128
1542 1561
   #define Z3_OVERCURRENT    2000
1543 1562
   #define Z3_STALLCURRENT   1500
1563
+  #define Z3_MAX_VOLTAGE     127
1564
+  #define Z3_CHAIN_POS         0
1544 1565
 
1545
-  #define E0_MICROSTEPS       16
1566
+  #define E0_MICROSTEPS      128
1546 1567
   #define E0_OVERCURRENT    2000
1547 1568
   #define E0_STALLCURRENT   1500
1569
+  #define E0_MAX_VOLTAGE     127
1570
+  #define E0_CHAIN_POS         0
1548 1571
 
1549
-  #define E1_MICROSTEPS       16
1572
+  #define E1_MICROSTEPS      128
1550 1573
   #define E1_OVERCURRENT    2000
1551 1574
   #define E1_STALLCURRENT   1500
1575
+  #define E1_MAX_VOLTAGE     127
1576
+  #define E1_CHAIN_POS         0
1552 1577
 
1553
-  #define E2_MICROSTEPS       16
1578
+  #define E2_MICROSTEPS      128
1554 1579
   #define E2_OVERCURRENT    2000
1555 1580
   #define E2_STALLCURRENT   1500
1581
+  #define E2_MAX_VOLTAGE     127
1582
+  #define E2_CHAIN_POS         0
1556 1583
 
1557
-  #define E3_MICROSTEPS       16
1584
+  #define E3_MICROSTEPS      128
1558 1585
   #define E3_OVERCURRENT    2000
1559 1586
   #define E3_STALLCURRENT   1500
1587
+  #define E3_MAX_VOLTAGE     127
1588
+  #define E3_CHAIN_POS         0
1560 1589
 
1561
-  #define E4_MICROSTEPS       16
1590
+  #define E4_MICROSTEPS      128
1562 1591
   #define E4_OVERCURRENT    2000
1563 1592
   #define E4_STALLCURRENT   1500
1593
+  #define E4_MAX_VOLTAGE     127
1594
+  #define E4_CHAIN_POS         0
1564 1595
 
1565
-  #define E5_MICROSTEPS       16
1596
+  #define E5_MICROSTEPS      128
1566 1597
   #define E5_OVERCURRENT    2000
1567 1598
   #define E5_STALLCURRENT   1500
1599
+  #define E5_MAX_VOLTAGE     127
1600
+  #define E5_CHAIN_POS         0
1601
+
1602
+
1603
+  /**
1604
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1605
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1606
+    * Other detected conditions can be used to stop the current print.
1607
+    * Relevant g-codes:
1608
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1609
+    *         I not present or I0 or I1 - X, Y, Z or E0
1610
+    *         I2 - X2, Y2, Z2 or E1
1611
+    *         I3 - Z3 or E3
1612
+    *         I4 - E4
1613
+    *         I5 - E5
1614
+    * M916 - Increase drive level until get thermal warning
1615
+    * M917 - Find minimum current thresholds
1616
+    * M918 - Increase speed until max or error
1617
+    * M122 S0/1 - Report driver parameters
1618
+  */
1619
+  //#define MONITOR_L6470_DRIVER_STATUS
1620
+
1621
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1622
+    #define KVAL_HOLD_STEP_DOWN     1
1623
+    //#define L6470_STOP_ON_ERROR
1624
+  #endif
1625
+
1626
+  #define L6470_CHITCHAT     // enable display of additional status info
1568 1627
 
1569 1628
 #endif // L6470
1570 1629
 

+ 144
- 0
Marlin/src/HAL/shared/HAL_spi_L6470.cpp View File

@@ -0,0 +1,144 @@
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
+
23
+/**
24
+ * Software L6470 SPI functions originally from Arduino Sd2Card Library
25
+ * Copyright (C) 2009 by William Greiman
26
+ */
27
+
28
+// --------------------------------------------------------------------------
29
+// Includes
30
+// --------------------------------------------------------------------------
31
+
32
+#include "../../inc/MarlinConfig.h"
33
+
34
+#if HAS_DRIVER(L6470)
35
+
36
+#include "Delay.h"
37
+
38
+// --------------------------------------------------------------------------
39
+// Public Variables
40
+// --------------------------------------------------------------------------
41
+
42
+// --------------------------------------------------------------------------
43
+// Public functions
44
+// --------------------------------------------------------------------------
45
+
46
+#include "../../core/serial.h"
47
+#include "../../libs/L6470/L6470_Marlin.h"
48
+
49
+// --------------------------------------------------------------------------
50
+// Software L6470 SPI
51
+// --------------------------------------------------------------------------
52
+
53
+// Make sure GCC optimizes this file.
54
+// Note that this line triggers a bug in GCC which is fixed by casting.
55
+// See the note below.
56
+#pragma GCC optimize (3)
57
+
58
+// run at ~4Mhz
59
+uint8_t L6470_SpiTransfer_Mode_0(uint8_t b) { // using Mode 0
60
+  for (uint8_t bits = 8; bits--;) {
61
+    WRITE(L6470_CHAIN_MOSI_PIN, b & 0x80);
62
+    b <<= 1;        // little setup time
63
+
64
+    WRITE(L6470_CHAIN_SCK_PIN, HIGH);
65
+    DELAY_NS(125);  // 10 cycles @ 84mhz
66
+
67
+    b |= (READ(L6470_CHAIN_MISO_PIN) != 0);
68
+
69
+    WRITE(L6470_CHAIN_SCK_PIN, LOW);
70
+    DELAY_NS(125);  // 10 cycles @ 84mhz
71
+  }
72
+  return b;
73
+}
74
+
75
+uint8_t L6470_SpiTransfer_Mode_3(uint8_t b) { // using Mode 3
76
+  for (uint8_t bits = 8; bits--;) {
77
+    WRITE(L6470_CHAIN_SCK_PIN, LOW);
78
+    WRITE(L6470_CHAIN_MOSI_PIN, b & 0x80);
79
+
80
+    DELAY_NS(125);  // 10 cycles @ 84mhz
81
+
82
+    WRITE(L6470_CHAIN_SCK_PIN, HIGH);
83
+
84
+    b <<= 1;        // little setup time
85
+    b |= (READ(L6470_CHAIN_MISO_PIN) != 0);
86
+  }
87
+
88
+  DELAY_NS(125);  // 10 cycles @ 84mhz
89
+  return b;
90
+}
91
+
92
+/**
93
+ * The following are weak-linked and defined as do-nothing
94
+ * functions by the L6470-Arduino library. They must be
95
+ * defined by the client (Marlin) to provide an SPI interface.
96
+ */
97
+
98
+uint8_t L6470_transfer(uint8_t data, int _SSPin, const uint8_t chain_position) {
99
+  uint8_t data_out = 0;
100
+
101
+  // first device in chain has data sent last
102
+  digitalWrite(_SSPin, LOW);
103
+
104
+  for (uint8_t i = L6470::chain[0]; (i >= 1) && !spi_abort; i--) {    // stop sending data if spi_abort is active
105
+    DISABLE_ISRS();  // disable interrupts during SPI transfer (can't allow partial command to chips)
106
+    uint8_t temp = L6470_SpiTransfer_Mode_3(uint8_t(i == chain_position ? data : dSPIN_NOP));
107
+    ENABLE_ISRS();  // enable interrupts
108
+    if (i == chain_position) data_out = temp;
109
+  }
110
+
111
+  digitalWrite(_SSPin, HIGH);
112
+  return data_out;
113
+}
114
+
115
+void L6470_transfer(uint8_t L6470_buf[], const uint8_t length) {
116
+  // first device in chain has data sent last
117
+
118
+  if (spi_active) {                    // interrupted SPI transfer so need to
119
+    WRITE(L6470_CHAIN_SS_PIN, HIGH);   // guarantee min high of 650nS
120
+    DELAY_US(1);
121
+  }
122
+
123
+  WRITE(L6470_CHAIN_SS_PIN, LOW);
124
+  for (uint8_t i = length; i >= 1; i--)
125
+    L6470_SpiTransfer_Mode_3(uint8_t(L6470_buf[i]));
126
+  WRITE(L6470_CHAIN_SS_PIN, HIGH);
127
+}
128
+
129
+void L6470_spi_init() {
130
+  OUT_WRITE(L6470_CHAIN_SS_PIN, HIGH);
131
+  OUT_WRITE(L6470_CHAIN_SCK_PIN, HIGH);
132
+  OUT_WRITE(L6470_CHAIN_MOSI_PIN, HIGH);
133
+  SET_INPUT(L6470_CHAIN_MISO_PIN);
134
+
135
+  #if PIN_EXISTS(L6470_BUSY)
136
+    SET_INPUT(L6470_BUSY_PIN);
137
+  #endif
138
+
139
+  OUT_WRITE(L6470_CHAIN_MOSI_PIN, HIGH);
140
+}
141
+
142
+#pragma GCC reset_options
143
+
144
+#endif // HAS_DRIVER(L6470)

+ 38
- 18
Marlin/src/Marlin.cpp View File

@@ -44,6 +44,8 @@
44 44
 
45 45
 #include "HAL/shared/Delay.h"
46 46
 
47
+#include "module/stepper_indirection.h"
48
+
47 49
 #ifdef ARDUINO
48 50
   #include <pins_arduino.h>
49 51
 #endif
@@ -158,6 +160,10 @@
158 160
   #include "lcd/extensible_ui/ui_api.h"
159 161
 #endif
160 162
 
163
+#if HAS_DRIVER(L6470)
164
+  #include "libs/L6470/L6470_Marlin.h"
165
+#endif
166
+
161 167
 bool Running = true;
162 168
 
163 169
 #if ENABLED(TEMPERATURE_UNITS_SUPPORT)
@@ -341,28 +347,34 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
341 347
   #endif
342 348
 
343 349
   if (stepper_inactive_time) {
350
+    static bool already_shutdown_steppers; // = false
344 351
     if (planner.has_blocks_queued())
345 352
       gcode.previous_move_ms = ms; // reset_stepper_timeout to keep steppers powered
346 353
     else if (MOVE_AWAY_TEST && !ignore_stepper_queue && ELAPSED(ms, gcode.previous_move_ms + stepper_inactive_time)) {
347
-      #if ENABLED(DISABLE_INACTIVE_X)
348
-        disable_X();
349
-      #endif
350
-      #if ENABLED(DISABLE_INACTIVE_Y)
351
-        disable_Y();
352
-      #endif
353
-      #if ENABLED(DISABLE_INACTIVE_Z)
354
-        disable_Z();
355
-      #endif
356
-      #if ENABLED(DISABLE_INACTIVE_E)
357
-        disable_e_steppers();
358
-      #endif
359
-      #if HAS_LCD_MENU && ENABLED(AUTO_BED_LEVELING_UBL)
360
-        if (ubl.lcd_map_control) {
361
-          ubl.lcd_map_control = false;
362
-          ui.defer_status_screen(false);
363
-        }
364
-      #endif
354
+      if (!already_shutdown_steppers) {
355
+        already_shutdown_steppers = true;  // L6470 SPI will consume 99% of free time without this
356
+        #if ENABLED(DISABLE_INACTIVE_X)
357
+          disable_X();
358
+        #endif
359
+        #if ENABLED(DISABLE_INACTIVE_Y)
360
+          disable_Y();
361
+        #endif
362
+        #if ENABLED(DISABLE_INACTIVE_Z)
363
+          disable_Z();
364
+        #endif
365
+        #if ENABLED(DISABLE_INACTIVE_E)
366
+          disable_e_steppers();
367
+        #endif
368
+        #if HAS_LCD_MENU && ENABLED(AUTO_BED_LEVELING_UBL)
369
+          if (ubl.lcd_map_control) {
370
+            ubl.lcd_map_control = false;
371
+            ui.defer_status_screen(false);
372
+          }
373
+        #endif
374
+      }
365 375
     }
376
+    else
377
+      already_shutdown_steppers = false;
366 378
   }
367 379
 
368 380
   #if PIN_EXISTS(CHDK) // Check if pin should be set to LOW (after M240 set it HIGH)
@@ -516,6 +528,10 @@ void manage_inactivity(const bool ignore_stepper_queue/*=false*/) {
516 528
     monitor_tmc_driver();
517 529
   #endif
518 530
 
531
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
532
+    L6470.monitor_driver();
533
+  #endif
534
+
519 535
   // Limit check_axes_activity frequency to 10Hz
520 536
   static millis_t next_check_axes_ms = 0;
521 537
   if (ELAPSED(ms, next_check_axes_ms)) {
@@ -680,6 +696,10 @@ void setup() {
680 696
     HAL_init();
681 697
   #endif
682 698
 
699
+  #if HAS_DRIVER(L6470)
700
+    L6470.init();         // setup SPI and then init chips
701
+  #endif
702
+
683 703
   #if ENABLED(MAX7219_DEBUG)
684 704
     max7219.init();
685 705
   #endif

+ 265
- 0
Marlin/src/Marlin.h View File

@@ -31,6 +31,11 @@
31 31
 #include <stdio.h>
32 32
 #include <stdlib.h>
33 33
 
34
+#if HAS_DRIVER(L6470)
35
+  #include "libs/L6470/L6470_Marlin.h"
36
+  extern uint8_t axis_known_position;
37
+#endif
38
+
34 39
 void stop();
35 40
 
36 41
 void idle(
@@ -41,6 +46,266 @@ void idle(
41 46
 
42 47
 void manage_inactivity(const bool ignore_stepper_queue=false);
43 48
 
49
+//
50
+// X, Y, Z Stepper enable / disable
51
+//
52
+#if AXIS_DRIVER_TYPE_X(L6470)
53
+  extern L6470 stepperX;
54
+  #define X_enable  NOOP
55
+  #define X_disable stepperX.free()
56
+#elif HAS_X_ENABLE
57
+  #define X_enable  X_ENABLE_WRITE( X_ENABLE_ON)
58
+  #define X_disable X_ENABLE_WRITE(!X_ENABLE_ON)
59
+#else
60
+  #define X_enable  NOOP
61
+  #define X_disable NOOP
62
+#endif
63
+
64
+#if AXIS_DRIVER_TYPE_X2(L6470)
65
+  extern L6470 stepperX2;
66
+  #define X2_enable  NOOP
67
+  #define X2_disable stepperX2.free()
68
+#elif HAS_X2_ENABLE
69
+  #define X2_enable  X2_ENABLE_WRITE( X_ENABLE_ON)
70
+  #define X2_disable X2_ENABLE_WRITE(!X_ENABLE_ON)
71
+#else
72
+  #define X2_enable  NOOP
73
+  #define X2_disable NOOP
74
+#endif
75
+
76
+#define  enable_X() do{ X_enable; X2_enable; }while(0)
77
+#define disable_X() do{ X_disable; X2_disable; CBI(axis_known_position, X_AXIS); }while(0)
78
+
79
+#if AXIS_DRIVER_TYPE_Y(L6470)
80
+  extern L6470 stepperY;
81
+  #define Y_enable  NOOP
82
+  #define Y_disable stepperY.free()
83
+#elif HAS_Y_ENABLE
84
+  #define Y_enable  Y_ENABLE_WRITE( Y_ENABLE_ON)
85
+  #define Y_disable Y_ENABLE_WRITE(!Y_ENABLE_ON)
86
+#else
87
+  #define Y_enable  NOOP
88
+  #define Y_disable NOOP
89
+#endif
90
+
91
+#if AXIS_DRIVER_TYPE_Y2(L6470)
92
+  extern L6470 stepperY2;
93
+  #define Y2_enable  NOOP
94
+  #define Y2_disable stepperY2.free()
95
+#elif HAS_Y2_ENABLE
96
+  #define Y2_enable  Y2_ENABLE_WRITE( Y_ENABLE_ON)
97
+  #define Y2_disable Y2_ENABLE_WRITE(!Y_ENABLE_ON)
98
+#else
99
+  #define Y2_enable  NOOP
100
+  #define Y2_disable NOOP
101
+#endif
102
+
103
+#define  enable_Y() do{ Y_enable; Y2_enable; }while(0)
104
+#define disable_Y() do{ Y_disable; Y2_disable; CBI(axis_known_position, Y_AXIS); }while(0)
105
+
106
+#if AXIS_DRIVER_TYPE_Z(L6470)
107
+  extern L6470 stepperZ;
108
+  #define Z_enable  NOOP
109
+  #define Z_disable stepperZ.free()
110
+#elif HAS_Z_ENABLE
111
+  #define Z_enable  Z_ENABLE_WRITE( Z_ENABLE_ON)
112
+  #define Z_disable Z_ENABLE_WRITE(!Z_ENABLE_ON)
113
+#else
114
+  #define Z_enable  NOOP
115
+  #define Z_disable NOOP
116
+#endif
117
+
118
+#if AXIS_DRIVER_TYPE_Z2(L6470)
119
+  extern L6470 stepperZ2;
120
+  #define Z2_enable  NOOP
121
+  #define Z2_disable stepperZ2.free()
122
+#elif HAS_Z2_ENABLE
123
+  #define Z2_enable  Z2_ENABLE_WRITE( Z_ENABLE_ON)
124
+  #define Z2_disable Z2_ENABLE_WRITE(!Z_ENABLE_ON)
125
+#else
126
+  #define Z2_enable  NOOP
127
+  #define Z2_disable NOOP
128
+#endif
129
+
130
+#if AXIS_DRIVER_TYPE_Z3(L6470)
131
+  extern L6470 stepperZ3;
132
+  #define Z3_enable  NOOP
133
+  #define Z3_disable stepperZ3.free()
134
+#elif HAS_Z3_ENABLE
135
+  #define Z3_enable  Z3_ENABLE_WRITE( Z_ENABLE_ON)
136
+  #define Z3_disable Z3_ENABLE_WRITE(!Z_ENABLE_ON)
137
+#else
138
+  #define Z3_enable  NOOP
139
+  #define Z3_disable NOOP
140
+#endif
141
+
142
+#define  enable_Z() do{ Z_enable; Z2_enable; Z3_enable; }while(0)
143
+#define disable_Z() do{ Z_disable; Z2_disable; Z3_disable; CBI(axis_known_position, Z_AXIS); }while(0)
144
+
145
+// end  X, Y, Z Stepper enable / disable
146
+
147
+//
148
+// Extruder Stepper enable / disable
149
+//
150
+
151
+// define the individual enables/disables
152
+#if AXIS_DRIVER_TYPE_E0(L6470)
153
+  extern L6470 stepperE0;
154
+  #define  E0_enable NOOP
155
+  #define E0_disable do{ stepperE0.free(); CBI(axis_known_position, E_AXIS); }while(0)
156
+#elif HAS_E0_ENABLE
157
+  #define  E0_enable E0_ENABLE_WRITE( E_ENABLE_ON)
158
+  #define E0_disable E0_ENABLE_WRITE(!E_ENABLE_ON)
159
+#else
160
+  #define  E0_enable NOOP
161
+  #define E0_disable NOOP
162
+#endif
163
+
164
+#if AXIS_DRIVER_TYPE_E1(L6470)
165
+  extern L6470 stepperE1;
166
+  #define  E1_enable NOOP
167
+  #define E1_disable do{ stepperE1.free(); CBI(axis_known_position, E_AXIS); }while(0)
168
+#elif E_STEPPERS > 1 && HAS_E1_ENABLE
169
+  #define  E1_enable E1_ENABLE_WRITE( E_ENABLE_ON)
170
+  #define E1_disable E1_ENABLE_WRITE(!E_ENABLE_ON)
171
+#else
172
+  #define  E1_enable NOOP
173
+  #define E1_disable NOOP
174
+#endif
175
+
176
+#if AXIS_DRIVER_TYPE_E2(L6470)
177
+  extern L6470 stepperE2;
178
+  #define  E2_enable NOOP
179
+  #define E2_disable do{ stepperE2.free(); CBI(axis_known_position, E_AXIS); }while(0)
180
+#elif E_STEPPERS > 2 && HAS_E2_ENABLE
181
+  #define  E2_enable E2_ENABLE_WRITE( E_ENABLE_ON)
182
+  #define E2_disable E2_ENABLE_WRITE(!E_ENABLE_ON)
183
+#else
184
+  #define  E2_enable NOOP
185
+  #define E2_disable NOOP
186
+#endif
187
+
188
+#if AXIS_DRIVER_TYPE_E3(L6470)
189
+  extern L6470 stepperE3;
190
+  #define  E3_enable NOOP
191
+  #define E3_disable do{ stepperE3.free(); CBI(axis_known_position, E_AXIS); }while(0)
192
+#elif E_STEPPERS > 3 && HAS_E3_ENABLE
193
+  #define  E3_enable E3_ENABLE_WRITE( E_ENABLE_ON)
194
+  #define E3_disable E3_ENABLE_WRITE(!E_ENABLE_ON)
195
+#else
196
+  #define  E3_enable NOOP
197
+  #define E3_disable NOOP
198
+#endif
199
+
200
+#if AXIS_DRIVER_TYPE_E4(L6470)
201
+  extern L6470 stepperE4;
202
+  #define  E4_enable NOOP
203
+  #define E4_disable do{ stepperE4.free(); CBI(axis_known_position, E_AXIS); }while(0)
204
+#elif E_STEPPERS > 4 && HAS_E4_ENABLE
205
+  #define  E4_enable E4_ENABLE_WRITE( E_ENABLE_ON)
206
+  #define E4_disable E4_ENABLE_WRITE(!E_ENABLE_ON)
207
+#else
208
+  #define  E4_enable NOOP
209
+  #define E4_disable NOOP
210
+#endif
211
+
212
+#if AXIS_DRIVER_TYPE_E5(L6470)
213
+  extern L6470 stepperE5;
214
+  #define  E5_enable NOOP
215
+  #define E5_disable do{ stepperE5.free(); CBI(axis_known_position, E_AXIS); }while(0)
216
+#elif E_STEPPERS > 5 && HAS_E5_ENABLE
217
+  #define  E5_enable E5_ENABLE_WRITE( E_ENABLE_ON)
218
+  #define E5_disable E5_ENABLE_WRITE(!E_ENABLE_ON)
219
+#else
220
+  #define  E5_enable NOOP
221
+  #define E5_disable NOOP
222
+#endif
223
+// end individual enables/disables
224
+
225
+#if ENABLED(MIXING_EXTRUDER)
226
+
227
+  /**
228
+   * Mixing steppers synchronize their enable (and direction) together
229
+   */
230
+  #if MIXING_STEPPERS > 5
231
+    #define  enable_E0() { E0_enable;  E1_enable;  E2_enable;  E3_enable;  E4_enable;  E5_enable; }
232
+    #define disable_E0() { E0_disable; E1_disable; E2_disable; E3_disable; E4_disable; E5_disable; }
233
+  #elif MIXING_STEPPERS > 4
234
+    #define  enable_E0() { E0_enable;  E1_enable;  E2_enable;  E3_enable;  E4_enable; }
235
+    #define disable_E0() { E0_disable; E1_disable; E2_disable; E3_disable; E4_disable; }
236
+  #elif MIXING_STEPPERS > 3
237
+    #define  enable_E0() { E0_enable;  E1_enable;  E2_enable;  E3_enable; }
238
+    #define disable_E0() { E0_disable; E1_disable; E2_disable; E3_disable; }
239
+  #elif MIXING_STEPPERS > 2
240
+    #define  enable_E0() { E0_enable;  E1_enable;  E2_enable; }
241
+    #define disable_E0() { E0_disable; E1_disable; E2_disable; }
242
+  #else
243
+    #define  enable_E0() { E0_enable;  E1_enable; }
244
+    #define disable_E0() { E0_disable; E1_disable; }
245
+  #endif
246
+  #define  enable_E1() NOOP
247
+  #define disable_E1() NOOP
248
+  #define  enable_E2() NOOP
249
+  #define disable_E2() NOOP
250
+  #define  enable_E3() NOOP
251
+  #define disable_E3() NOOP
252
+  #define  enable_E4() NOOP
253
+  #define disable_E4() NOOP
254
+  #define  enable_E5() NOOP
255
+  #define disable_E5() NOOP
256
+
257
+#else // !MIXING_EXTRUDER
258
+
259
+  #if HAS_E0_ENABLE
260
+    #define  enable_E0() E0_enable
261
+    #define disable_E0() E0_disable
262
+  #else
263
+    #define  enable_E0() NOOP
264
+    #define disable_E0() NOOP
265
+  #endif
266
+
267
+  #if E_STEPPERS > 1 && HAS_E1_ENABLE
268
+    #define  enable_E1() E1_enable
269
+    #define disable_E1() E1_disable
270
+  #else
271
+    #define  enable_E1() NOOP
272
+    #define disable_E1() NOOP
273
+  #endif
274
+
275
+  #if E_STEPPERS > 2 && HAS_E2_ENABLE
276
+    #define  enable_E2() E2_enable
277
+    #define disable_E2() E2_disable
278
+  #else
279
+    #define  enable_E2() NOOP
280
+    #define disable_E2() NOOP
281
+  #endif
282
+
283
+  #if E_STEPPERS > 3 && HAS_E3_ENABLE
284
+    #define  enable_E3() E3_enable
285
+    #define disable_E3() E3_disable
286
+  #else
287
+    #define  enable_E3() NOOP
288
+    #define disable_E3() NOOP
289
+  #endif
290
+
291
+  #if E_STEPPERS > 4 && HAS_E4_ENABLE
292
+    #define  enable_E4() E4_enable
293
+    #define disable_E4() E4_disable
294
+  #else
295
+    #define  enable_E4() NOOP
296
+    #define disable_E4() NOOP
297
+  #endif
298
+
299
+  #if E_STEPPERS > 5 && HAS_E5_ENABLE
300
+    #define  enable_E5() E5_enable
301
+    #define disable_E5() E5_disable
302
+  #else
303
+    #define  enable_E5() NOOP
304
+    #define disable_E5() NOOP
305
+  #endif
306
+
307
+#endif // !MIXING_EXTRUDER
308
+
44 309
 #if ENABLED(EXPERIMENTAL_I2CBUS)
45 310
   #include "feature/twibus.h"
46 311
   extern TWIBus i2c;

+ 75
- 16
Marlin/src/config/default/Configuration_adv.h View File

@@ -1509,62 +1509,121 @@
1509 1509
 /**
1510 1510
  * L6470 Stepper Driver options
1511 1511
  *
1512
- * The Arduino-L6470 library is required for this stepper driver.
1512
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1513 1513
  * https://github.com/ameyer/Arduino-L6470
1514
+ *
1515
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1516
+ *     L6470_CHAIN_SCK_PIN
1517
+ *     L6470_CHAIN_MISO_PIN
1518
+ *     L6470_CHAIN_MOSI_PIN
1519
+ *     L6470_CHAIN_SS_PIN
1520
+ *     L6470_RESET_CHAIN_PIN  (optional)
1514 1521
  */
1515 1522
 #if HAS_DRIVER(L6470)
1516 1523
 
1517
-  #define X_MICROSTEPS        16 // number of microsteps
1518
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1519
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1524
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1525
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1526
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1527
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1528
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1520 1529
 
1521
-  #define X2_MICROSTEPS       16
1530
+  #define X2_MICROSTEPS      128
1522 1531
   #define X2_OVERCURRENT    2000
1523 1532
   #define X2_STALLCURRENT   1500
1533
+  #define X2_MAX_VOLTAGE     127
1534
+  #define X2_CHAIN_POS         0
1524 1535
 
1525
-  #define Y_MICROSTEPS        16
1536
+  #define Y_MICROSTEPS       128
1526 1537
   #define Y_OVERCURRENT     2000
1527 1538
   #define Y_STALLCURRENT    1500
1539
+  #define Y_MAX_VOLTAGE      127
1540
+  #define Y_CHAIN_POS          0
1528 1541
 
1529
-  #define Y2_MICROSTEPS       16
1542
+  #define Y2_MICROSTEPS      128
1530 1543
   #define Y2_OVERCURRENT    2000
1531 1544
   #define Y2_STALLCURRENT   1500
1545
+  #define Y2_MAX_VOLTAGE     127
1546
+  #define Y2_CHAIN_POS         0
1532 1547
 
1533
-  #define Z_MICROSTEPS        16
1548
+  #define Z_MICROSTEPS       128
1534 1549
   #define Z_OVERCURRENT     2000
1535 1550
   #define Z_STALLCURRENT    1500
1551
+  #define Z_MAX_VOLTAGE      127
1552
+  #define Z_CHAIN_POS          0
1536 1553
 
1537
-  #define Z2_MICROSTEPS       16
1554
+  #define Z2_MICROSTEPS      128
1538 1555
   #define Z2_OVERCURRENT    2000
1539 1556
   #define Z2_STALLCURRENT   1500
1557
+  #define Z2_MAX_VOLTAGE     127
1558
+  #define Z2_CHAIN_POS         0
1540 1559
 
1541
-  #define Z3_MICROSTEPS       16
1560
+  #define Z3_MICROSTEPS      128
1542 1561
   #define Z3_OVERCURRENT    2000
1543 1562
   #define Z3_STALLCURRENT   1500
1563
+  #define Z3_MAX_VOLTAGE     127
1564
+  #define Z3_CHAIN_POS         0
1544 1565
 
1545
-  #define E0_MICROSTEPS       16
1566
+  #define E0_MICROSTEPS      128
1546 1567
   #define E0_OVERCURRENT    2000
1547 1568
   #define E0_STALLCURRENT   1500
1569
+  #define E0_MAX_VOLTAGE     127
1570
+  #define E0_CHAIN_POS         0
1548 1571
 
1549
-  #define E1_MICROSTEPS       16
1572
+  #define E1_MICROSTEPS      128
1550 1573
   #define E1_OVERCURRENT    2000
1551 1574
   #define E1_STALLCURRENT   1500
1575
+  #define E1_MAX_VOLTAGE     127
1576
+  #define E1_CHAIN_POS         0
1552 1577
 
1553
-  #define E2_MICROSTEPS       16
1578
+  #define E2_MICROSTEPS      128
1554 1579
   #define E2_OVERCURRENT    2000
1555 1580
   #define E2_STALLCURRENT   1500
1581
+  #define E2_MAX_VOLTAGE     127
1582
+  #define E2_CHAIN_POS         0
1556 1583
 
1557
-  #define E3_MICROSTEPS       16
1584
+  #define E3_MICROSTEPS      128
1558 1585
   #define E3_OVERCURRENT    2000
1559 1586
   #define E3_STALLCURRENT   1500
1587
+  #define E3_MAX_VOLTAGE     127
1588
+  #define E3_CHAIN_POS         0
1560 1589
 
1561
-  #define E4_MICROSTEPS       16
1590
+  #define E4_MICROSTEPS      128
1562 1591
   #define E4_OVERCURRENT    2000
1563 1592
   #define E4_STALLCURRENT   1500
1593
+  #define E4_MAX_VOLTAGE     127
1594
+  #define E4_CHAIN_POS         0
1564 1595
 
1565
-  #define E5_MICROSTEPS       16
1596
+  #define E5_MICROSTEPS      128
1566 1597
   #define E5_OVERCURRENT    2000
1567 1598
   #define E5_STALLCURRENT   1500
1599
+  #define E5_MAX_VOLTAGE     127
1600
+  #define E5_CHAIN_POS         0
1601
+
1602
+
1603
+  /**
1604
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1605
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1606
+    * Other detected conditions can be used to stop the current print.
1607
+    * Relevant g-codes:
1608
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1609
+    *         I not present or I0 or I1 - X, Y, Z or E0
1610
+    *         I2 - X2, Y2, Z2 or E1
1611
+    *         I3 - Z3 or E3
1612
+    *         I4 - E4
1613
+    *         I5 - E5
1614
+    * M916 - Increase drive level until get thermal warning
1615
+    * M917 - Find minimum current thresholds
1616
+    * M918 - Increase speed until max or error
1617
+    * M122 S0/1 - Report driver parameters
1618
+  */
1619
+  //#define MONITOR_L6470_DRIVER_STATUS
1620
+
1621
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1622
+    #define KVAL_HOLD_STEP_DOWN     1
1623
+    //#define L6470_STOP_ON_ERROR
1624
+  #endif
1625
+
1626
+  #define L6470_CHITCHAT     // enable display of additional status info
1568 1627
 
1569 1628
 #endif // L6470
1570 1629
 

+ 75
- 16
Marlin/src/config/examples/3DFabXYZ/Migbot/Configuration_adv.h View File

@@ -1509,62 +1509,121 @@
1509 1509
 /**
1510 1510
  * L6470 Stepper Driver options
1511 1511
  *
1512
- * The Arduino-L6470 library is required for this stepper driver.
1512
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1513 1513
  * https://github.com/ameyer/Arduino-L6470
1514
+ *
1515
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1516
+ *     L6470_CHAIN_SCK_PIN
1517
+ *     L6470_CHAIN_MISO_PIN
1518
+ *     L6470_CHAIN_MOSI_PIN
1519
+ *     L6470_CHAIN_SS_PIN
1520
+ *     L6470_RESET_CHAIN_PIN  (optional)
1514 1521
  */
1515 1522
 #if HAS_DRIVER(L6470)
1516 1523
 
1517
-  #define X_MICROSTEPS        16 // number of microsteps
1518
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1519
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1524
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1525
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1526
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1527
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1528
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1520 1529
 
1521
-  #define X2_MICROSTEPS       16
1530
+  #define X2_MICROSTEPS      128
1522 1531
   #define X2_OVERCURRENT    2000
1523 1532
   #define X2_STALLCURRENT   1500
1533
+  #define X2_MAX_VOLTAGE     127
1534
+  #define X2_CHAIN_POS         0
1524 1535
 
1525
-  #define Y_MICROSTEPS        16
1536
+  #define Y_MICROSTEPS       128
1526 1537
   #define Y_OVERCURRENT     2000
1527 1538
   #define Y_STALLCURRENT    1500
1539
+  #define Y_MAX_VOLTAGE      127
1540
+  #define Y_CHAIN_POS          0
1528 1541
 
1529
-  #define Y2_MICROSTEPS       16
1542
+  #define Y2_MICROSTEPS      128
1530 1543
   #define Y2_OVERCURRENT    2000
1531 1544
   #define Y2_STALLCURRENT   1500
1545
+  #define Y2_MAX_VOLTAGE     127
1546
+  #define Y2_CHAIN_POS         0
1532 1547
 
1533
-  #define Z_MICROSTEPS        16
1548
+  #define Z_MICROSTEPS       128
1534 1549
   #define Z_OVERCURRENT     2000
1535 1550
   #define Z_STALLCURRENT    1500
1551
+  #define Z_MAX_VOLTAGE      127
1552
+  #define Z_CHAIN_POS          0
1536 1553
 
1537
-  #define Z2_MICROSTEPS       16
1554
+  #define Z2_MICROSTEPS      128
1538 1555
   #define Z2_OVERCURRENT    2000
1539 1556
   #define Z2_STALLCURRENT   1500
1557
+  #define Z2_MAX_VOLTAGE     127
1558
+  #define Z2_CHAIN_POS         0
1540 1559
 
1541
-  #define Z3_MICROSTEPS       16
1560
+  #define Z3_MICROSTEPS      128
1542 1561
   #define Z3_OVERCURRENT    2000
1543 1562
   #define Z3_STALLCURRENT   1500
1563
+  #define Z3_MAX_VOLTAGE     127
1564
+  #define Z3_CHAIN_POS         0
1544 1565
 
1545
-  #define E0_MICROSTEPS       16
1566
+  #define E0_MICROSTEPS      128
1546 1567
   #define E0_OVERCURRENT    2000
1547 1568
   #define E0_STALLCURRENT   1500
1569
+  #define E0_MAX_VOLTAGE     127
1570
+  #define E0_CHAIN_POS         0
1548 1571
 
1549
-  #define E1_MICROSTEPS       16
1572
+  #define E1_MICROSTEPS      128
1550 1573
   #define E1_OVERCURRENT    2000
1551 1574
   #define E1_STALLCURRENT   1500
1575
+  #define E1_MAX_VOLTAGE     127
1576
+  #define E1_CHAIN_POS         0
1552 1577
 
1553
-  #define E2_MICROSTEPS       16
1578
+  #define E2_MICROSTEPS      128
1554 1579
   #define E2_OVERCURRENT    2000
1555 1580
   #define E2_STALLCURRENT   1500
1581
+  #define E2_MAX_VOLTAGE     127
1582
+  #define E2_CHAIN_POS         0
1556 1583
 
1557
-  #define E3_MICROSTEPS       16
1584
+  #define E3_MICROSTEPS      128
1558 1585
   #define E3_OVERCURRENT    2000
1559 1586
   #define E3_STALLCURRENT   1500
1587
+  #define E3_MAX_VOLTAGE     127
1588
+  #define E3_CHAIN_POS         0
1560 1589
 
1561
-  #define E4_MICROSTEPS       16
1590
+  #define E4_MICROSTEPS      128
1562 1591
   #define E4_OVERCURRENT    2000
1563 1592
   #define E4_STALLCURRENT   1500
1593
+  #define E4_MAX_VOLTAGE     127
1594
+  #define E4_CHAIN_POS         0
1564 1595
 
1565
-  #define E5_MICROSTEPS       16
1596
+  #define E5_MICROSTEPS      128
1566 1597
   #define E5_OVERCURRENT    2000
1567 1598
   #define E5_STALLCURRENT   1500
1599
+  #define E5_MAX_VOLTAGE     127
1600
+  #define E5_CHAIN_POS         0
1601
+
1602
+
1603
+  /**
1604
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1605
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1606
+    * Other detected conditions can be used to stop the current print.
1607
+    * Relevant g-codes:
1608
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1609
+    *         I not present or I0 or I1 - X, Y, Z or E0
1610
+    *         I2 - X2, Y2, Z2 or E1
1611
+    *         I3 - Z3 or E3
1612
+    *         I4 - E4
1613
+    *         I5 - E5
1614
+    * M916 - Increase drive level until get thermal warning
1615
+    * M917 - Find minimum current thresholds
1616
+    * M918 - Increase speed until max or error
1617
+    * M122 S0/1 - Report driver parameters
1618
+  */
1619
+  //#define MONITOR_L6470_DRIVER_STATUS
1620
+
1621
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1622
+    #define KVAL_HOLD_STEP_DOWN     1
1623
+    //#define L6470_STOP_ON_ERROR
1624
+  #endif
1625
+
1626
+  #define L6470_CHITCHAT     // enable display of additional status info
1568 1627
 
1569 1628
 #endif // L6470
1570 1629
 

+ 75
- 16
Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/Anet/A2/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/Anet/A2plus/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/Anet/A6/Configuration_adv.h View File

@@ -1507,62 +1507,121 @@
1507 1507
 /**
1508 1508
  * L6470 Stepper Driver options
1509 1509
  *
1510
- * The Arduino-L6470 library is required for this stepper driver.
1510
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1511 1511
  * https://github.com/ameyer/Arduino-L6470
1512
+ *
1513
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1514
+ *     L6470_CHAIN_SCK_PIN
1515
+ *     L6470_CHAIN_MISO_PIN
1516
+ *     L6470_CHAIN_MOSI_PIN
1517
+ *     L6470_CHAIN_SS_PIN
1518
+ *     L6470_RESET_CHAIN_PIN  (optional)
1512 1519
  */
1513 1520
 #if HAS_DRIVER(L6470)
1514 1521
 
1515
-  #define X_MICROSTEPS        16 // number of microsteps
1516
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1517
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1522
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1523
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1524
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1525
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1526
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1518 1527
 
1519
-  #define X2_MICROSTEPS       16
1528
+  #define X2_MICROSTEPS      128
1520 1529
   #define X2_OVERCURRENT    2000
1521 1530
   #define X2_STALLCURRENT   1500
1531
+  #define X2_MAX_VOLTAGE     127
1532
+  #define X2_CHAIN_POS         0
1522 1533
 
1523
-  #define Y_MICROSTEPS        16
1534
+  #define Y_MICROSTEPS       128
1524 1535
   #define Y_OVERCURRENT     2000
1525 1536
   #define Y_STALLCURRENT    1500
1537
+  #define Y_MAX_VOLTAGE      127
1538
+  #define Y_CHAIN_POS          0
1526 1539
 
1527
-  #define Y2_MICROSTEPS       16
1540
+  #define Y2_MICROSTEPS      128
1528 1541
   #define Y2_OVERCURRENT    2000
1529 1542
   #define Y2_STALLCURRENT   1500
1543
+  #define Y2_MAX_VOLTAGE     127
1544
+  #define Y2_CHAIN_POS         0
1530 1545
 
1531
-  #define Z_MICROSTEPS        16
1546
+  #define Z_MICROSTEPS       128
1532 1547
   #define Z_OVERCURRENT     2000
1533 1548
   #define Z_STALLCURRENT    1500
1549
+  #define Z_MAX_VOLTAGE      127
1550
+  #define Z_CHAIN_POS          0
1534 1551
 
1535
-  #define Z2_MICROSTEPS       16
1552
+  #define Z2_MICROSTEPS      128
1536 1553
   #define Z2_OVERCURRENT    2000
1537 1554
   #define Z2_STALLCURRENT   1500
1555
+  #define Z2_MAX_VOLTAGE     127
1556
+  #define Z2_CHAIN_POS         0
1538 1557
 
1539
-  #define Z3_MICROSTEPS       16
1558
+  #define Z3_MICROSTEPS      128
1540 1559
   #define Z3_OVERCURRENT    2000
1541 1560
   #define Z3_STALLCURRENT   1500
1561
+  #define Z3_MAX_VOLTAGE     127
1562
+  #define Z3_CHAIN_POS         0
1542 1563
 
1543
-  #define E0_MICROSTEPS       16
1564
+  #define E0_MICROSTEPS      128
1544 1565
   #define E0_OVERCURRENT    2000
1545 1566
   #define E0_STALLCURRENT   1500
1567
+  #define E0_MAX_VOLTAGE     127
1568
+  #define E0_CHAIN_POS         0
1546 1569
 
1547
-  #define E1_MICROSTEPS       16
1570
+  #define E1_MICROSTEPS      128
1548 1571
   #define E1_OVERCURRENT    2000
1549 1572
   #define E1_STALLCURRENT   1500
1573
+  #define E1_MAX_VOLTAGE     127
1574
+  #define E1_CHAIN_POS         0
1550 1575
 
1551
-  #define E2_MICROSTEPS       16
1576
+  #define E2_MICROSTEPS      128
1552 1577
   #define E2_OVERCURRENT    2000
1553 1578
   #define E2_STALLCURRENT   1500
1579
+  #define E2_MAX_VOLTAGE     127
1580
+  #define E2_CHAIN_POS         0
1554 1581
 
1555
-  #define E3_MICROSTEPS       16
1582
+  #define E3_MICROSTEPS      128
1556 1583
   #define E3_OVERCURRENT    2000
1557 1584
   #define E3_STALLCURRENT   1500
1585
+  #define E3_MAX_VOLTAGE     127
1586
+  #define E3_CHAIN_POS         0
1558 1587
 
1559
-  #define E4_MICROSTEPS       16
1588
+  #define E4_MICROSTEPS      128
1560 1589
   #define E4_OVERCURRENT    2000
1561 1590
   #define E4_STALLCURRENT   1500
1591
+  #define E4_MAX_VOLTAGE     127
1592
+  #define E4_CHAIN_POS         0
1562 1593
 
1563
-  #define E5_MICROSTEPS       16
1594
+  #define E5_MICROSTEPS      128
1564 1595
   #define E5_OVERCURRENT    2000
1565 1596
   #define E5_STALLCURRENT   1500
1597
+  #define E5_MAX_VOLTAGE     127
1598
+  #define E5_CHAIN_POS         0
1599
+
1600
+
1601
+  /**
1602
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1603
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1604
+    * Other detected conditions can be used to stop the current print.
1605
+    * Relevant g-codes:
1606
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1607
+    *         I not present or I0 or I1 - X, Y, Z or E0
1608
+    *         I2 - X2, Y2, Z2 or E1
1609
+    *         I3 - Z3 or E3
1610
+    *         I4 - E4
1611
+    *         I5 - E5
1612
+    * M916 - Increase drive level until get thermal warning
1613
+    * M917 - Find minimum current thresholds
1614
+    * M918 - Increase speed until max or error
1615
+    * M122 S0/1 - Report driver parameters
1616
+  */
1617
+  //#define MONITOR_L6470_DRIVER_STATUS
1618
+
1619
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1620
+    #define KVAL_HOLD_STEP_DOWN     1
1621
+    //#define L6470_STOP_ON_ERROR
1622
+  #endif
1623
+
1624
+  #define L6470_CHITCHAT     // enable display of additional status info
1566 1625
 
1567 1626
 #endif // L6470
1568 1627
 

+ 75
- 16
Marlin/src/config/examples/Anet/A8/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/ArmEd/Configuration_adv.h View File

@@ -1482,62 +1482,121 @@
1482 1482
 /**
1483 1483
  * L6470 Stepper Driver options
1484 1484
  *
1485
- * The Arduino-L6470 library is required for this stepper driver.
1485
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1486 1486
  * https://github.com/ameyer/Arduino-L6470
1487
+ *
1488
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1489
+ *     L6470_CHAIN_SCK_PIN
1490
+ *     L6470_CHAIN_MISO_PIN
1491
+ *     L6470_CHAIN_MOSI_PIN
1492
+ *     L6470_CHAIN_SS_PIN
1493
+ *     L6470_RESET_CHAIN_PIN  (optional)
1487 1494
  */
1488 1495
 #if HAS_DRIVER(L6470)
1489 1496
 
1490
-  #define X_MICROSTEPS        16 // number of microsteps
1491
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1492
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1497
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1498
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1499
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1500
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1501
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1493 1502
 
1494
-  #define X2_MICROSTEPS       16
1503
+  #define X2_MICROSTEPS      128
1495 1504
   #define X2_OVERCURRENT    2000
1496 1505
   #define X2_STALLCURRENT   1500
1506
+  #define X2_MAX_VOLTAGE     127
1507
+  #define X2_CHAIN_POS         0
1497 1508
 
1498
-  #define Y_MICROSTEPS        16
1509
+  #define Y_MICROSTEPS       128
1499 1510
   #define Y_OVERCURRENT     2000
1500 1511
   #define Y_STALLCURRENT    1500
1512
+  #define Y_MAX_VOLTAGE      127
1513
+  #define Y_CHAIN_POS          0
1501 1514
 
1502
-  #define Y2_MICROSTEPS       16
1515
+  #define Y2_MICROSTEPS      128
1503 1516
   #define Y2_OVERCURRENT    2000
1504 1517
   #define Y2_STALLCURRENT   1500
1518
+  #define Y2_MAX_VOLTAGE     127
1519
+  #define Y2_CHAIN_POS         0
1505 1520
 
1506
-  #define Z_MICROSTEPS        16
1521
+  #define Z_MICROSTEPS       128
1507 1522
   #define Z_OVERCURRENT     2000
1508 1523
   #define Z_STALLCURRENT    1500
1524
+  #define Z_MAX_VOLTAGE      127
1525
+  #define Z_CHAIN_POS          0
1509 1526
 
1510
-  #define Z2_MICROSTEPS       16
1527
+  #define Z2_MICROSTEPS      128
1511 1528
   #define Z2_OVERCURRENT    2000
1512 1529
   #define Z2_STALLCURRENT   1500
1530
+  #define Z2_MAX_VOLTAGE     127
1531
+  #define Z2_CHAIN_POS         0
1513 1532
 
1514
-  #define Z3_MICROSTEPS       16
1533
+  #define Z3_MICROSTEPS      128
1515 1534
   #define Z3_OVERCURRENT    2000
1516 1535
   #define Z3_STALLCURRENT   1500
1536
+  #define Z3_MAX_VOLTAGE     127
1537
+  #define Z3_CHAIN_POS         0
1517 1538
 
1518
-  #define E0_MICROSTEPS       16
1539
+  #define E0_MICROSTEPS      128
1519 1540
   #define E0_OVERCURRENT    2000
1520 1541
   #define E0_STALLCURRENT   1500
1542
+  #define E0_MAX_VOLTAGE     127
1543
+  #define E0_CHAIN_POS         0
1521 1544
 
1522
-  #define E1_MICROSTEPS       16
1545
+  #define E1_MICROSTEPS      128
1523 1546
   #define E1_OVERCURRENT    2000
1524 1547
   #define E1_STALLCURRENT   1500
1548
+  #define E1_MAX_VOLTAGE     127
1549
+  #define E1_CHAIN_POS         0
1525 1550
 
1526
-  #define E2_MICROSTEPS       16
1551
+  #define E2_MICROSTEPS      128
1527 1552
   #define E2_OVERCURRENT    2000
1528 1553
   #define E2_STALLCURRENT   1500
1554
+  #define E2_MAX_VOLTAGE     127
1555
+  #define E2_CHAIN_POS         0
1529 1556
 
1530
-  #define E3_MICROSTEPS       16
1557
+  #define E3_MICROSTEPS      128
1531 1558
   #define E3_OVERCURRENT    2000
1532 1559
   #define E3_STALLCURRENT   1500
1560
+  #define E3_MAX_VOLTAGE     127
1561
+  #define E3_CHAIN_POS         0
1533 1562
 
1534
-  #define E4_MICROSTEPS       16
1563
+  #define E4_MICROSTEPS      128
1535 1564
   #define E4_OVERCURRENT    2000
1536 1565
   #define E4_STALLCURRENT   1500
1566
+  #define E4_MAX_VOLTAGE     127
1567
+  #define E4_CHAIN_POS         0
1537 1568
 
1538
-  #define E5_MICROSTEPS       16
1569
+  #define E5_MICROSTEPS      128
1539 1570
   #define E5_OVERCURRENT    2000
1540 1571
   #define E5_STALLCURRENT   1500
1572
+  #define E5_MAX_VOLTAGE     127
1573
+  #define E5_CHAIN_POS         0
1574
+
1575
+
1576
+  /**
1577
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1578
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1579
+    * Other detected conditions can be used to stop the current print.
1580
+    * Relevant g-codes:
1581
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1582
+    *         I not present or I0 or I1 - X, Y, Z or E0
1583
+    *         I2 - X2, Y2, Z2 or E1
1584
+    *         I3 - Z3 or E3
1585
+    *         I4 - E4
1586
+    *         I5 - E5
1587
+    * M916 - Increase drive level until get thermal warning
1588
+    * M917 - Find minimum current thresholds
1589
+    * M918 - Increase speed until max or error
1590
+    * M122 S0/1 - Report driver parameters
1591
+  */
1592
+  //#define MONITOR_L6470_DRIVER_STATUS
1593
+
1594
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1595
+    #define KVAL_HOLD_STEP_DOWN     1
1596
+    //#define L6470_STOP_ON_ERROR
1597
+  #endif
1598
+
1599
+  #define L6470_CHITCHAT     // enable display of additional status info
1541 1600
 
1542 1601
 #endif // L6470
1543 1602
 

+ 75
- 16
Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration_adv.h View File

@@ -1507,62 +1507,121 @@
1507 1507
 /**
1508 1508
  * L6470 Stepper Driver options
1509 1509
  *
1510
- * The Arduino-L6470 library is required for this stepper driver.
1510
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1511 1511
  * https://github.com/ameyer/Arduino-L6470
1512
+ *
1513
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1514
+ *     L6470_CHAIN_SCK_PIN
1515
+ *     L6470_CHAIN_MISO_PIN
1516
+ *     L6470_CHAIN_MOSI_PIN
1517
+ *     L6470_CHAIN_SS_PIN
1518
+ *     L6470_RESET_CHAIN_PIN  (optional)
1512 1519
  */
1513 1520
 #if HAS_DRIVER(L6470)
1514 1521
 
1515
-  #define X_MICROSTEPS        16 // number of microsteps
1516
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1517
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1522
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1523
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1524
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1525
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1526
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1518 1527
 
1519
-  #define X2_MICROSTEPS       16
1528
+  #define X2_MICROSTEPS      128
1520 1529
   #define X2_OVERCURRENT    2000
1521 1530
   #define X2_STALLCURRENT   1500
1531
+  #define X2_MAX_VOLTAGE     127
1532
+  #define X2_CHAIN_POS         0
1522 1533
 
1523
-  #define Y_MICROSTEPS        16
1534
+  #define Y_MICROSTEPS       128
1524 1535
   #define Y_OVERCURRENT     2000
1525 1536
   #define Y_STALLCURRENT    1500
1537
+  #define Y_MAX_VOLTAGE      127
1538
+  #define Y_CHAIN_POS          0
1526 1539
 
1527
-  #define Y2_MICROSTEPS       16
1540
+  #define Y2_MICROSTEPS      128
1528 1541
   #define Y2_OVERCURRENT    2000
1529 1542
   #define Y2_STALLCURRENT   1500
1543
+  #define Y2_MAX_VOLTAGE     127
1544
+  #define Y2_CHAIN_POS         0
1530 1545
 
1531
-  #define Z_MICROSTEPS        16
1546
+  #define Z_MICROSTEPS       128
1532 1547
   #define Z_OVERCURRENT     2000
1533 1548
   #define Z_STALLCURRENT    1500
1549
+  #define Z_MAX_VOLTAGE      127
1550
+  #define Z_CHAIN_POS          0
1534 1551
 
1535
-  #define Z2_MICROSTEPS       16
1552
+  #define Z2_MICROSTEPS      128
1536 1553
   #define Z2_OVERCURRENT    2000
1537 1554
   #define Z2_STALLCURRENT   1500
1555
+  #define Z2_MAX_VOLTAGE     127
1556
+  #define Z2_CHAIN_POS         0
1538 1557
 
1539
-  #define Z3_MICROSTEPS       16
1558
+  #define Z3_MICROSTEPS      128
1540 1559
   #define Z3_OVERCURRENT    2000
1541 1560
   #define Z3_STALLCURRENT   1500
1561
+  #define Z3_MAX_VOLTAGE     127
1562
+  #define Z3_CHAIN_POS         0
1542 1563
 
1543
-  #define E0_MICROSTEPS       16
1564
+  #define E0_MICROSTEPS      128
1544 1565
   #define E0_OVERCURRENT    2000
1545 1566
   #define E0_STALLCURRENT   1500
1567
+  #define E0_MAX_VOLTAGE     127
1568
+  #define E0_CHAIN_POS         0
1546 1569
 
1547
-  #define E1_MICROSTEPS       16
1570
+  #define E1_MICROSTEPS      128
1548 1571
   #define E1_OVERCURRENT    2000
1549 1572
   #define E1_STALLCURRENT   1500
1573
+  #define E1_MAX_VOLTAGE     127
1574
+  #define E1_CHAIN_POS         0
1550 1575
 
1551
-  #define E2_MICROSTEPS       16
1576
+  #define E2_MICROSTEPS      128
1552 1577
   #define E2_OVERCURRENT    2000
1553 1578
   #define E2_STALLCURRENT   1500
1579
+  #define E2_MAX_VOLTAGE     127
1580
+  #define E2_CHAIN_POS         0
1554 1581
 
1555
-  #define E3_MICROSTEPS       16
1582
+  #define E3_MICROSTEPS      128
1556 1583
   #define E3_OVERCURRENT    2000
1557 1584
   #define E3_STALLCURRENT   1500
1585
+  #define E3_MAX_VOLTAGE     127
1586
+  #define E3_CHAIN_POS         0
1558 1587
 
1559
-  #define E4_MICROSTEPS       16
1588
+  #define E4_MICROSTEPS      128
1560 1589
   #define E4_OVERCURRENT    2000
1561 1590
   #define E4_STALLCURRENT   1500
1591
+  #define E4_MAX_VOLTAGE     127
1592
+  #define E4_CHAIN_POS         0
1562 1593
 
1563
-  #define E5_MICROSTEPS       16
1594
+  #define E5_MICROSTEPS      128
1564 1595
   #define E5_OVERCURRENT    2000
1565 1596
   #define E5_STALLCURRENT   1500
1597
+  #define E5_MAX_VOLTAGE     127
1598
+  #define E5_CHAIN_POS         0
1599
+
1600
+
1601
+  /**
1602
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1603
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1604
+    * Other detected conditions can be used to stop the current print.
1605
+    * Relevant g-codes:
1606
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1607
+    *         I not present or I0 or I1 - X, Y, Z or E0
1608
+    *         I2 - X2, Y2, Z2 or E1
1609
+    *         I3 - Z3 or E3
1610
+    *         I4 - E4
1611
+    *         I5 - E5
1612
+    * M916 - Increase drive level until get thermal warning
1613
+    * M917 - Find minimum current thresholds
1614
+    * M918 - Increase speed until max or error
1615
+    * M122 S0/1 - Report driver parameters
1616
+  */
1617
+  //#define MONITOR_L6470_DRIVER_STATUS
1618
+
1619
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1620
+    #define KVAL_HOLD_STEP_DOWN     1
1621
+    //#define L6470_STOP_ON_ERROR
1622
+  #endif
1623
+
1624
+  #define L6470_CHITCHAT     // enable display of additional status info
1566 1625
 
1567 1626
 #endif // L6470
1568 1627
 

+ 75
- 16
Marlin/src/config/examples/BIBO/TouchX/default/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h View File

@@ -1516,62 +1516,121 @@
1516 1516
 /**
1517 1517
  * L6470 Stepper Driver options
1518 1518
  *
1519
- * The Arduino-L6470 library is required for this stepper driver.
1519
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1520 1520
  * https://github.com/ameyer/Arduino-L6470
1521
+ *
1522
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1523
+ *     L6470_CHAIN_SCK_PIN
1524
+ *     L6470_CHAIN_MISO_PIN
1525
+ *     L6470_CHAIN_MOSI_PIN
1526
+ *     L6470_CHAIN_SS_PIN
1527
+ *     L6470_RESET_CHAIN_PIN  (optional)
1521 1528
  */
1522 1529
 #if HAS_DRIVER(L6470)
1523 1530
 
1524
-  #define X_MICROSTEPS        16 // number of microsteps
1525
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1526
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1531
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1532
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1533
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1534
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1535
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1527 1536
 
1528
-  #define X2_MICROSTEPS       16
1537
+  #define X2_MICROSTEPS      128
1529 1538
   #define X2_OVERCURRENT    2000
1530 1539
   #define X2_STALLCURRENT   1500
1540
+  #define X2_MAX_VOLTAGE     127
1541
+  #define X2_CHAIN_POS         0
1531 1542
 
1532
-  #define Y_MICROSTEPS        16
1543
+  #define Y_MICROSTEPS       128
1533 1544
   #define Y_OVERCURRENT     2000
1534 1545
   #define Y_STALLCURRENT    1500
1546
+  #define Y_MAX_VOLTAGE      127
1547
+  #define Y_CHAIN_POS          0
1535 1548
 
1536
-  #define Y2_MICROSTEPS       16
1549
+  #define Y2_MICROSTEPS      128
1537 1550
   #define Y2_OVERCURRENT    2000
1538 1551
   #define Y2_STALLCURRENT   1500
1552
+  #define Y2_MAX_VOLTAGE     127
1553
+  #define Y2_CHAIN_POS         0
1539 1554
 
1540
-  #define Z_MICROSTEPS        16
1555
+  #define Z_MICROSTEPS       128
1541 1556
   #define Z_OVERCURRENT     2000
1542 1557
   #define Z_STALLCURRENT    1500
1558
+  #define Z_MAX_VOLTAGE      127
1559
+  #define Z_CHAIN_POS          0
1543 1560
 
1544
-  #define Z2_MICROSTEPS       16
1561
+  #define Z2_MICROSTEPS      128
1545 1562
   #define Z2_OVERCURRENT    2000
1546 1563
   #define Z2_STALLCURRENT   1500
1564
+  #define Z2_MAX_VOLTAGE     127
1565
+  #define Z2_CHAIN_POS         0
1547 1566
 
1548
-  #define Z3_MICROSTEPS       16
1567
+  #define Z3_MICROSTEPS      128
1549 1568
   #define Z3_OVERCURRENT    2000
1550 1569
   #define Z3_STALLCURRENT   1500
1570
+  #define Z3_MAX_VOLTAGE     127
1571
+  #define Z3_CHAIN_POS         0
1551 1572
 
1552
-  #define E0_MICROSTEPS       16
1573
+  #define E0_MICROSTEPS      128
1553 1574
   #define E0_OVERCURRENT    2000
1554 1575
   #define E0_STALLCURRENT   1500
1576
+  #define E0_MAX_VOLTAGE     127
1577
+  #define E0_CHAIN_POS         0
1555 1578
 
1556
-  #define E1_MICROSTEPS       16
1579
+  #define E1_MICROSTEPS      128
1557 1580
   #define E1_OVERCURRENT    2000
1558 1581
   #define E1_STALLCURRENT   1500
1582
+  #define E1_MAX_VOLTAGE     127
1583
+  #define E1_CHAIN_POS         0
1559 1584
 
1560
-  #define E2_MICROSTEPS       16
1585
+  #define E2_MICROSTEPS      128
1561 1586
   #define E2_OVERCURRENT    2000
1562 1587
   #define E2_STALLCURRENT   1500
1588
+  #define E2_MAX_VOLTAGE     127
1589
+  #define E2_CHAIN_POS         0
1563 1590
 
1564
-  #define E3_MICROSTEPS       16
1591
+  #define E3_MICROSTEPS      128
1565 1592
   #define E3_OVERCURRENT    2000
1566 1593
   #define E3_STALLCURRENT   1500
1594
+  #define E3_MAX_VOLTAGE     127
1595
+  #define E3_CHAIN_POS         0
1567 1596
 
1568
-  #define E4_MICROSTEPS       16
1597
+  #define E4_MICROSTEPS      128
1569 1598
   #define E4_OVERCURRENT    2000
1570 1599
   #define E4_STALLCURRENT   1500
1600
+  #define E4_MAX_VOLTAGE     127
1601
+  #define E4_CHAIN_POS         0
1571 1602
 
1572
-  #define E5_MICROSTEPS       16
1603
+  #define E5_MICROSTEPS      128
1573 1604
   #define E5_OVERCURRENT    2000
1574 1605
   #define E5_STALLCURRENT   1500
1606
+  #define E5_MAX_VOLTAGE     127
1607
+  #define E5_CHAIN_POS         0
1608
+
1609
+
1610
+  /**
1611
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1612
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1613
+    * Other detected conditions can be used to stop the current print.
1614
+    * Relevant g-codes:
1615
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1616
+    *         I not present or I0 or I1 - X, Y, Z or E0
1617
+    *         I2 - X2, Y2, Z2 or E1
1618
+    *         I3 - Z3 or E3
1619
+    *         I4 - E4
1620
+    *         I5 - E5
1621
+    * M916 - Increase drive level until get thermal warning
1622
+    * M917 - Find minimum current thresholds
1623
+    * M918 - Increase speed until max or error
1624
+    * M122 S0/1 - Report driver parameters
1625
+  */
1626
+  //#define MONITOR_L6470_DRIVER_STATUS
1627
+
1628
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1629
+    #define KVAL_HOLD_STEP_DOWN     1
1630
+    //#define L6470_STOP_ON_ERROR
1631
+  #endif
1632
+
1633
+  #define L6470_CHITCHAT     // enable display of additional status info
1575 1634
 
1576 1635
 #endif // L6470
1577 1636
 

+ 75
- 16
Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/Cartesio/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/Creality/CR-10S/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/Creality/CR-10mini/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/Creality/CR-8/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/Creality/Ender-2/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/Creality/Ender-3/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/Creality/Ender-4/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/Einstart-S/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/Felix/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/FlashForge/CreatorPro/Configuration_adv.h View File

@@ -1507,62 +1507,121 @@
1507 1507
 /**
1508 1508
  * L6470 Stepper Driver options
1509 1509
  *
1510
- * The Arduino-L6470 library is required for this stepper driver.
1510
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1511 1511
  * https://github.com/ameyer/Arduino-L6470
1512
+ *
1513
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1514
+ *     L6470_CHAIN_SCK_PIN
1515
+ *     L6470_CHAIN_MISO_PIN
1516
+ *     L6470_CHAIN_MOSI_PIN
1517
+ *     L6470_CHAIN_SS_PIN
1518
+ *     L6470_RESET_CHAIN_PIN  (optional)
1512 1519
  */
1513 1520
 #if HAS_DRIVER(L6470)
1514 1521
 
1515
-  #define X_MICROSTEPS        16 // number of microsteps
1516
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1517
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1522
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1523
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1524
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1525
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1526
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1518 1527
 
1519
-  #define X2_MICROSTEPS       16
1528
+  #define X2_MICROSTEPS      128
1520 1529
   #define X2_OVERCURRENT    2000
1521 1530
   #define X2_STALLCURRENT   1500
1531
+  #define X2_MAX_VOLTAGE     127
1532
+  #define X2_CHAIN_POS         0
1522 1533
 
1523
-  #define Y_MICROSTEPS        16
1534
+  #define Y_MICROSTEPS       128
1524 1535
   #define Y_OVERCURRENT     2000
1525 1536
   #define Y_STALLCURRENT    1500
1537
+  #define Y_MAX_VOLTAGE      127
1538
+  #define Y_CHAIN_POS          0
1526 1539
 
1527
-  #define Y2_MICROSTEPS       16
1540
+  #define Y2_MICROSTEPS      128
1528 1541
   #define Y2_OVERCURRENT    2000
1529 1542
   #define Y2_STALLCURRENT   1500
1543
+  #define Y2_MAX_VOLTAGE     127
1544
+  #define Y2_CHAIN_POS         0
1530 1545
 
1531
-  #define Z_MICROSTEPS        16
1546
+  #define Z_MICROSTEPS       128
1532 1547
   #define Z_OVERCURRENT     2000
1533 1548
   #define Z_STALLCURRENT    1500
1549
+  #define Z_MAX_VOLTAGE      127
1550
+  #define Z_CHAIN_POS          0
1534 1551
 
1535
-  #define Z2_MICROSTEPS       16
1552
+  #define Z2_MICROSTEPS      128
1536 1553
   #define Z2_OVERCURRENT    2000
1537 1554
   #define Z2_STALLCURRENT   1500
1555
+  #define Z2_MAX_VOLTAGE     127
1556
+  #define Z2_CHAIN_POS         0
1538 1557
 
1539
-  #define Z3_MICROSTEPS       16
1558
+  #define Z3_MICROSTEPS      128
1540 1559
   #define Z3_OVERCURRENT    2000
1541 1560
   #define Z3_STALLCURRENT   1500
1561
+  #define Z3_MAX_VOLTAGE     127
1562
+  #define Z3_CHAIN_POS         0
1542 1563
 
1543
-  #define E0_MICROSTEPS       16
1564
+  #define E0_MICROSTEPS      128
1544 1565
   #define E0_OVERCURRENT    2000
1545 1566
   #define E0_STALLCURRENT   1500
1567
+  #define E0_MAX_VOLTAGE     127
1568
+  #define E0_CHAIN_POS         0
1546 1569
 
1547
-  #define E1_MICROSTEPS       16
1570
+  #define E1_MICROSTEPS      128
1548 1571
   #define E1_OVERCURRENT    2000
1549 1572
   #define E1_STALLCURRENT   1500
1573
+  #define E1_MAX_VOLTAGE     127
1574
+  #define E1_CHAIN_POS         0
1550 1575
 
1551
-  #define E2_MICROSTEPS       16
1576
+  #define E2_MICROSTEPS      128
1552 1577
   #define E2_OVERCURRENT    2000
1553 1578
   #define E2_STALLCURRENT   1500
1579
+  #define E2_MAX_VOLTAGE     127
1580
+  #define E2_CHAIN_POS         0
1554 1581
 
1555
-  #define E3_MICROSTEPS       16
1582
+  #define E3_MICROSTEPS      128
1556 1583
   #define E3_OVERCURRENT    2000
1557 1584
   #define E3_STALLCURRENT   1500
1585
+  #define E3_MAX_VOLTAGE     127
1586
+  #define E3_CHAIN_POS         0
1558 1587
 
1559
-  #define E4_MICROSTEPS       16
1588
+  #define E4_MICROSTEPS      128
1560 1589
   #define E4_OVERCURRENT    2000
1561 1590
   #define E4_STALLCURRENT   1500
1591
+  #define E4_MAX_VOLTAGE     127
1592
+  #define E4_CHAIN_POS         0
1562 1593
 
1563
-  #define E5_MICROSTEPS       16
1594
+  #define E5_MICROSTEPS      128
1564 1595
   #define E5_OVERCURRENT    2000
1565 1596
   #define E5_STALLCURRENT   1500
1597
+  #define E5_MAX_VOLTAGE     127
1598
+  #define E5_CHAIN_POS         0
1599
+
1600
+
1601
+  /**
1602
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1603
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1604
+    * Other detected conditions can be used to stop the current print.
1605
+    * Relevant g-codes:
1606
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1607
+    *         I not present or I0 or I1 - X, Y, Z or E0
1608
+    *         I2 - X2, Y2, Z2 or E1
1609
+    *         I3 - Z3 or E3
1610
+    *         I4 - E4
1611
+    *         I5 - E5
1612
+    * M916 - Increase drive level until get thermal warning
1613
+    * M917 - Find minimum current thresholds
1614
+    * M918 - Increase speed until max or error
1615
+    * M122 S0/1 - Report driver parameters
1616
+  */
1617
+  //#define MONITOR_L6470_DRIVER_STATUS
1618
+
1619
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1620
+    #define KVAL_HOLD_STEP_DOWN     1
1621
+    //#define L6470_STOP_ON_ERROR
1622
+  #endif
1623
+
1624
+  #define L6470_CHITCHAT     // enable display of additional status info
1566 1625
 
1567 1626
 #endif // L6470
1568 1627
 

+ 75
- 16
Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/Formbot/Raptor/Configuration_adv.h View File

@@ -1510,62 +1510,121 @@
1510 1510
 /**
1511 1511
  * L6470 Stepper Driver options
1512 1512
  *
1513
- * The Arduino-L6470 library is required for this stepper driver.
1513
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1514 1514
  * https://github.com/ameyer/Arduino-L6470
1515
+ *
1516
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1517
+ *     L6470_CHAIN_SCK_PIN
1518
+ *     L6470_CHAIN_MISO_PIN
1519
+ *     L6470_CHAIN_MOSI_PIN
1520
+ *     L6470_CHAIN_SS_PIN
1521
+ *     L6470_RESET_CHAIN_PIN  (optional)
1515 1522
  */
1516 1523
 #if HAS_DRIVER(L6470)
1517 1524
 
1518
-  #define X_MICROSTEPS        16 // number of microsteps
1519
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1520
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1525
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1526
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1527
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1528
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1529
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1521 1530
 
1522
-  #define X2_MICROSTEPS       16
1531
+  #define X2_MICROSTEPS      128
1523 1532
   #define X2_OVERCURRENT    2000
1524 1533
   #define X2_STALLCURRENT   1500
1534
+  #define X2_MAX_VOLTAGE     127
1535
+  #define X2_CHAIN_POS         0
1525 1536
 
1526
-  #define Y_MICROSTEPS        16
1537
+  #define Y_MICROSTEPS       128
1527 1538
   #define Y_OVERCURRENT     2000
1528 1539
   #define Y_STALLCURRENT    1500
1540
+  #define Y_MAX_VOLTAGE      127
1541
+  #define Y_CHAIN_POS          0
1529 1542
 
1530
-  #define Y2_MICROSTEPS       16
1543
+  #define Y2_MICROSTEPS      128
1531 1544
   #define Y2_OVERCURRENT    2000
1532 1545
   #define Y2_STALLCURRENT   1500
1546
+  #define Y2_MAX_VOLTAGE     127
1547
+  #define Y2_CHAIN_POS         0
1533 1548
 
1534
-  #define Z_MICROSTEPS        16
1549
+  #define Z_MICROSTEPS       128
1535 1550
   #define Z_OVERCURRENT     2000
1536 1551
   #define Z_STALLCURRENT    1500
1552
+  #define Z_MAX_VOLTAGE      127
1553
+  #define Z_CHAIN_POS          0
1537 1554
 
1538
-  #define Z2_MICROSTEPS       16
1555
+  #define Z2_MICROSTEPS      128
1539 1556
   #define Z2_OVERCURRENT    2000
1540 1557
   #define Z2_STALLCURRENT   1500
1558
+  #define Z2_MAX_VOLTAGE     127
1559
+  #define Z2_CHAIN_POS         0
1541 1560
 
1542
-  #define Z3_MICROSTEPS       16
1561
+  #define Z3_MICROSTEPS      128
1543 1562
   #define Z3_OVERCURRENT    2000
1544 1563
   #define Z3_STALLCURRENT   1500
1564
+  #define Z3_MAX_VOLTAGE     127
1565
+  #define Z3_CHAIN_POS         0
1545 1566
 
1546
-  #define E0_MICROSTEPS       16
1567
+  #define E0_MICROSTEPS      128
1547 1568
   #define E0_OVERCURRENT    2000
1548 1569
   #define E0_STALLCURRENT   1500
1570
+  #define E0_MAX_VOLTAGE     127
1571
+  #define E0_CHAIN_POS         0
1549 1572
 
1550
-  #define E1_MICROSTEPS       16
1573
+  #define E1_MICROSTEPS      128
1551 1574
   #define E1_OVERCURRENT    2000
1552 1575
   #define E1_STALLCURRENT   1500
1576
+  #define E1_MAX_VOLTAGE     127
1577
+  #define E1_CHAIN_POS         0
1553 1578
 
1554
-  #define E2_MICROSTEPS       16
1579
+  #define E2_MICROSTEPS      128
1555 1580
   #define E2_OVERCURRENT    2000
1556 1581
   #define E2_STALLCURRENT   1500
1582
+  #define E2_MAX_VOLTAGE     127
1583
+  #define E2_CHAIN_POS         0
1557 1584
 
1558
-  #define E3_MICROSTEPS       16
1585
+  #define E3_MICROSTEPS      128
1559 1586
   #define E3_OVERCURRENT    2000
1560 1587
   #define E3_STALLCURRENT   1500
1588
+  #define E3_MAX_VOLTAGE     127
1589
+  #define E3_CHAIN_POS         0
1561 1590
 
1562
-  #define E4_MICROSTEPS       16
1591
+  #define E4_MICROSTEPS      128
1563 1592
   #define E4_OVERCURRENT    2000
1564 1593
   #define E4_STALLCURRENT   1500
1594
+  #define E4_MAX_VOLTAGE     127
1595
+  #define E4_CHAIN_POS         0
1565 1596
 
1566
-  #define E5_MICROSTEPS       16
1597
+  #define E5_MICROSTEPS      128
1567 1598
   #define E5_OVERCURRENT    2000
1568 1599
   #define E5_STALLCURRENT   1500
1600
+  #define E5_MAX_VOLTAGE     127
1601
+  #define E5_CHAIN_POS         0
1602
+
1603
+
1604
+  /**
1605
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1606
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1607
+    * Other detected conditions can be used to stop the current print.
1608
+    * Relevant g-codes:
1609
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1610
+    *         I not present or I0 or I1 - X, Y, Z or E0
1611
+    *         I2 - X2, Y2, Z2 or E1
1612
+    *         I3 - Z3 or E3
1613
+    *         I4 - E4
1614
+    *         I5 - E5
1615
+    * M916 - Increase drive level until get thermal warning
1616
+    * M917 - Find minimum current thresholds
1617
+    * M918 - Increase speed until max or error
1618
+    * M122 S0/1 - Report driver parameters
1619
+  */
1620
+  //#define MONITOR_L6470_DRIVER_STATUS
1621
+
1622
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1623
+    #define KVAL_HOLD_STEP_DOWN     1
1624
+    //#define L6470_STOP_ON_ERROR
1625
+  #endif
1626
+
1627
+  #define L6470_CHITCHAT     // enable display of additional status info
1569 1628
 
1570 1629
 #endif // L6470
1571 1630
 

+ 75
- 16
Marlin/src/config/examples/Formbot/T_Rex_2+/Configuration_adv.h View File

@@ -1513,62 +1513,121 @@
1513 1513
 /**
1514 1514
  * L6470 Stepper Driver options
1515 1515
  *
1516
- * The Arduino-L6470 library is required for this stepper driver.
1516
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1517 1517
  * https://github.com/ameyer/Arduino-L6470
1518
+ *
1519
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1520
+ *     L6470_CHAIN_SCK_PIN
1521
+ *     L6470_CHAIN_MISO_PIN
1522
+ *     L6470_CHAIN_MOSI_PIN
1523
+ *     L6470_CHAIN_SS_PIN
1524
+ *     L6470_RESET_CHAIN_PIN  (optional)
1518 1525
  */
1519 1526
 #if HAS_DRIVER(L6470)
1520 1527
 
1521
-  #define X_MICROSTEPS        16 // number of microsteps
1522
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1523
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1528
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1529
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1530
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1531
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1532
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1524 1533
 
1525
-  #define X2_MICROSTEPS       16
1534
+  #define X2_MICROSTEPS      128
1526 1535
   #define X2_OVERCURRENT    2000
1527 1536
   #define X2_STALLCURRENT   1500
1537
+  #define X2_MAX_VOLTAGE     127
1538
+  #define X2_CHAIN_POS         0
1528 1539
 
1529
-  #define Y_MICROSTEPS        16
1540
+  #define Y_MICROSTEPS       128
1530 1541
   #define Y_OVERCURRENT     2000
1531 1542
   #define Y_STALLCURRENT    1500
1543
+  #define Y_MAX_VOLTAGE      127
1544
+  #define Y_CHAIN_POS          0
1532 1545
 
1533
-  #define Y2_MICROSTEPS       16
1546
+  #define Y2_MICROSTEPS      128
1534 1547
   #define Y2_OVERCURRENT    2000
1535 1548
   #define Y2_STALLCURRENT   1500
1549
+  #define Y2_MAX_VOLTAGE     127
1550
+  #define Y2_CHAIN_POS         0
1536 1551
 
1537
-  #define Z_MICROSTEPS        16
1552
+  #define Z_MICROSTEPS       128
1538 1553
   #define Z_OVERCURRENT     2000
1539 1554
   #define Z_STALLCURRENT    1500
1555
+  #define Z_MAX_VOLTAGE      127
1556
+  #define Z_CHAIN_POS          0
1540 1557
 
1541
-  #define Z2_MICROSTEPS       16
1558
+  #define Z2_MICROSTEPS      128
1542 1559
   #define Z2_OVERCURRENT    2000
1543 1560
   #define Z2_STALLCURRENT   1500
1561
+  #define Z2_MAX_VOLTAGE     127
1562
+  #define Z2_CHAIN_POS         0
1544 1563
 
1545
-  #define Z3_MICROSTEPS       16
1564
+  #define Z3_MICROSTEPS      128
1546 1565
   #define Z3_OVERCURRENT    2000
1547 1566
   #define Z3_STALLCURRENT   1500
1567
+  #define Z3_MAX_VOLTAGE     127
1568
+  #define Z3_CHAIN_POS         0
1548 1569
 
1549
-  #define E0_MICROSTEPS       16
1570
+  #define E0_MICROSTEPS      128
1550 1571
   #define E0_OVERCURRENT    2000
1551 1572
   #define E0_STALLCURRENT   1500
1573
+  #define E0_MAX_VOLTAGE     127
1574
+  #define E0_CHAIN_POS         0
1552 1575
 
1553
-  #define E1_MICROSTEPS       16
1576
+  #define E1_MICROSTEPS      128
1554 1577
   #define E1_OVERCURRENT    2000
1555 1578
   #define E1_STALLCURRENT   1500
1579
+  #define E1_MAX_VOLTAGE     127
1580
+  #define E1_CHAIN_POS         0
1556 1581
 
1557
-  #define E2_MICROSTEPS       16
1582
+  #define E2_MICROSTEPS      128
1558 1583
   #define E2_OVERCURRENT    2000
1559 1584
   #define E2_STALLCURRENT   1500
1585
+  #define E2_MAX_VOLTAGE     127
1586
+  #define E2_CHAIN_POS         0
1560 1587
 
1561
-  #define E3_MICROSTEPS       16
1588
+  #define E3_MICROSTEPS      128
1562 1589
   #define E3_OVERCURRENT    2000
1563 1590
   #define E3_STALLCURRENT   1500
1591
+  #define E3_MAX_VOLTAGE     127
1592
+  #define E3_CHAIN_POS         0
1564 1593
 
1565
-  #define E4_MICROSTEPS       16
1594
+  #define E4_MICROSTEPS      128
1566 1595
   #define E4_OVERCURRENT    2000
1567 1596
   #define E4_STALLCURRENT   1500
1597
+  #define E4_MAX_VOLTAGE     127
1598
+  #define E4_CHAIN_POS         0
1568 1599
 
1569
-  #define E5_MICROSTEPS       16
1600
+  #define E5_MICROSTEPS      128
1570 1601
   #define E5_OVERCURRENT    2000
1571 1602
   #define E5_STALLCURRENT   1500
1603
+  #define E5_MAX_VOLTAGE     127
1604
+  #define E5_CHAIN_POS         0
1605
+
1606
+
1607
+  /**
1608
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1609
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1610
+    * Other detected conditions can be used to stop the current print.
1611
+    * Relevant g-codes:
1612
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1613
+    *         I not present or I0 or I1 - X, Y, Z or E0
1614
+    *         I2 - X2, Y2, Z2 or E1
1615
+    *         I3 - Z3 or E3
1616
+    *         I4 - E4
1617
+    *         I5 - E5
1618
+    * M916 - Increase drive level until get thermal warning
1619
+    * M917 - Find minimum current thresholds
1620
+    * M918 - Increase speed until max or error
1621
+    * M122 S0/1 - Report driver parameters
1622
+  */
1623
+  //#define MONITOR_L6470_DRIVER_STATUS
1624
+
1625
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1626
+    #define KVAL_HOLD_STEP_DOWN     1
1627
+    //#define L6470_STOP_ON_ERROR
1628
+  #endif
1629
+
1630
+  #define L6470_CHITCHAT     // enable display of additional status info
1572 1631
 
1573 1632
 #endif // L6470
1574 1633
 

+ 75
- 16
Marlin/src/config/examples/Formbot/T_Rex_3/Configuration_adv.h View File

@@ -1513,62 +1513,121 @@
1513 1513
 /**
1514 1514
  * L6470 Stepper Driver options
1515 1515
  *
1516
- * The Arduino-L6470 library is required for this stepper driver.
1516
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1517 1517
  * https://github.com/ameyer/Arduino-L6470
1518
+ *
1519
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1520
+ *     L6470_CHAIN_SCK_PIN
1521
+ *     L6470_CHAIN_MISO_PIN
1522
+ *     L6470_CHAIN_MOSI_PIN
1523
+ *     L6470_CHAIN_SS_PIN
1524
+ *     L6470_RESET_CHAIN_PIN  (optional)
1518 1525
  */
1519 1526
 #if HAS_DRIVER(L6470)
1520 1527
 
1521
-  #define X_MICROSTEPS        16 // number of microsteps
1522
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1523
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1528
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1529
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1530
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1531
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1532
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1524 1533
 
1525
-  #define X2_MICROSTEPS       16
1534
+  #define X2_MICROSTEPS      128
1526 1535
   #define X2_OVERCURRENT    2000
1527 1536
   #define X2_STALLCURRENT   1500
1537
+  #define X2_MAX_VOLTAGE     127
1538
+  #define X2_CHAIN_POS         0
1528 1539
 
1529
-  #define Y_MICROSTEPS        16
1540
+  #define Y_MICROSTEPS       128
1530 1541
   #define Y_OVERCURRENT     2000
1531 1542
   #define Y_STALLCURRENT    1500
1543
+  #define Y_MAX_VOLTAGE      127
1544
+  #define Y_CHAIN_POS          0
1532 1545
 
1533
-  #define Y2_MICROSTEPS       16
1546
+  #define Y2_MICROSTEPS      128
1534 1547
   #define Y2_OVERCURRENT    2000
1535 1548
   #define Y2_STALLCURRENT   1500
1549
+  #define Y2_MAX_VOLTAGE     127
1550
+  #define Y2_CHAIN_POS         0
1536 1551
 
1537
-  #define Z_MICROSTEPS        16
1552
+  #define Z_MICROSTEPS       128
1538 1553
   #define Z_OVERCURRENT     2000
1539 1554
   #define Z_STALLCURRENT    1500
1555
+  #define Z_MAX_VOLTAGE      127
1556
+  #define Z_CHAIN_POS          0
1540 1557
 
1541
-  #define Z2_MICROSTEPS       16
1558
+  #define Z2_MICROSTEPS      128
1542 1559
   #define Z2_OVERCURRENT    2000
1543 1560
   #define Z2_STALLCURRENT   1500
1561
+  #define Z2_MAX_VOLTAGE     127
1562
+  #define Z2_CHAIN_POS         0
1544 1563
 
1545
-  #define Z3_MICROSTEPS       16
1564
+  #define Z3_MICROSTEPS      128
1546 1565
   #define Z3_OVERCURRENT    2000
1547 1566
   #define Z3_STALLCURRENT   1500
1567
+  #define Z3_MAX_VOLTAGE     127
1568
+  #define Z3_CHAIN_POS         0
1548 1569
 
1549
-  #define E0_MICROSTEPS       16
1570
+  #define E0_MICROSTEPS      128
1550 1571
   #define E0_OVERCURRENT    2000
1551 1572
   #define E0_STALLCURRENT   1500
1573
+  #define E0_MAX_VOLTAGE     127
1574
+  #define E0_CHAIN_POS         0
1552 1575
 
1553
-  #define E1_MICROSTEPS       16
1576
+  #define E1_MICROSTEPS      128
1554 1577
   #define E1_OVERCURRENT    2000
1555 1578
   #define E1_STALLCURRENT   1500
1579
+  #define E1_MAX_VOLTAGE     127
1580
+  #define E1_CHAIN_POS         0
1556 1581
 
1557
-  #define E2_MICROSTEPS       16
1582
+  #define E2_MICROSTEPS      128
1558 1583
   #define E2_OVERCURRENT    2000
1559 1584
   #define E2_STALLCURRENT   1500
1585
+  #define E2_MAX_VOLTAGE     127
1586
+  #define E2_CHAIN_POS         0
1560 1587
 
1561
-  #define E3_MICROSTEPS       16
1588
+  #define E3_MICROSTEPS      128
1562 1589
   #define E3_OVERCURRENT    2000
1563 1590
   #define E3_STALLCURRENT   1500
1591
+  #define E3_MAX_VOLTAGE     127
1592
+  #define E3_CHAIN_POS         0
1564 1593
 
1565
-  #define E4_MICROSTEPS       16
1594
+  #define E4_MICROSTEPS      128
1566 1595
   #define E4_OVERCURRENT    2000
1567 1596
   #define E4_STALLCURRENT   1500
1597
+  #define E4_MAX_VOLTAGE     127
1598
+  #define E4_CHAIN_POS         0
1568 1599
 
1569
-  #define E5_MICROSTEPS       16
1600
+  #define E5_MICROSTEPS      128
1570 1601
   #define E5_OVERCURRENT    2000
1571 1602
   #define E5_STALLCURRENT   1500
1603
+  #define E5_MAX_VOLTAGE     127
1604
+  #define E5_CHAIN_POS         0
1605
+
1606
+
1607
+  /**
1608
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1609
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1610
+    * Other detected conditions can be used to stop the current print.
1611
+    * Relevant g-codes:
1612
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1613
+    *         I not present or I0 or I1 - X, Y, Z or E0
1614
+    *         I2 - X2, Y2, Z2 or E1
1615
+    *         I3 - Z3 or E3
1616
+    *         I4 - E4
1617
+    *         I5 - E5
1618
+    * M916 - Increase drive level until get thermal warning
1619
+    * M917 - Find minimum current thresholds
1620
+    * M918 - Increase speed until max or error
1621
+    * M122 S0/1 - Report driver parameters
1622
+  */
1623
+  //#define MONITOR_L6470_DRIVER_STATUS
1624
+
1625
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1626
+    #define KVAL_HOLD_STEP_DOWN     1
1627
+    //#define L6470_STOP_ON_ERROR
1628
+  #endif
1629
+
1630
+  #define L6470_CHITCHAT     // enable display of additional status info
1572 1631
 
1573 1632
 #endif // L6470
1574 1633
 

+ 75
- 16
Marlin/src/config/examples/Geeetech/MeCreator2/Configuration_adv.h View File

@@ -1509,62 +1509,121 @@
1509 1509
 /**
1510 1510
  * L6470 Stepper Driver options
1511 1511
  *
1512
- * The Arduino-L6470 library is required for this stepper driver.
1512
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1513 1513
  * https://github.com/ameyer/Arduino-L6470
1514
+ *
1515
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1516
+ *     L6470_CHAIN_SCK_PIN
1517
+ *     L6470_CHAIN_MISO_PIN
1518
+ *     L6470_CHAIN_MOSI_PIN
1519
+ *     L6470_CHAIN_SS_PIN
1520
+ *     L6470_RESET_CHAIN_PIN  (optional)
1514 1521
  */
1515 1522
 #if HAS_DRIVER(L6470)
1516 1523
 
1517
-  #define X_MICROSTEPS        16 // number of microsteps
1518
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1519
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1524
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1525
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1526
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1527
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1528
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1520 1529
 
1521
-  #define X2_MICROSTEPS       16
1530
+  #define X2_MICROSTEPS      128
1522 1531
   #define X2_OVERCURRENT    2000
1523 1532
   #define X2_STALLCURRENT   1500
1533
+  #define X2_MAX_VOLTAGE     127
1534
+  #define X2_CHAIN_POS         0
1524 1535
 
1525
-  #define Y_MICROSTEPS        16
1536
+  #define Y_MICROSTEPS       128
1526 1537
   #define Y_OVERCURRENT     2000
1527 1538
   #define Y_STALLCURRENT    1500
1539
+  #define Y_MAX_VOLTAGE      127
1540
+  #define Y_CHAIN_POS          0
1528 1541
 
1529
-  #define Y2_MICROSTEPS       16
1542
+  #define Y2_MICROSTEPS      128
1530 1543
   #define Y2_OVERCURRENT    2000
1531 1544
   #define Y2_STALLCURRENT   1500
1545
+  #define Y2_MAX_VOLTAGE     127
1546
+  #define Y2_CHAIN_POS         0
1532 1547
 
1533
-  #define Z_MICROSTEPS        16
1548
+  #define Z_MICROSTEPS       128
1534 1549
   #define Z_OVERCURRENT     2000
1535 1550
   #define Z_STALLCURRENT    1500
1551
+  #define Z_MAX_VOLTAGE      127
1552
+  #define Z_CHAIN_POS          0
1536 1553
 
1537
-  #define Z2_MICROSTEPS       16
1554
+  #define Z2_MICROSTEPS      128
1538 1555
   #define Z2_OVERCURRENT    2000
1539 1556
   #define Z2_STALLCURRENT   1500
1557
+  #define Z2_MAX_VOLTAGE     127
1558
+  #define Z2_CHAIN_POS         0
1540 1559
 
1541
-  #define Z3_MICROSTEPS       16
1560
+  #define Z3_MICROSTEPS      128
1542 1561
   #define Z3_OVERCURRENT    2000
1543 1562
   #define Z3_STALLCURRENT   1500
1563
+  #define Z3_MAX_VOLTAGE     127
1564
+  #define Z3_CHAIN_POS         0
1544 1565
 
1545
-  #define E0_MICROSTEPS       16
1566
+  #define E0_MICROSTEPS      128
1546 1567
   #define E0_OVERCURRENT    2000
1547 1568
   #define E0_STALLCURRENT   1500
1569
+  #define E0_MAX_VOLTAGE     127
1570
+  #define E0_CHAIN_POS         0
1548 1571
 
1549
-  #define E1_MICROSTEPS       16
1572
+  #define E1_MICROSTEPS      128
1550 1573
   #define E1_OVERCURRENT    2000
1551 1574
   #define E1_STALLCURRENT   1500
1575
+  #define E1_MAX_VOLTAGE     127
1576
+  #define E1_CHAIN_POS         0
1552 1577
 
1553
-  #define E2_MICROSTEPS       16
1578
+  #define E2_MICROSTEPS      128
1554 1579
   #define E2_OVERCURRENT    2000
1555 1580
   #define E2_STALLCURRENT   1500
1581
+  #define E2_MAX_VOLTAGE     127
1582
+  #define E2_CHAIN_POS         0
1556 1583
 
1557
-  #define E3_MICROSTEPS       16
1584
+  #define E3_MICROSTEPS      128
1558 1585
   #define E3_OVERCURRENT    2000
1559 1586
   #define E3_STALLCURRENT   1500
1587
+  #define E3_MAX_VOLTAGE     127
1588
+  #define E3_CHAIN_POS         0
1560 1589
 
1561
-  #define E4_MICROSTEPS       16
1590
+  #define E4_MICROSTEPS      128
1562 1591
   #define E4_OVERCURRENT    2000
1563 1592
   #define E4_STALLCURRENT   1500
1593
+  #define E4_MAX_VOLTAGE     127
1594
+  #define E4_CHAIN_POS         0
1564 1595
 
1565
-  #define E5_MICROSTEPS       16
1596
+  #define E5_MICROSTEPS      128
1566 1597
   #define E5_OVERCURRENT    2000
1567 1598
   #define E5_STALLCURRENT   1500
1599
+  #define E5_MAX_VOLTAGE     127
1600
+  #define E5_CHAIN_POS         0
1601
+
1602
+
1603
+  /**
1604
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1605
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1606
+    * Other detected conditions can be used to stop the current print.
1607
+    * Relevant g-codes:
1608
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1609
+    *         I not present or I0 or I1 - X, Y, Z or E0
1610
+    *         I2 - X2, Y2, Z2 or E1
1611
+    *         I3 - Z3 or E3
1612
+    *         I4 - E4
1613
+    *         I5 - E5
1614
+    * M916 - Increase drive level until get thermal warning
1615
+    * M917 - Find minimum current thresholds
1616
+    * M918 - Increase speed until max or error
1617
+    * M122 S0/1 - Report driver parameters
1618
+  */
1619
+  //#define MONITOR_L6470_DRIVER_STATUS
1620
+
1621
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1622
+    #define KVAL_HOLD_STEP_DOWN     1
1623
+    //#define L6470_STOP_ON_ERROR
1624
+  #endif
1625
+
1626
+  #define L6470_CHITCHAT     // enable display of additional status info
1568 1627
 
1569 1628
 #endif // L6470
1570 1629
 

+ 75
- 16
Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/JGAurora/A5/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/MakerParts/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/Malyan/M150/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/Malyan/M200/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/Mks/Robin/Configuration_adv.h View File

@@ -1509,62 +1509,121 @@
1509 1509
 /**
1510 1510
  * L6470 Stepper Driver options
1511 1511
  *
1512
- * The Arduino-L6470 library is required for this stepper driver.
1512
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1513 1513
  * https://github.com/ameyer/Arduino-L6470
1514
+ *
1515
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1516
+ *     L6470_CHAIN_SCK_PIN
1517
+ *     L6470_CHAIN_MISO_PIN
1518
+ *     L6470_CHAIN_MOSI_PIN
1519
+ *     L6470_CHAIN_SS_PIN
1520
+ *     L6470_RESET_CHAIN_PIN  (optional)
1514 1521
  */
1515 1522
 #if HAS_DRIVER(L6470)
1516 1523
 
1517
-  #define X_MICROSTEPS        16 // number of microsteps
1518
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1519
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1524
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1525
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1526
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1527
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1528
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1520 1529
 
1521
-  #define X2_MICROSTEPS       16
1530
+  #define X2_MICROSTEPS      128
1522 1531
   #define X2_OVERCURRENT    2000
1523 1532
   #define X2_STALLCURRENT   1500
1533
+  #define X2_MAX_VOLTAGE     127
1534
+  #define X2_CHAIN_POS         0
1524 1535
 
1525
-  #define Y_MICROSTEPS        16
1536
+  #define Y_MICROSTEPS       128
1526 1537
   #define Y_OVERCURRENT     2000
1527 1538
   #define Y_STALLCURRENT    1500
1539
+  #define Y_MAX_VOLTAGE      127
1540
+  #define Y_CHAIN_POS          0
1528 1541
 
1529
-  #define Y2_MICROSTEPS       16
1542
+  #define Y2_MICROSTEPS      128
1530 1543
   #define Y2_OVERCURRENT    2000
1531 1544
   #define Y2_STALLCURRENT   1500
1545
+  #define Y2_MAX_VOLTAGE     127
1546
+  #define Y2_CHAIN_POS         0
1532 1547
 
1533
-  #define Z_MICROSTEPS        16
1548
+  #define Z_MICROSTEPS       128
1534 1549
   #define Z_OVERCURRENT     2000
1535 1550
   #define Z_STALLCURRENT    1500
1551
+  #define Z_MAX_VOLTAGE      127
1552
+  #define Z_CHAIN_POS          0
1536 1553
 
1537
-  #define Z2_MICROSTEPS       16
1554
+  #define Z2_MICROSTEPS      128
1538 1555
   #define Z2_OVERCURRENT    2000
1539 1556
   #define Z2_STALLCURRENT   1500
1557
+  #define Z2_MAX_VOLTAGE     127
1558
+  #define Z2_CHAIN_POS         0
1540 1559
 
1541
-  #define Z3_MICROSTEPS       16
1560
+  #define Z3_MICROSTEPS      128
1542 1561
   #define Z3_OVERCURRENT    2000
1543 1562
   #define Z3_STALLCURRENT   1500
1563
+  #define Z3_MAX_VOLTAGE     127
1564
+  #define Z3_CHAIN_POS         0
1544 1565
 
1545
-  #define E0_MICROSTEPS       16
1566
+  #define E0_MICROSTEPS      128
1546 1567
   #define E0_OVERCURRENT    2000
1547 1568
   #define E0_STALLCURRENT   1500
1569
+  #define E0_MAX_VOLTAGE     127
1570
+  #define E0_CHAIN_POS         0
1548 1571
 
1549
-  #define E1_MICROSTEPS       16
1572
+  #define E1_MICROSTEPS      128
1550 1573
   #define E1_OVERCURRENT    2000
1551 1574
   #define E1_STALLCURRENT   1500
1575
+  #define E1_MAX_VOLTAGE     127
1576
+  #define E1_CHAIN_POS         0
1552 1577
 
1553
-  #define E2_MICROSTEPS       16
1578
+  #define E2_MICROSTEPS      128
1554 1579
   #define E2_OVERCURRENT    2000
1555 1580
   #define E2_STALLCURRENT   1500
1581
+  #define E2_MAX_VOLTAGE     127
1582
+  #define E2_CHAIN_POS         0
1556 1583
 
1557
-  #define E3_MICROSTEPS       16
1584
+  #define E3_MICROSTEPS      128
1558 1585
   #define E3_OVERCURRENT    2000
1559 1586
   #define E3_STALLCURRENT   1500
1587
+  #define E3_MAX_VOLTAGE     127
1588
+  #define E3_CHAIN_POS         0
1560 1589
 
1561
-  #define E4_MICROSTEPS       16
1590
+  #define E4_MICROSTEPS      128
1562 1591
   #define E4_OVERCURRENT    2000
1563 1592
   #define E4_STALLCURRENT   1500
1593
+  #define E4_MAX_VOLTAGE     127
1594
+  #define E4_CHAIN_POS         0
1564 1595
 
1565
-  #define E5_MICROSTEPS       16
1596
+  #define E5_MICROSTEPS      128
1566 1597
   #define E5_OVERCURRENT    2000
1567 1598
   #define E5_STALLCURRENT   1500
1599
+  #define E5_MAX_VOLTAGE     127
1600
+  #define E5_CHAIN_POS         0
1601
+
1602
+
1603
+  /**
1604
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1605
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1606
+    * Other detected conditions can be used to stop the current print.
1607
+    * Relevant g-codes:
1608
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1609
+    *         I not present or I0 or I1 - X, Y, Z or E0
1610
+    *         I2 - X2, Y2, Z2 or E1
1611
+    *         I3 - Z3 or E3
1612
+    *         I4 - E4
1613
+    *         I5 - E5
1614
+    * M916 - Increase drive level until get thermal warning
1615
+    * M917 - Find minimum current thresholds
1616
+    * M918 - Increase speed until max or error
1617
+    * M122 S0/1 - Report driver parameters
1618
+  */
1619
+  //#define MONITOR_L6470_DRIVER_STATUS
1620
+
1621
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1622
+    #define KVAL_HOLD_STEP_DOWN     1
1623
+    //#define L6470_STOP_ON_ERROR
1624
+  #endif
1625
+
1626
+  #define L6470_CHITCHAT     // enable display of additional status info
1568 1627
 
1569 1628
 #endif // L6470
1570 1629
 

+ 75
- 16
Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h View File

@@ -1516,62 +1516,121 @@
1516 1516
 /**
1517 1517
  * L6470 Stepper Driver options
1518 1518
  *
1519
- * The Arduino-L6470 library is required for this stepper driver.
1519
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1520 1520
  * https://github.com/ameyer/Arduino-L6470
1521
+ *
1522
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1523
+ *     L6470_CHAIN_SCK_PIN
1524
+ *     L6470_CHAIN_MISO_PIN
1525
+ *     L6470_CHAIN_MOSI_PIN
1526
+ *     L6470_CHAIN_SS_PIN
1527
+ *     L6470_RESET_CHAIN_PIN  (optional)
1521 1528
  */
1522 1529
 #if HAS_DRIVER(L6470)
1523 1530
 
1524
-  #define X_MICROSTEPS        16 // number of microsteps
1525
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1526
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1531
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1532
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1533
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1534
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1535
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1527 1536
 
1528
-  #define X2_MICROSTEPS       16
1537
+  #define X2_MICROSTEPS      128
1529 1538
   #define X2_OVERCURRENT    2000
1530 1539
   #define X2_STALLCURRENT   1500
1540
+  #define X2_MAX_VOLTAGE     127
1541
+  #define X2_CHAIN_POS         0
1531 1542
 
1532
-  #define Y_MICROSTEPS        16
1543
+  #define Y_MICROSTEPS       128
1533 1544
   #define Y_OVERCURRENT     2000
1534 1545
   #define Y_STALLCURRENT    1500
1546
+  #define Y_MAX_VOLTAGE      127
1547
+  #define Y_CHAIN_POS          0
1535 1548
 
1536
-  #define Y2_MICROSTEPS       16
1549
+  #define Y2_MICROSTEPS      128
1537 1550
   #define Y2_OVERCURRENT    2000
1538 1551
   #define Y2_STALLCURRENT   1500
1552
+  #define Y2_MAX_VOLTAGE     127
1553
+  #define Y2_CHAIN_POS         0
1539 1554
 
1540
-  #define Z_MICROSTEPS        16
1555
+  #define Z_MICROSTEPS       128
1541 1556
   #define Z_OVERCURRENT     2000
1542 1557
   #define Z_STALLCURRENT    1500
1558
+  #define Z_MAX_VOLTAGE      127
1559
+  #define Z_CHAIN_POS          0
1543 1560
 
1544
-  #define Z2_MICROSTEPS       16
1561
+  #define Z2_MICROSTEPS      128
1545 1562
   #define Z2_OVERCURRENT    2000
1546 1563
   #define Z2_STALLCURRENT   1500
1564
+  #define Z2_MAX_VOLTAGE     127
1565
+  #define Z2_CHAIN_POS         0
1547 1566
 
1548
-  #define Z3_MICROSTEPS       16
1567
+  #define Z3_MICROSTEPS      128
1549 1568
   #define Z3_OVERCURRENT    2000
1550 1569
   #define Z3_STALLCURRENT   1500
1570
+  #define Z3_MAX_VOLTAGE     127
1571
+  #define Z3_CHAIN_POS         0
1551 1572
 
1552
-  #define E0_MICROSTEPS       16
1573
+  #define E0_MICROSTEPS      128
1553 1574
   #define E0_OVERCURRENT    2000
1554 1575
   #define E0_STALLCURRENT   1500
1576
+  #define E0_MAX_VOLTAGE     127
1577
+  #define E0_CHAIN_POS         0
1555 1578
 
1556
-  #define E1_MICROSTEPS       16
1579
+  #define E1_MICROSTEPS      128
1557 1580
   #define E1_OVERCURRENT    2000
1558 1581
   #define E1_STALLCURRENT   1500
1582
+  #define E1_MAX_VOLTAGE     127
1583
+  #define E1_CHAIN_POS         0
1559 1584
 
1560
-  #define E2_MICROSTEPS       16
1585
+  #define E2_MICROSTEPS      128
1561 1586
   #define E2_OVERCURRENT    2000
1562 1587
   #define E2_STALLCURRENT   1500
1588
+  #define E2_MAX_VOLTAGE     127
1589
+  #define E2_CHAIN_POS         0
1563 1590
 
1564
-  #define E3_MICROSTEPS       16
1591
+  #define E3_MICROSTEPS      128
1565 1592
   #define E3_OVERCURRENT    2000
1566 1593
   #define E3_STALLCURRENT   1500
1594
+  #define E3_MAX_VOLTAGE     127
1595
+  #define E3_CHAIN_POS         0
1567 1596
 
1568
-  #define E4_MICROSTEPS       16
1597
+  #define E4_MICROSTEPS      128
1569 1598
   #define E4_OVERCURRENT    2000
1570 1599
   #define E4_STALLCURRENT   1500
1600
+  #define E4_MAX_VOLTAGE     127
1601
+  #define E4_CHAIN_POS         0
1571 1602
 
1572
-  #define E5_MICROSTEPS       16
1603
+  #define E5_MICROSTEPS      128
1573 1604
   #define E5_OVERCURRENT    2000
1574 1605
   #define E5_STALLCURRENT   1500
1606
+  #define E5_MAX_VOLTAGE     127
1607
+  #define E5_CHAIN_POS         0
1608
+
1609
+
1610
+  /**
1611
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1612
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1613
+    * Other detected conditions can be used to stop the current print.
1614
+    * Relevant g-codes:
1615
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1616
+    *         I not present or I0 or I1 - X, Y, Z or E0
1617
+    *         I2 - X2, Y2, Z2 or E1
1618
+    *         I3 - Z3 or E3
1619
+    *         I4 - E4
1620
+    *         I5 - E5
1621
+    * M916 - Increase drive level until get thermal warning
1622
+    * M917 - Find minimum current thresholds
1623
+    * M918 - Increase speed until max or error
1624
+    * M122 S0/1 - Report driver parameters
1625
+  */
1626
+  //#define MONITOR_L6470_DRIVER_STATUS
1627
+
1628
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1629
+    #define KVAL_HOLD_STEP_DOWN     1
1630
+    //#define L6470_STOP_ON_ERROR
1631
+  #endif
1632
+
1633
+  #define L6470_CHITCHAT     // enable display of additional status info
1575 1634
 
1576 1635
 #endif // L6470
1577 1636
 

+ 75
- 16
Marlin/src/config/examples/RapideLite/RL200/Configuration_adv.h View File

@@ -1509,62 +1509,121 @@
1509 1509
 /**
1510 1510
  * L6470 Stepper Driver options
1511 1511
  *
1512
- * The Arduino-L6470 library is required for this stepper driver.
1512
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1513 1513
  * https://github.com/ameyer/Arduino-L6470
1514
+ *
1515
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1516
+ *     L6470_CHAIN_SCK_PIN
1517
+ *     L6470_CHAIN_MISO_PIN
1518
+ *     L6470_CHAIN_MOSI_PIN
1519
+ *     L6470_CHAIN_SS_PIN
1520
+ *     L6470_RESET_CHAIN_PIN  (optional)
1514 1521
  */
1515 1522
 #if HAS_DRIVER(L6470)
1516 1523
 
1517
-  #define X_MICROSTEPS        16 // number of microsteps
1518
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1519
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1524
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1525
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1526
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1527
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1528
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1520 1529
 
1521
-  #define X2_MICROSTEPS       16
1530
+  #define X2_MICROSTEPS      128
1522 1531
   #define X2_OVERCURRENT    2000
1523 1532
   #define X2_STALLCURRENT   1500
1533
+  #define X2_MAX_VOLTAGE     127
1534
+  #define X2_CHAIN_POS         0
1524 1535
 
1525
-  #define Y_MICROSTEPS        16
1536
+  #define Y_MICROSTEPS       128
1526 1537
   #define Y_OVERCURRENT     2000
1527 1538
   #define Y_STALLCURRENT    1500
1539
+  #define Y_MAX_VOLTAGE      127
1540
+  #define Y_CHAIN_POS          0
1528 1541
 
1529
-  #define Y2_MICROSTEPS       16
1542
+  #define Y2_MICROSTEPS      128
1530 1543
   #define Y2_OVERCURRENT    2000
1531 1544
   #define Y2_STALLCURRENT   1500
1545
+  #define Y2_MAX_VOLTAGE     127
1546
+  #define Y2_CHAIN_POS         0
1532 1547
 
1533
-  #define Z_MICROSTEPS        16
1548
+  #define Z_MICROSTEPS       128
1534 1549
   #define Z_OVERCURRENT     2000
1535 1550
   #define Z_STALLCURRENT    1500
1551
+  #define Z_MAX_VOLTAGE      127
1552
+  #define Z_CHAIN_POS          0
1536 1553
 
1537
-  #define Z2_MICROSTEPS       16
1554
+  #define Z2_MICROSTEPS      128
1538 1555
   #define Z2_OVERCURRENT    2000
1539 1556
   #define Z2_STALLCURRENT   1500
1557
+  #define Z2_MAX_VOLTAGE     127
1558
+  #define Z2_CHAIN_POS         0
1540 1559
 
1541
-  #define Z3_MICROSTEPS       16
1560
+  #define Z3_MICROSTEPS      128
1542 1561
   #define Z3_OVERCURRENT    2000
1543 1562
   #define Z3_STALLCURRENT   1500
1563
+  #define Z3_MAX_VOLTAGE     127
1564
+  #define Z3_CHAIN_POS         0
1544 1565
 
1545
-  #define E0_MICROSTEPS       16
1566
+  #define E0_MICROSTEPS      128
1546 1567
   #define E0_OVERCURRENT    2000
1547 1568
   #define E0_STALLCURRENT   1500
1569
+  #define E0_MAX_VOLTAGE     127
1570
+  #define E0_CHAIN_POS         0
1548 1571
 
1549
-  #define E1_MICROSTEPS       16
1572
+  #define E1_MICROSTEPS      128
1550 1573
   #define E1_OVERCURRENT    2000
1551 1574
   #define E1_STALLCURRENT   1500
1575
+  #define E1_MAX_VOLTAGE     127
1576
+  #define E1_CHAIN_POS         0
1552 1577
 
1553
-  #define E2_MICROSTEPS       16
1578
+  #define E2_MICROSTEPS      128
1554 1579
   #define E2_OVERCURRENT    2000
1555 1580
   #define E2_STALLCURRENT   1500
1581
+  #define E2_MAX_VOLTAGE     127
1582
+  #define E2_CHAIN_POS         0
1556 1583
 
1557
-  #define E3_MICROSTEPS       16
1584
+  #define E3_MICROSTEPS      128
1558 1585
   #define E3_OVERCURRENT    2000
1559 1586
   #define E3_STALLCURRENT   1500
1587
+  #define E3_MAX_VOLTAGE     127
1588
+  #define E3_CHAIN_POS         0
1560 1589
 
1561
-  #define E4_MICROSTEPS       16
1590
+  #define E4_MICROSTEPS      128
1562 1591
   #define E4_OVERCURRENT    2000
1563 1592
   #define E4_STALLCURRENT   1500
1593
+  #define E4_MAX_VOLTAGE     127
1594
+  #define E4_CHAIN_POS         0
1564 1595
 
1565
-  #define E5_MICROSTEPS       16
1596
+  #define E5_MICROSTEPS      128
1566 1597
   #define E5_OVERCURRENT    2000
1567 1598
   #define E5_STALLCURRENT   1500
1599
+  #define E5_MAX_VOLTAGE     127
1600
+  #define E5_CHAIN_POS         0
1601
+
1602
+
1603
+  /**
1604
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1605
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1606
+    * Other detected conditions can be used to stop the current print.
1607
+    * Relevant g-codes:
1608
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1609
+    *         I not present or I0 or I1 - X, Y, Z or E0
1610
+    *         I2 - X2, Y2, Z2 or E1
1611
+    *         I3 - Z3 or E3
1612
+    *         I4 - E4
1613
+    *         I5 - E5
1614
+    * M916 - Increase drive level until get thermal warning
1615
+    * M917 - Find minimum current thresholds
1616
+    * M918 - Increase speed until max or error
1617
+    * M122 S0/1 - Report driver parameters
1618
+  */
1619
+  //#define MONITOR_L6470_DRIVER_STATUS
1620
+
1621
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1622
+    #define KVAL_HOLD_STEP_DOWN     1
1623
+    //#define L6470_STOP_ON_ERROR
1624
+  #endif
1625
+
1626
+  #define L6470_CHITCHAT     // enable display of additional status info
1568 1627
 
1569 1628
 #endif // L6470
1570 1629
 

+ 75
- 16
Marlin/src/config/examples/RigidBot/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/SCARA/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/Sanguinololu/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/TheBorg/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/TinyBoy2/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/Tronxy/X3A/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/UltiMachine/Archim1/Configuration_adv.h View File

@@ -1509,62 +1509,121 @@
1509 1509
 /**
1510 1510
  * L6470 Stepper Driver options
1511 1511
  *
1512
- * The Arduino-L6470 library is required for this stepper driver.
1512
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1513 1513
  * https://github.com/ameyer/Arduino-L6470
1514
+ *
1515
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1516
+ *     L6470_CHAIN_SCK_PIN
1517
+ *     L6470_CHAIN_MISO_PIN
1518
+ *     L6470_CHAIN_MOSI_PIN
1519
+ *     L6470_CHAIN_SS_PIN
1520
+ *     L6470_RESET_CHAIN_PIN  (optional)
1514 1521
  */
1515 1522
 #if HAS_DRIVER(L6470)
1516 1523
 
1517
-  #define X_MICROSTEPS        16 // number of microsteps
1518
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1519
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1524
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1525
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1526
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1527
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1528
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1520 1529
 
1521
-  #define X2_MICROSTEPS       16
1530
+  #define X2_MICROSTEPS      128
1522 1531
   #define X2_OVERCURRENT    2000
1523 1532
   #define X2_STALLCURRENT   1500
1533
+  #define X2_MAX_VOLTAGE     127
1534
+  #define X2_CHAIN_POS         0
1524 1535
 
1525
-  #define Y_MICROSTEPS        16
1536
+  #define Y_MICROSTEPS       128
1526 1537
   #define Y_OVERCURRENT     2000
1527 1538
   #define Y_STALLCURRENT    1500
1539
+  #define Y_MAX_VOLTAGE      127
1540
+  #define Y_CHAIN_POS          0
1528 1541
 
1529
-  #define Y2_MICROSTEPS       16
1542
+  #define Y2_MICROSTEPS      128
1530 1543
   #define Y2_OVERCURRENT    2000
1531 1544
   #define Y2_STALLCURRENT   1500
1545
+  #define Y2_MAX_VOLTAGE     127
1546
+  #define Y2_CHAIN_POS         0
1532 1547
 
1533
-  #define Z_MICROSTEPS        16
1548
+  #define Z_MICROSTEPS       128
1534 1549
   #define Z_OVERCURRENT     2000
1535 1550
   #define Z_STALLCURRENT    1500
1551
+  #define Z_MAX_VOLTAGE      127
1552
+  #define Z_CHAIN_POS          0
1536 1553
 
1537
-  #define Z2_MICROSTEPS       16
1554
+  #define Z2_MICROSTEPS      128
1538 1555
   #define Z2_OVERCURRENT    2000
1539 1556
   #define Z2_STALLCURRENT   1500
1557
+  #define Z2_MAX_VOLTAGE     127
1558
+  #define Z2_CHAIN_POS         0
1540 1559
 
1541
-  #define Z3_MICROSTEPS       16
1560
+  #define Z3_MICROSTEPS      128
1542 1561
   #define Z3_OVERCURRENT    2000
1543 1562
   #define Z3_STALLCURRENT   1500
1563
+  #define Z3_MAX_VOLTAGE     127
1564
+  #define Z3_CHAIN_POS         0
1544 1565
 
1545
-  #define E0_MICROSTEPS       16
1566
+  #define E0_MICROSTEPS      128
1546 1567
   #define E0_OVERCURRENT    2000
1547 1568
   #define E0_STALLCURRENT   1500
1569
+  #define E0_MAX_VOLTAGE     127
1570
+  #define E0_CHAIN_POS         0
1548 1571
 
1549
-  #define E1_MICROSTEPS       16
1572
+  #define E1_MICROSTEPS      128
1550 1573
   #define E1_OVERCURRENT    2000
1551 1574
   #define E1_STALLCURRENT   1500
1575
+  #define E1_MAX_VOLTAGE     127
1576
+  #define E1_CHAIN_POS         0
1552 1577
 
1553
-  #define E2_MICROSTEPS       16
1578
+  #define E2_MICROSTEPS      128
1554 1579
   #define E2_OVERCURRENT    2000
1555 1580
   #define E2_STALLCURRENT   1500
1581
+  #define E2_MAX_VOLTAGE     127
1582
+  #define E2_CHAIN_POS         0
1556 1583
 
1557
-  #define E3_MICROSTEPS       16
1584
+  #define E3_MICROSTEPS      128
1558 1585
   #define E3_OVERCURRENT    2000
1559 1586
   #define E3_STALLCURRENT   1500
1587
+  #define E3_MAX_VOLTAGE     127
1588
+  #define E3_CHAIN_POS         0
1560 1589
 
1561
-  #define E4_MICROSTEPS       16
1590
+  #define E4_MICROSTEPS      128
1562 1591
   #define E4_OVERCURRENT    2000
1563 1592
   #define E4_STALLCURRENT   1500
1593
+  #define E4_MAX_VOLTAGE     127
1594
+  #define E4_CHAIN_POS         0
1564 1595
 
1565
-  #define E5_MICROSTEPS       16
1596
+  #define E5_MICROSTEPS      128
1566 1597
   #define E5_OVERCURRENT    2000
1567 1598
   #define E5_STALLCURRENT   1500
1599
+  #define E5_MAX_VOLTAGE     127
1600
+  #define E5_CHAIN_POS         0
1601
+
1602
+
1603
+  /**
1604
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1605
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1606
+    * Other detected conditions can be used to stop the current print.
1607
+    * Relevant g-codes:
1608
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1609
+    *         I not present or I0 or I1 - X, Y, Z or E0
1610
+    *         I2 - X2, Y2, Z2 or E1
1611
+    *         I3 - Z3 or E3
1612
+    *         I4 - E4
1613
+    *         I5 - E5
1614
+    * M916 - Increase drive level until get thermal warning
1615
+    * M917 - Find minimum current thresholds
1616
+    * M918 - Increase speed until max or error
1617
+    * M122 S0/1 - Report driver parameters
1618
+  */
1619
+  //#define MONITOR_L6470_DRIVER_STATUS
1620
+
1621
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1622
+    #define KVAL_HOLD_STEP_DOWN     1
1623
+    //#define L6470_STOP_ON_ERROR
1624
+  #endif
1625
+
1626
+  #define L6470_CHITCHAT     // enable display of additional status info
1568 1627
 
1569 1628
 #endif // L6470
1570 1629
 

+ 75
- 16
Marlin/src/config/examples/UltiMachine/Archim2/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/VORONDesign/Configuration_adv.h View File

@@ -1509,62 +1509,121 @@
1509 1509
 /**
1510 1510
  * L6470 Stepper Driver options
1511 1511
  *
1512
- * The Arduino-L6470 library is required for this stepper driver.
1512
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1513 1513
  * https://github.com/ameyer/Arduino-L6470
1514
+ *
1515
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1516
+ *     L6470_CHAIN_SCK_PIN
1517
+ *     L6470_CHAIN_MISO_PIN
1518
+ *     L6470_CHAIN_MOSI_PIN
1519
+ *     L6470_CHAIN_SS_PIN
1520
+ *     L6470_RESET_CHAIN_PIN  (optional)
1514 1521
  */
1515 1522
 #if HAS_DRIVER(L6470)
1516 1523
 
1517
-  #define X_MICROSTEPS        16 // number of microsteps
1518
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1519
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1524
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1525
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1526
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1527
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1528
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1520 1529
 
1521
-  #define X2_MICROSTEPS       16
1530
+  #define X2_MICROSTEPS      128
1522 1531
   #define X2_OVERCURRENT    2000
1523 1532
   #define X2_STALLCURRENT   1500
1533
+  #define X2_MAX_VOLTAGE     127
1534
+  #define X2_CHAIN_POS         0
1524 1535
 
1525
-  #define Y_MICROSTEPS        16
1536
+  #define Y_MICROSTEPS       128
1526 1537
   #define Y_OVERCURRENT     2000
1527 1538
   #define Y_STALLCURRENT    1500
1539
+  #define Y_MAX_VOLTAGE      127
1540
+  #define Y_CHAIN_POS          0
1528 1541
 
1529
-  #define Y2_MICROSTEPS       16
1542
+  #define Y2_MICROSTEPS      128
1530 1543
   #define Y2_OVERCURRENT    2000
1531 1544
   #define Y2_STALLCURRENT   1500
1545
+  #define Y2_MAX_VOLTAGE     127
1546
+  #define Y2_CHAIN_POS         0
1532 1547
 
1533
-  #define Z_MICROSTEPS        16
1548
+  #define Z_MICROSTEPS       128
1534 1549
   #define Z_OVERCURRENT     2000
1535 1550
   #define Z_STALLCURRENT    1500
1551
+  #define Z_MAX_VOLTAGE      127
1552
+  #define Z_CHAIN_POS          0
1536 1553
 
1537
-  #define Z2_MICROSTEPS       16
1554
+  #define Z2_MICROSTEPS      128
1538 1555
   #define Z2_OVERCURRENT    2000
1539 1556
   #define Z2_STALLCURRENT   1500
1557
+  #define Z2_MAX_VOLTAGE     127
1558
+  #define Z2_CHAIN_POS         0
1540 1559
 
1541
-  #define Z3_MICROSTEPS       16
1560
+  #define Z3_MICROSTEPS      128
1542 1561
   #define Z3_OVERCURRENT    2000
1543 1562
   #define Z3_STALLCURRENT   1500
1563
+  #define Z3_MAX_VOLTAGE     127
1564
+  #define Z3_CHAIN_POS         0
1544 1565
 
1545
-  #define E0_MICROSTEPS       16
1566
+  #define E0_MICROSTEPS      128
1546 1567
   #define E0_OVERCURRENT    2000
1547 1568
   #define E0_STALLCURRENT   1500
1569
+  #define E0_MAX_VOLTAGE     127
1570
+  #define E0_CHAIN_POS         0
1548 1571
 
1549
-  #define E1_MICROSTEPS       16
1572
+  #define E1_MICROSTEPS      128
1550 1573
   #define E1_OVERCURRENT    2000
1551 1574
   #define E1_STALLCURRENT   1500
1575
+  #define E1_MAX_VOLTAGE     127
1576
+  #define E1_CHAIN_POS         0
1552 1577
 
1553
-  #define E2_MICROSTEPS       16
1578
+  #define E2_MICROSTEPS      128
1554 1579
   #define E2_OVERCURRENT    2000
1555 1580
   #define E2_STALLCURRENT   1500
1581
+  #define E2_MAX_VOLTAGE     127
1582
+  #define E2_CHAIN_POS         0
1556 1583
 
1557
-  #define E3_MICROSTEPS       16
1584
+  #define E3_MICROSTEPS      128
1558 1585
   #define E3_OVERCURRENT    2000
1559 1586
   #define E3_STALLCURRENT   1500
1587
+  #define E3_MAX_VOLTAGE     127
1588
+  #define E3_CHAIN_POS         0
1560 1589
 
1561
-  #define E4_MICROSTEPS       16
1590
+  #define E4_MICROSTEPS      128
1562 1591
   #define E4_OVERCURRENT    2000
1563 1592
   #define E4_STALLCURRENT   1500
1593
+  #define E4_MAX_VOLTAGE     127
1594
+  #define E4_CHAIN_POS         0
1564 1595
 
1565
-  #define E5_MICROSTEPS       16
1596
+  #define E5_MICROSTEPS      128
1566 1597
   #define E5_OVERCURRENT    2000
1567 1598
   #define E5_STALLCURRENT   1500
1599
+  #define E5_MAX_VOLTAGE     127
1600
+  #define E5_CHAIN_POS         0
1601
+
1602
+
1603
+  /**
1604
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1605
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1606
+    * Other detected conditions can be used to stop the current print.
1607
+    * Relevant g-codes:
1608
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1609
+    *         I not present or I0 or I1 - X, Y, Z or E0
1610
+    *         I2 - X2, Y2, Z2 or E1
1611
+    *         I3 - Z3 or E3
1612
+    *         I4 - E4
1613
+    *         I5 - E5
1614
+    * M916 - Increase drive level until get thermal warning
1615
+    * M917 - Find minimum current thresholds
1616
+    * M918 - Increase speed until max or error
1617
+    * M122 S0/1 - Report driver parameters
1618
+  */
1619
+  //#define MONITOR_L6470_DRIVER_STATUS
1620
+
1621
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1622
+    #define KVAL_HOLD_STEP_DOWN     1
1623
+    //#define L6470_STOP_ON_ERROR
1624
+  #endif
1625
+
1626
+  #define L6470_CHITCHAT     // enable display of additional status info
1568 1627
 
1569 1628
 #endif // L6470
1570 1629
 

+ 75
- 16
Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h View File

@@ -1521,62 +1521,121 @@
1521 1521
 /**
1522 1522
  * L6470 Stepper Driver options
1523 1523
  *
1524
- * The Arduino-L6470 library is required for this stepper driver.
1524
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1525 1525
  * https://github.com/ameyer/Arduino-L6470
1526
+ *
1527
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1528
+ *     L6470_CHAIN_SCK_PIN
1529
+ *     L6470_CHAIN_MISO_PIN
1530
+ *     L6470_CHAIN_MOSI_PIN
1531
+ *     L6470_CHAIN_SS_PIN
1532
+ *     L6470_RESET_CHAIN_PIN  (optional)
1526 1533
  */
1527 1534
 #if HAS_DRIVER(L6470)
1528 1535
 
1529
-  #define X_MICROSTEPS        16 // number of microsteps
1530
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1531
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1536
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1537
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1538
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1539
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1540
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1532 1541
 
1533
-  #define X2_MICROSTEPS       16
1542
+  #define X2_MICROSTEPS      128
1534 1543
   #define X2_OVERCURRENT    2000
1535 1544
   #define X2_STALLCURRENT   1500
1545
+  #define X2_MAX_VOLTAGE     127
1546
+  #define X2_CHAIN_POS         0
1536 1547
 
1537
-  #define Y_MICROSTEPS        16
1548
+  #define Y_MICROSTEPS       128
1538 1549
   #define Y_OVERCURRENT     2000
1539 1550
   #define Y_STALLCURRENT    1500
1551
+  #define Y_MAX_VOLTAGE      127
1552
+  #define Y_CHAIN_POS          0
1540 1553
 
1541
-  #define Y2_MICROSTEPS       16
1554
+  #define Y2_MICROSTEPS      128
1542 1555
   #define Y2_OVERCURRENT    2000
1543 1556
   #define Y2_STALLCURRENT   1500
1557
+  #define Y2_MAX_VOLTAGE     127
1558
+  #define Y2_CHAIN_POS         0
1544 1559
 
1545
-  #define Z_MICROSTEPS        16
1560
+  #define Z_MICROSTEPS       128
1546 1561
   #define Z_OVERCURRENT     2000
1547 1562
   #define Z_STALLCURRENT    1500
1563
+  #define Z_MAX_VOLTAGE      127
1564
+  #define Z_CHAIN_POS          0
1548 1565
 
1549
-  #define Z2_MICROSTEPS       16
1566
+  #define Z2_MICROSTEPS      128
1550 1567
   #define Z2_OVERCURRENT    2000
1551 1568
   #define Z2_STALLCURRENT   1500
1569
+  #define Z2_MAX_VOLTAGE     127
1570
+  #define Z2_CHAIN_POS         0
1552 1571
 
1553
-  #define Z3_MICROSTEPS       16
1572
+  #define Z3_MICROSTEPS      128
1554 1573
   #define Z3_OVERCURRENT    2000
1555 1574
   #define Z3_STALLCURRENT   1500
1575
+  #define Z3_MAX_VOLTAGE     127
1576
+  #define Z3_CHAIN_POS         0
1556 1577
 
1557
-  #define E0_MICROSTEPS       16
1578
+  #define E0_MICROSTEPS      128
1558 1579
   #define E0_OVERCURRENT    2000
1559 1580
   #define E0_STALLCURRENT   1500
1581
+  #define E0_MAX_VOLTAGE     127
1582
+  #define E0_CHAIN_POS         0
1560 1583
 
1561
-  #define E1_MICROSTEPS       16
1584
+  #define E1_MICROSTEPS      128
1562 1585
   #define E1_OVERCURRENT    2000
1563 1586
   #define E1_STALLCURRENT   1500
1587
+  #define E1_MAX_VOLTAGE     127
1588
+  #define E1_CHAIN_POS         0
1564 1589
 
1565
-  #define E2_MICROSTEPS       16
1590
+  #define E2_MICROSTEPS      128
1566 1591
   #define E2_OVERCURRENT    2000
1567 1592
   #define E2_STALLCURRENT   1500
1593
+  #define E2_MAX_VOLTAGE     127
1594
+  #define E2_CHAIN_POS         0
1568 1595
 
1569
-  #define E3_MICROSTEPS       16
1596
+  #define E3_MICROSTEPS      128
1570 1597
   #define E3_OVERCURRENT    2000
1571 1598
   #define E3_STALLCURRENT   1500
1599
+  #define E3_MAX_VOLTAGE     127
1600
+  #define E3_CHAIN_POS         0
1572 1601
 
1573
-  #define E4_MICROSTEPS       16
1602
+  #define E4_MICROSTEPS      128
1574 1603
   #define E4_OVERCURRENT    2000
1575 1604
   #define E4_STALLCURRENT   1500
1605
+  #define E4_MAX_VOLTAGE     127
1606
+  #define E4_CHAIN_POS         0
1576 1607
 
1577
-  #define E5_MICROSTEPS       16
1608
+  #define E5_MICROSTEPS      128
1578 1609
   #define E5_OVERCURRENT    2000
1579 1610
   #define E5_STALLCURRENT   1500
1611
+  #define E5_MAX_VOLTAGE     127
1612
+  #define E5_CHAIN_POS         0
1613
+
1614
+
1615
+  /**
1616
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1617
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1618
+    * Other detected conditions can be used to stop the current print.
1619
+    * Relevant g-codes:
1620
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1621
+    *         I not present or I0 or I1 - X, Y, Z or E0
1622
+    *         I2 - X2, Y2, Z2 or E1
1623
+    *         I3 - Z3 or E3
1624
+    *         I4 - E4
1625
+    *         I5 - E5
1626
+    * M916 - Increase drive level until get thermal warning
1627
+    * M917 - Find minimum current thresholds
1628
+    * M918 - Increase speed until max or error
1629
+    * M122 S0/1 - Report driver parameters
1630
+  */
1631
+  //#define MONITOR_L6470_DRIVER_STATUS
1632
+
1633
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1634
+    #define KVAL_HOLD_STEP_DOWN     1
1635
+    //#define L6470_STOP_ON_ERROR
1636
+  #endif
1637
+
1638
+  #define L6470_CHITCHAT     // enable display of additional status info
1580 1639
 
1581 1640
 #endif // L6470
1582 1641
 

+ 75
- 16
Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/WASP/PowerWASP/Configuration_adv.h View File

@@ -1509,62 +1509,121 @@
1509 1509
 /**
1510 1510
  * L6470 Stepper Driver options
1511 1511
  *
1512
- * The Arduino-L6470 library is required for this stepper driver.
1512
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1513 1513
  * https://github.com/ameyer/Arduino-L6470
1514
+ *
1515
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1516
+ *     L6470_CHAIN_SCK_PIN
1517
+ *     L6470_CHAIN_MISO_PIN
1518
+ *     L6470_CHAIN_MOSI_PIN
1519
+ *     L6470_CHAIN_SS_PIN
1520
+ *     L6470_RESET_CHAIN_PIN  (optional)
1514 1521
  */
1515 1522
 #if HAS_DRIVER(L6470)
1516 1523
 
1517
-  #define X_MICROSTEPS        16 // number of microsteps
1518
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1519
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1524
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1525
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1526
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1527
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1528
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1520 1529
 
1521
-  #define X2_MICROSTEPS       16
1530
+  #define X2_MICROSTEPS      128
1522 1531
   #define X2_OVERCURRENT    2000
1523 1532
   #define X2_STALLCURRENT   1500
1533
+  #define X2_MAX_VOLTAGE     127
1534
+  #define X2_CHAIN_POS         0
1524 1535
 
1525
-  #define Y_MICROSTEPS        16
1536
+  #define Y_MICROSTEPS       128
1526 1537
   #define Y_OVERCURRENT     2000
1527 1538
   #define Y_STALLCURRENT    1500
1539
+  #define Y_MAX_VOLTAGE      127
1540
+  #define Y_CHAIN_POS          0
1528 1541
 
1529
-  #define Y2_MICROSTEPS       16
1542
+  #define Y2_MICROSTEPS      128
1530 1543
   #define Y2_OVERCURRENT    2000
1531 1544
   #define Y2_STALLCURRENT   1500
1545
+  #define Y2_MAX_VOLTAGE     127
1546
+  #define Y2_CHAIN_POS         0
1532 1547
 
1533
-  #define Z_MICROSTEPS        16
1548
+  #define Z_MICROSTEPS       128
1534 1549
   #define Z_OVERCURRENT     2000
1535 1550
   #define Z_STALLCURRENT    1500
1551
+  #define Z_MAX_VOLTAGE      127
1552
+  #define Z_CHAIN_POS          0
1536 1553
 
1537
-  #define Z2_MICROSTEPS       16
1554
+  #define Z2_MICROSTEPS      128
1538 1555
   #define Z2_OVERCURRENT    2000
1539 1556
   #define Z2_STALLCURRENT   1500
1557
+  #define Z2_MAX_VOLTAGE     127
1558
+  #define Z2_CHAIN_POS         0
1540 1559
 
1541
-  #define Z3_MICROSTEPS       16
1560
+  #define Z3_MICROSTEPS      128
1542 1561
   #define Z3_OVERCURRENT    2000
1543 1562
   #define Z3_STALLCURRENT   1500
1563
+  #define Z3_MAX_VOLTAGE     127
1564
+  #define Z3_CHAIN_POS         0
1544 1565
 
1545
-  #define E0_MICROSTEPS       16
1566
+  #define E0_MICROSTEPS      128
1546 1567
   #define E0_OVERCURRENT    2000
1547 1568
   #define E0_STALLCURRENT   1500
1569
+  #define E0_MAX_VOLTAGE     127
1570
+  #define E0_CHAIN_POS         0
1548 1571
 
1549
-  #define E1_MICROSTEPS       16
1572
+  #define E1_MICROSTEPS      128
1550 1573
   #define E1_OVERCURRENT    2000
1551 1574
   #define E1_STALLCURRENT   1500
1575
+  #define E1_MAX_VOLTAGE     127
1576
+  #define E1_CHAIN_POS         0
1552 1577
 
1553
-  #define E2_MICROSTEPS       16
1578
+  #define E2_MICROSTEPS      128
1554 1579
   #define E2_OVERCURRENT    2000
1555 1580
   #define E2_STALLCURRENT   1500
1581
+  #define E2_MAX_VOLTAGE     127
1582
+  #define E2_CHAIN_POS         0
1556 1583
 
1557
-  #define E3_MICROSTEPS       16
1584
+  #define E3_MICROSTEPS      128
1558 1585
   #define E3_OVERCURRENT    2000
1559 1586
   #define E3_STALLCURRENT   1500
1587
+  #define E3_MAX_VOLTAGE     127
1588
+  #define E3_CHAIN_POS         0
1560 1589
 
1561
-  #define E4_MICROSTEPS       16
1590
+  #define E4_MICROSTEPS      128
1562 1591
   #define E4_OVERCURRENT    2000
1563 1592
   #define E4_STALLCURRENT   1500
1593
+  #define E4_MAX_VOLTAGE     127
1594
+  #define E4_CHAIN_POS         0
1564 1595
 
1565
-  #define E5_MICROSTEPS       16
1596
+  #define E5_MICROSTEPS      128
1566 1597
   #define E5_OVERCURRENT    2000
1567 1598
   #define E5_STALLCURRENT   1500
1599
+  #define E5_MAX_VOLTAGE     127
1600
+  #define E5_CHAIN_POS         0
1601
+
1602
+
1603
+  /**
1604
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1605
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1606
+    * Other detected conditions can be used to stop the current print.
1607
+    * Relevant g-codes:
1608
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1609
+    *         I not present or I0 or I1 - X, Y, Z or E0
1610
+    *         I2 - X2, Y2, Z2 or E1
1611
+    *         I3 - Z3 or E3
1612
+    *         I4 - E4
1613
+    *         I5 - E5
1614
+    * M916 - Increase drive level until get thermal warning
1615
+    * M917 - Find minimum current thresholds
1616
+    * M918 - Increase speed until max or error
1617
+    * M122 S0/1 - Report driver parameters
1618
+  */
1619
+  //#define MONITOR_L6470_DRIVER_STATUS
1620
+
1621
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1622
+    #define KVAL_HOLD_STEP_DOWN     1
1623
+    //#define L6470_STOP_ON_ERROR
1624
+  #endif
1625
+
1626
+  #define L6470_CHITCHAT     // enable display of additional status info
1568 1627
 
1569 1628
 #endif // L6470
1570 1629
 

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

@@ -1510,62 +1510,121 @@
1510 1510
 /**
1511 1511
  * L6470 Stepper Driver options
1512 1512
  *
1513
- * The Arduino-L6470 library is required for this stepper driver.
1513
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1514 1514
  * https://github.com/ameyer/Arduino-L6470
1515
+ *
1516
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1517
+ *     L6470_CHAIN_SCK_PIN
1518
+ *     L6470_CHAIN_MISO_PIN
1519
+ *     L6470_CHAIN_MOSI_PIN
1520
+ *     L6470_CHAIN_SS_PIN
1521
+ *     L6470_RESET_CHAIN_PIN  (optional)
1515 1522
  */
1516 1523
 #if HAS_DRIVER(L6470)
1517 1524
 
1518
-  #define X_MICROSTEPS        16 // number of microsteps
1519
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1520
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1525
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1526
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1527
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1528
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1529
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1521 1530
 
1522
-  #define X2_MICROSTEPS       16
1531
+  #define X2_MICROSTEPS      128
1523 1532
   #define X2_OVERCURRENT    2000
1524 1533
   #define X2_STALLCURRENT   1500
1534
+  #define X2_MAX_VOLTAGE     127
1535
+  #define X2_CHAIN_POS         0
1525 1536
 
1526
-  #define Y_MICROSTEPS        16
1537
+  #define Y_MICROSTEPS       128
1527 1538
   #define Y_OVERCURRENT     2000
1528 1539
   #define Y_STALLCURRENT    1500
1540
+  #define Y_MAX_VOLTAGE      127
1541
+  #define Y_CHAIN_POS          0
1529 1542
 
1530
-  #define Y2_MICROSTEPS       16
1543
+  #define Y2_MICROSTEPS      128
1531 1544
   #define Y2_OVERCURRENT    2000
1532 1545
   #define Y2_STALLCURRENT   1500
1546
+  #define Y2_MAX_VOLTAGE     127
1547
+  #define Y2_CHAIN_POS         0
1533 1548
 
1534
-  #define Z_MICROSTEPS        16
1549
+  #define Z_MICROSTEPS       128
1535 1550
   #define Z_OVERCURRENT     2000
1536 1551
   #define Z_STALLCURRENT    1500
1552
+  #define Z_MAX_VOLTAGE      127
1553
+  #define Z_CHAIN_POS          0
1537 1554
 
1538
-  #define Z2_MICROSTEPS       16
1555
+  #define Z2_MICROSTEPS      128
1539 1556
   #define Z2_OVERCURRENT    2000
1540 1557
   #define Z2_STALLCURRENT   1500
1558
+  #define Z2_MAX_VOLTAGE     127
1559
+  #define Z2_CHAIN_POS         0
1541 1560
 
1542
-  #define Z3_MICROSTEPS       16
1561
+  #define Z3_MICROSTEPS      128
1543 1562
   #define Z3_OVERCURRENT    2000
1544 1563
   #define Z3_STALLCURRENT   1500
1564
+  #define Z3_MAX_VOLTAGE     127
1565
+  #define Z3_CHAIN_POS         0
1545 1566
 
1546
-  #define E0_MICROSTEPS       16
1567
+  #define E0_MICROSTEPS      128
1547 1568
   #define E0_OVERCURRENT    2000
1548 1569
   #define E0_STALLCURRENT   1500
1570
+  #define E0_MAX_VOLTAGE     127
1571
+  #define E0_CHAIN_POS         0
1549 1572
 
1550
-  #define E1_MICROSTEPS       16
1573
+  #define E1_MICROSTEPS      128
1551 1574
   #define E1_OVERCURRENT    2000
1552 1575
   #define E1_STALLCURRENT   1500
1576
+  #define E1_MAX_VOLTAGE     127
1577
+  #define E1_CHAIN_POS         0
1553 1578
 
1554
-  #define E2_MICROSTEPS       16
1579
+  #define E2_MICROSTEPS      128
1555 1580
   #define E2_OVERCURRENT    2000
1556 1581
   #define E2_STALLCURRENT   1500
1582
+  #define E2_MAX_VOLTAGE     127
1583
+  #define E2_CHAIN_POS         0
1557 1584
 
1558
-  #define E3_MICROSTEPS       16
1585
+  #define E3_MICROSTEPS      128
1559 1586
   #define E3_OVERCURRENT    2000
1560 1587
   #define E3_STALLCURRENT   1500
1588
+  #define E3_MAX_VOLTAGE     127
1589
+  #define E3_CHAIN_POS         0
1561 1590
 
1562
-  #define E4_MICROSTEPS       16
1591
+  #define E4_MICROSTEPS      128
1563 1592
   #define E4_OVERCURRENT    2000
1564 1593
   #define E4_STALLCURRENT   1500
1594
+  #define E4_MAX_VOLTAGE     127
1595
+  #define E4_CHAIN_POS         0
1565 1596
 
1566
-  #define E5_MICROSTEPS       16
1597
+  #define E5_MICROSTEPS      128
1567 1598
   #define E5_OVERCURRENT    2000
1568 1599
   #define E5_STALLCURRENT   1500
1600
+  #define E5_MAX_VOLTAGE     127
1601
+  #define E5_CHAIN_POS         0
1602
+
1603
+
1604
+  /**
1605
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1606
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1607
+    * Other detected conditions can be used to stop the current print.
1608
+    * Relevant g-codes:
1609
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1610
+    *         I not present or I0 or I1 - X, Y, Z or E0
1611
+    *         I2 - X2, Y2, Z2 or E1
1612
+    *         I3 - Z3 or E3
1613
+    *         I4 - E4
1614
+    *         I5 - E5
1615
+    * M916 - Increase drive level until get thermal warning
1616
+    * M917 - Find minimum current thresholds
1617
+    * M918 - Increase speed until max or error
1618
+    * M122 S0/1 - Report driver parameters
1619
+  */
1620
+  //#define MONITOR_L6470_DRIVER_STATUS
1621
+
1622
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1623
+    #define KVAL_HOLD_STEP_DOWN     1
1624
+    //#define L6470_STOP_ON_ERROR
1625
+  #endif
1626
+
1627
+  #define L6470_CHITCHAT     // enable display of additional status info
1569 1628
 
1570 1629
 #endif // L6470
1571 1630
 

+ 75
- 16
Marlin/src/config/examples/delta/Anycubic/Kossel/Configuration_adv.h View File

@@ -1510,62 +1510,121 @@
1510 1510
 /**
1511 1511
  * L6470 Stepper Driver options
1512 1512
  *
1513
- * The Arduino-L6470 library is required for this stepper driver.
1513
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1514 1514
  * https://github.com/ameyer/Arduino-L6470
1515
+ *
1516
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1517
+ *     L6470_CHAIN_SCK_PIN
1518
+ *     L6470_CHAIN_MISO_PIN
1519
+ *     L6470_CHAIN_MOSI_PIN
1520
+ *     L6470_CHAIN_SS_PIN
1521
+ *     L6470_RESET_CHAIN_PIN  (optional)
1515 1522
  */
1516 1523
 #if HAS_DRIVER(L6470)
1517 1524
 
1518
-  #define X_MICROSTEPS        16 // number of microsteps
1519
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1520
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1525
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1526
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1527
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1528
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1529
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1521 1530
 
1522
-  #define X2_MICROSTEPS       16
1531
+  #define X2_MICROSTEPS      128
1523 1532
   #define X2_OVERCURRENT    2000
1524 1533
   #define X2_STALLCURRENT   1500
1534
+  #define X2_MAX_VOLTAGE     127
1535
+  #define X2_CHAIN_POS         0
1525 1536
 
1526
-  #define Y_MICROSTEPS        16
1537
+  #define Y_MICROSTEPS       128
1527 1538
   #define Y_OVERCURRENT     2000
1528 1539
   #define Y_STALLCURRENT    1500
1540
+  #define Y_MAX_VOLTAGE      127
1541
+  #define Y_CHAIN_POS          0
1529 1542
 
1530
-  #define Y2_MICROSTEPS       16
1543
+  #define Y2_MICROSTEPS      128
1531 1544
   #define Y2_OVERCURRENT    2000
1532 1545
   #define Y2_STALLCURRENT   1500
1546
+  #define Y2_MAX_VOLTAGE     127
1547
+  #define Y2_CHAIN_POS         0
1533 1548
 
1534
-  #define Z_MICROSTEPS        16
1549
+  #define Z_MICROSTEPS       128
1535 1550
   #define Z_OVERCURRENT     2000
1536 1551
   #define Z_STALLCURRENT    1500
1552
+  #define Z_MAX_VOLTAGE      127
1553
+  #define Z_CHAIN_POS          0
1537 1554
 
1538
-  #define Z2_MICROSTEPS       16
1555
+  #define Z2_MICROSTEPS      128
1539 1556
   #define Z2_OVERCURRENT    2000
1540 1557
   #define Z2_STALLCURRENT   1500
1558
+  #define Z2_MAX_VOLTAGE     127
1559
+  #define Z2_CHAIN_POS         0
1541 1560
 
1542
-  #define Z3_MICROSTEPS       16
1561
+  #define Z3_MICROSTEPS      128
1543 1562
   #define Z3_OVERCURRENT    2000
1544 1563
   #define Z3_STALLCURRENT   1500
1564
+  #define Z3_MAX_VOLTAGE     127
1565
+  #define Z3_CHAIN_POS         0
1545 1566
 
1546
-  #define E0_MICROSTEPS       16
1567
+  #define E0_MICROSTEPS      128
1547 1568
   #define E0_OVERCURRENT    2000
1548 1569
   #define E0_STALLCURRENT   1500
1570
+  #define E0_MAX_VOLTAGE     127
1571
+  #define E0_CHAIN_POS         0
1549 1572
 
1550
-  #define E1_MICROSTEPS       16
1573
+  #define E1_MICROSTEPS      128
1551 1574
   #define E1_OVERCURRENT    2000
1552 1575
   #define E1_STALLCURRENT   1500
1576
+  #define E1_MAX_VOLTAGE     127
1577
+  #define E1_CHAIN_POS         0
1553 1578
 
1554
-  #define E2_MICROSTEPS       16
1579
+  #define E2_MICROSTEPS      128
1555 1580
   #define E2_OVERCURRENT    2000
1556 1581
   #define E2_STALLCURRENT   1500
1582
+  #define E2_MAX_VOLTAGE     127
1583
+  #define E2_CHAIN_POS         0
1557 1584
 
1558
-  #define E3_MICROSTEPS       16
1585
+  #define E3_MICROSTEPS      128
1559 1586
   #define E3_OVERCURRENT    2000
1560 1587
   #define E3_STALLCURRENT   1500
1588
+  #define E3_MAX_VOLTAGE     127
1589
+  #define E3_CHAIN_POS         0
1561 1590
 
1562
-  #define E4_MICROSTEPS       16
1591
+  #define E4_MICROSTEPS      128
1563 1592
   #define E4_OVERCURRENT    2000
1564 1593
   #define E4_STALLCURRENT   1500
1594
+  #define E4_MAX_VOLTAGE     127
1595
+  #define E4_CHAIN_POS         0
1565 1596
 
1566
-  #define E5_MICROSTEPS       16
1597
+  #define E5_MICROSTEPS      128
1567 1598
   #define E5_OVERCURRENT    2000
1568 1599
   #define E5_STALLCURRENT   1500
1600
+  #define E5_MAX_VOLTAGE     127
1601
+  #define E5_CHAIN_POS         0
1602
+
1603
+
1604
+  /**
1605
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1606
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1607
+    * Other detected conditions can be used to stop the current print.
1608
+    * Relevant g-codes:
1609
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1610
+    *         I not present or I0 or I1 - X, Y, Z or E0
1611
+    *         I2 - X2, Y2, Z2 or E1
1612
+    *         I3 - Z3 or E3
1613
+    *         I4 - E4
1614
+    *         I5 - E5
1615
+    * M916 - Increase drive level until get thermal warning
1616
+    * M917 - Find minimum current thresholds
1617
+    * M918 - Increase speed until max or error
1618
+    * M122 S0/1 - Report driver parameters
1619
+  */
1620
+  //#define MONITOR_L6470_DRIVER_STATUS
1621
+
1622
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1623
+    #define KVAL_HOLD_STEP_DOWN     1
1624
+    //#define L6470_STOP_ON_ERROR
1625
+  #endif
1626
+
1627
+  #define L6470_CHITCHAT     // enable display of additional status info
1569 1628
 
1570 1629
 #endif // L6470
1571 1630
 

+ 75
- 16
Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h View File

@@ -1510,62 +1510,121 @@
1510 1510
 /**
1511 1511
  * L6470 Stepper Driver options
1512 1512
  *
1513
- * The Arduino-L6470 library is required for this stepper driver.
1513
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1514 1514
  * https://github.com/ameyer/Arduino-L6470
1515
+ *
1516
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1517
+ *     L6470_CHAIN_SCK_PIN
1518
+ *     L6470_CHAIN_MISO_PIN
1519
+ *     L6470_CHAIN_MOSI_PIN
1520
+ *     L6470_CHAIN_SS_PIN
1521
+ *     L6470_RESET_CHAIN_PIN  (optional)
1515 1522
  */
1516 1523
 #if HAS_DRIVER(L6470)
1517 1524
 
1518
-  #define X_MICROSTEPS        16 // number of microsteps
1519
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1520
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1525
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1526
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1527
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1528
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1529
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1521 1530
 
1522
-  #define X2_MICROSTEPS       16
1531
+  #define X2_MICROSTEPS      128
1523 1532
   #define X2_OVERCURRENT    2000
1524 1533
   #define X2_STALLCURRENT   1500
1534
+  #define X2_MAX_VOLTAGE     127
1535
+  #define X2_CHAIN_POS         0
1525 1536
 
1526
-  #define Y_MICROSTEPS        16
1537
+  #define Y_MICROSTEPS       128
1527 1538
   #define Y_OVERCURRENT     2000
1528 1539
   #define Y_STALLCURRENT    1500
1540
+  #define Y_MAX_VOLTAGE      127
1541
+  #define Y_CHAIN_POS          0
1529 1542
 
1530
-  #define Y2_MICROSTEPS       16
1543
+  #define Y2_MICROSTEPS      128
1531 1544
   #define Y2_OVERCURRENT    2000
1532 1545
   #define Y2_STALLCURRENT   1500
1546
+  #define Y2_MAX_VOLTAGE     127
1547
+  #define Y2_CHAIN_POS         0
1533 1548
 
1534
-  #define Z_MICROSTEPS        16
1549
+  #define Z_MICROSTEPS       128
1535 1550
   #define Z_OVERCURRENT     2000
1536 1551
   #define Z_STALLCURRENT    1500
1552
+  #define Z_MAX_VOLTAGE      127
1553
+  #define Z_CHAIN_POS          0
1537 1554
 
1538
-  #define Z2_MICROSTEPS       16
1555
+  #define Z2_MICROSTEPS      128
1539 1556
   #define Z2_OVERCURRENT    2000
1540 1557
   #define Z2_STALLCURRENT   1500
1558
+  #define Z2_MAX_VOLTAGE     127
1559
+  #define Z2_CHAIN_POS         0
1541 1560
 
1542
-  #define Z3_MICROSTEPS       16
1561
+  #define Z3_MICROSTEPS      128
1543 1562
   #define Z3_OVERCURRENT    2000
1544 1563
   #define Z3_STALLCURRENT   1500
1564
+  #define Z3_MAX_VOLTAGE     127
1565
+  #define Z3_CHAIN_POS         0
1545 1566
 
1546
-  #define E0_MICROSTEPS       16
1567
+  #define E0_MICROSTEPS      128
1547 1568
   #define E0_OVERCURRENT    2000
1548 1569
   #define E0_STALLCURRENT   1500
1570
+  #define E0_MAX_VOLTAGE     127
1571
+  #define E0_CHAIN_POS         0
1549 1572
 
1550
-  #define E1_MICROSTEPS       16
1573
+  #define E1_MICROSTEPS      128
1551 1574
   #define E1_OVERCURRENT    2000
1552 1575
   #define E1_STALLCURRENT   1500
1576
+  #define E1_MAX_VOLTAGE     127
1577
+  #define E1_CHAIN_POS         0
1553 1578
 
1554
-  #define E2_MICROSTEPS       16
1579
+  #define E2_MICROSTEPS      128
1555 1580
   #define E2_OVERCURRENT    2000
1556 1581
   #define E2_STALLCURRENT   1500
1582
+  #define E2_MAX_VOLTAGE     127
1583
+  #define E2_CHAIN_POS         0
1557 1584
 
1558
-  #define E3_MICROSTEPS       16
1585
+  #define E3_MICROSTEPS      128
1559 1586
   #define E3_OVERCURRENT    2000
1560 1587
   #define E3_STALLCURRENT   1500
1588
+  #define E3_MAX_VOLTAGE     127
1589
+  #define E3_CHAIN_POS         0
1561 1590
 
1562
-  #define E4_MICROSTEPS       16
1591
+  #define E4_MICROSTEPS      128
1563 1592
   #define E4_OVERCURRENT    2000
1564 1593
   #define E4_STALLCURRENT   1500
1594
+  #define E4_MAX_VOLTAGE     127
1595
+  #define E4_CHAIN_POS         0
1565 1596
 
1566
-  #define E5_MICROSTEPS       16
1597
+  #define E5_MICROSTEPS      128
1567 1598
   #define E5_OVERCURRENT    2000
1568 1599
   #define E5_STALLCURRENT   1500
1600
+  #define E5_MAX_VOLTAGE     127
1601
+  #define E5_CHAIN_POS         0
1602
+
1603
+
1604
+  /**
1605
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1606
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1607
+    * Other detected conditions can be used to stop the current print.
1608
+    * Relevant g-codes:
1609
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1610
+    *         I not present or I0 or I1 - X, Y, Z or E0
1611
+    *         I2 - X2, Y2, Z2 or E1
1612
+    *         I3 - Z3 or E3
1613
+    *         I4 - E4
1614
+    *         I5 - E5
1615
+    * M916 - Increase drive level until get thermal warning
1616
+    * M917 - Find minimum current thresholds
1617
+    * M918 - Increase speed until max or error
1618
+    * M122 S0/1 - Report driver parameters
1619
+  */
1620
+  //#define MONITOR_L6470_DRIVER_STATUS
1621
+
1622
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1623
+    #define KVAL_HOLD_STEP_DOWN     1
1624
+    //#define L6470_STOP_ON_ERROR
1625
+  #endif
1626
+
1627
+  #define L6470_CHITCHAT     // enable display of additional status info
1569 1628
 
1570 1629
 #endif // L6470
1571 1630
 

+ 75
- 16
Marlin/src/config/examples/delta/FLSUN/kossel/Configuration_adv.h View File

@@ -1510,62 +1510,121 @@
1510 1510
 /**
1511 1511
  * L6470 Stepper Driver options
1512 1512
  *
1513
- * The Arduino-L6470 library is required for this stepper driver.
1513
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1514 1514
  * https://github.com/ameyer/Arduino-L6470
1515
+ *
1516
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1517
+ *     L6470_CHAIN_SCK_PIN
1518
+ *     L6470_CHAIN_MISO_PIN
1519
+ *     L6470_CHAIN_MOSI_PIN
1520
+ *     L6470_CHAIN_SS_PIN
1521
+ *     L6470_RESET_CHAIN_PIN  (optional)
1515 1522
  */
1516 1523
 #if HAS_DRIVER(L6470)
1517 1524
 
1518
-  #define X_MICROSTEPS        16 // number of microsteps
1519
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1520
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1525
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1526
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1527
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1528
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1529
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1521 1530
 
1522
-  #define X2_MICROSTEPS       16
1531
+  #define X2_MICROSTEPS      128
1523 1532
   #define X2_OVERCURRENT    2000
1524 1533
   #define X2_STALLCURRENT   1500
1534
+  #define X2_MAX_VOLTAGE     127
1535
+  #define X2_CHAIN_POS         0
1525 1536
 
1526
-  #define Y_MICROSTEPS        16
1537
+  #define Y_MICROSTEPS       128
1527 1538
   #define Y_OVERCURRENT     2000
1528 1539
   #define Y_STALLCURRENT    1500
1540
+  #define Y_MAX_VOLTAGE      127
1541
+  #define Y_CHAIN_POS          0
1529 1542
 
1530
-  #define Y2_MICROSTEPS       16
1543
+  #define Y2_MICROSTEPS      128
1531 1544
   #define Y2_OVERCURRENT    2000
1532 1545
   #define Y2_STALLCURRENT   1500
1546
+  #define Y2_MAX_VOLTAGE     127
1547
+  #define Y2_CHAIN_POS         0
1533 1548
 
1534
-  #define Z_MICROSTEPS        16
1549
+  #define Z_MICROSTEPS       128
1535 1550
   #define Z_OVERCURRENT     2000
1536 1551
   #define Z_STALLCURRENT    1500
1552
+  #define Z_MAX_VOLTAGE      127
1553
+  #define Z_CHAIN_POS          0
1537 1554
 
1538
-  #define Z2_MICROSTEPS       16
1555
+  #define Z2_MICROSTEPS      128
1539 1556
   #define Z2_OVERCURRENT    2000
1540 1557
   #define Z2_STALLCURRENT   1500
1558
+  #define Z2_MAX_VOLTAGE     127
1559
+  #define Z2_CHAIN_POS         0
1541 1560
 
1542
-  #define Z3_MICROSTEPS       16
1561
+  #define Z3_MICROSTEPS      128
1543 1562
   #define Z3_OVERCURRENT    2000
1544 1563
   #define Z3_STALLCURRENT   1500
1564
+  #define Z3_MAX_VOLTAGE     127
1565
+  #define Z3_CHAIN_POS         0
1545 1566
 
1546
-  #define E0_MICROSTEPS       16
1567
+  #define E0_MICROSTEPS      128
1547 1568
   #define E0_OVERCURRENT    2000
1548 1569
   #define E0_STALLCURRENT   1500
1570
+  #define E0_MAX_VOLTAGE     127
1571
+  #define E0_CHAIN_POS         0
1549 1572
 
1550
-  #define E1_MICROSTEPS       16
1573
+  #define E1_MICROSTEPS      128
1551 1574
   #define E1_OVERCURRENT    2000
1552 1575
   #define E1_STALLCURRENT   1500
1576
+  #define E1_MAX_VOLTAGE     127
1577
+  #define E1_CHAIN_POS         0
1553 1578
 
1554
-  #define E2_MICROSTEPS       16
1579
+  #define E2_MICROSTEPS      128
1555 1580
   #define E2_OVERCURRENT    2000
1556 1581
   #define E2_STALLCURRENT   1500
1582
+  #define E2_MAX_VOLTAGE     127
1583
+  #define E2_CHAIN_POS         0
1557 1584
 
1558
-  #define E3_MICROSTEPS       16
1585
+  #define E3_MICROSTEPS      128
1559 1586
   #define E3_OVERCURRENT    2000
1560 1587
   #define E3_STALLCURRENT   1500
1588
+  #define E3_MAX_VOLTAGE     127
1589
+  #define E3_CHAIN_POS         0
1561 1590
 
1562
-  #define E4_MICROSTEPS       16
1591
+  #define E4_MICROSTEPS      128
1563 1592
   #define E4_OVERCURRENT    2000
1564 1593
   #define E4_STALLCURRENT   1500
1594
+  #define E4_MAX_VOLTAGE     127
1595
+  #define E4_CHAIN_POS         0
1565 1596
 
1566
-  #define E5_MICROSTEPS       16
1597
+  #define E5_MICROSTEPS      128
1567 1598
   #define E5_OVERCURRENT    2000
1568 1599
   #define E5_STALLCURRENT   1500
1600
+  #define E5_MAX_VOLTAGE     127
1601
+  #define E5_CHAIN_POS         0
1602
+
1603
+
1604
+  /**
1605
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1606
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1607
+    * Other detected conditions can be used to stop the current print.
1608
+    * Relevant g-codes:
1609
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1610
+    *         I not present or I0 or I1 - X, Y, Z or E0
1611
+    *         I2 - X2, Y2, Z2 or E1
1612
+    *         I3 - Z3 or E3
1613
+    *         I4 - E4
1614
+    *         I5 - E5
1615
+    * M916 - Increase drive level until get thermal warning
1616
+    * M917 - Find minimum current thresholds
1617
+    * M918 - Increase speed until max or error
1618
+    * M122 S0/1 - Report driver parameters
1619
+  */
1620
+  //#define MONITOR_L6470_DRIVER_STATUS
1621
+
1622
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1623
+    #define KVAL_HOLD_STEP_DOWN     1
1624
+    //#define L6470_STOP_ON_ERROR
1625
+  #endif
1626
+
1627
+  #define L6470_CHITCHAT     // enable display of additional status info
1569 1628
 
1570 1629
 #endif // L6470
1571 1630
 

+ 75
- 16
Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h View File

@@ -1510,62 +1510,121 @@
1510 1510
 /**
1511 1511
  * L6470 Stepper Driver options
1512 1512
  *
1513
- * The Arduino-L6470 library is required for this stepper driver.
1513
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1514 1514
  * https://github.com/ameyer/Arduino-L6470
1515
+ *
1516
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1517
+ *     L6470_CHAIN_SCK_PIN
1518
+ *     L6470_CHAIN_MISO_PIN
1519
+ *     L6470_CHAIN_MOSI_PIN
1520
+ *     L6470_CHAIN_SS_PIN
1521
+ *     L6470_RESET_CHAIN_PIN  (optional)
1515 1522
  */
1516 1523
 #if HAS_DRIVER(L6470)
1517 1524
 
1518
-  #define X_MICROSTEPS        16 // number of microsteps
1519
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1520
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1525
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1526
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1527
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1528
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1529
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1521 1530
 
1522
-  #define X2_MICROSTEPS       16
1531
+  #define X2_MICROSTEPS      128
1523 1532
   #define X2_OVERCURRENT    2000
1524 1533
   #define X2_STALLCURRENT   1500
1534
+  #define X2_MAX_VOLTAGE     127
1535
+  #define X2_CHAIN_POS         0
1525 1536
 
1526
-  #define Y_MICROSTEPS        16
1537
+  #define Y_MICROSTEPS       128
1527 1538
   #define Y_OVERCURRENT     2000
1528 1539
   #define Y_STALLCURRENT    1500
1540
+  #define Y_MAX_VOLTAGE      127
1541
+  #define Y_CHAIN_POS          0
1529 1542
 
1530
-  #define Y2_MICROSTEPS       16
1543
+  #define Y2_MICROSTEPS      128
1531 1544
   #define Y2_OVERCURRENT    2000
1532 1545
   #define Y2_STALLCURRENT   1500
1546
+  #define Y2_MAX_VOLTAGE     127
1547
+  #define Y2_CHAIN_POS         0
1533 1548
 
1534
-  #define Z_MICROSTEPS        16
1549
+  #define Z_MICROSTEPS       128
1535 1550
   #define Z_OVERCURRENT     2000
1536 1551
   #define Z_STALLCURRENT    1500
1552
+  #define Z_MAX_VOLTAGE      127
1553
+  #define Z_CHAIN_POS          0
1537 1554
 
1538
-  #define Z2_MICROSTEPS       16
1555
+  #define Z2_MICROSTEPS      128
1539 1556
   #define Z2_OVERCURRENT    2000
1540 1557
   #define Z2_STALLCURRENT   1500
1558
+  #define Z2_MAX_VOLTAGE     127
1559
+  #define Z2_CHAIN_POS         0
1541 1560
 
1542
-  #define Z3_MICROSTEPS       16
1561
+  #define Z3_MICROSTEPS      128
1543 1562
   #define Z3_OVERCURRENT    2000
1544 1563
   #define Z3_STALLCURRENT   1500
1564
+  #define Z3_MAX_VOLTAGE     127
1565
+  #define Z3_CHAIN_POS         0
1545 1566
 
1546
-  #define E0_MICROSTEPS       16
1567
+  #define E0_MICROSTEPS      128
1547 1568
   #define E0_OVERCURRENT    2000
1548 1569
   #define E0_STALLCURRENT   1500
1570
+  #define E0_MAX_VOLTAGE     127
1571
+  #define E0_CHAIN_POS         0
1549 1572
 
1550
-  #define E1_MICROSTEPS       16
1573
+  #define E1_MICROSTEPS      128
1551 1574
   #define E1_OVERCURRENT    2000
1552 1575
   #define E1_STALLCURRENT   1500
1576
+  #define E1_MAX_VOLTAGE     127
1577
+  #define E1_CHAIN_POS         0
1553 1578
 
1554
-  #define E2_MICROSTEPS       16
1579
+  #define E2_MICROSTEPS      128
1555 1580
   #define E2_OVERCURRENT    2000
1556 1581
   #define E2_STALLCURRENT   1500
1582
+  #define E2_MAX_VOLTAGE     127
1583
+  #define E2_CHAIN_POS         0
1557 1584
 
1558
-  #define E3_MICROSTEPS       16
1585
+  #define E3_MICROSTEPS      128
1559 1586
   #define E3_OVERCURRENT    2000
1560 1587
   #define E3_STALLCURRENT   1500
1588
+  #define E3_MAX_VOLTAGE     127
1589
+  #define E3_CHAIN_POS         0
1561 1590
 
1562
-  #define E4_MICROSTEPS       16
1591
+  #define E4_MICROSTEPS      128
1563 1592
   #define E4_OVERCURRENT    2000
1564 1593
   #define E4_STALLCURRENT   1500
1594
+  #define E4_MAX_VOLTAGE     127
1595
+  #define E4_CHAIN_POS         0
1565 1596
 
1566
-  #define E5_MICROSTEPS       16
1597
+  #define E5_MICROSTEPS      128
1567 1598
   #define E5_OVERCURRENT    2000
1568 1599
   #define E5_STALLCURRENT   1500
1600
+  #define E5_MAX_VOLTAGE     127
1601
+  #define E5_CHAIN_POS         0
1602
+
1603
+
1604
+  /**
1605
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1606
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1607
+    * Other detected conditions can be used to stop the current print.
1608
+    * Relevant g-codes:
1609
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1610
+    *         I not present or I0 or I1 - X, Y, Z or E0
1611
+    *         I2 - X2, Y2, Z2 or E1
1612
+    *         I3 - Z3 or E3
1613
+    *         I4 - E4
1614
+    *         I5 - E5
1615
+    * M916 - Increase drive level until get thermal warning
1616
+    * M917 - Find minimum current thresholds
1617
+    * M918 - Increase speed until max or error
1618
+    * M122 S0/1 - Report driver parameters
1619
+  */
1620
+  //#define MONITOR_L6470_DRIVER_STATUS
1621
+
1622
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1623
+    #define KVAL_HOLD_STEP_DOWN     1
1624
+    //#define L6470_STOP_ON_ERROR
1625
+  #endif
1626
+
1627
+  #define L6470_CHITCHAT     // enable display of additional status info
1569 1628
 
1570 1629
 #endif // L6470
1571 1630
 

+ 75
- 16
Marlin/src/config/examples/delta/Geeetech/Rostock 301/Configuration_adv.h View File

@@ -1483,62 +1483,121 @@
1483 1483
 /**
1484 1484
  * L6470 Stepper Driver options
1485 1485
  *
1486
- * The Arduino-L6470 library is required for this stepper driver.
1486
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1487 1487
  * https://github.com/ameyer/Arduino-L6470
1488
+ *
1489
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1490
+ *     L6470_CHAIN_SCK_PIN
1491
+ *     L6470_CHAIN_MISO_PIN
1492
+ *     L6470_CHAIN_MOSI_PIN
1493
+ *     L6470_CHAIN_SS_PIN
1494
+ *     L6470_RESET_CHAIN_PIN  (optional)
1488 1495
  */
1489 1496
 #if HAS_DRIVER(L6470)
1490 1497
 
1491
-  #define X_MICROSTEPS        16 // number of microsteps
1492
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1493
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1498
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1499
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1500
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1501
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1502
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1494 1503
 
1495
-  #define X2_MICROSTEPS       16
1504
+  #define X2_MICROSTEPS      128
1496 1505
   #define X2_OVERCURRENT    2000
1497 1506
   #define X2_STALLCURRENT   1500
1507
+  #define X2_MAX_VOLTAGE     127
1508
+  #define X2_CHAIN_POS         0
1498 1509
 
1499
-  #define Y_MICROSTEPS        16
1510
+  #define Y_MICROSTEPS       128
1500 1511
   #define Y_OVERCURRENT     2000
1501 1512
   #define Y_STALLCURRENT    1500
1513
+  #define Y_MAX_VOLTAGE      127
1514
+  #define Y_CHAIN_POS          0
1502 1515
 
1503
-  #define Y2_MICROSTEPS       16
1516
+  #define Y2_MICROSTEPS      128
1504 1517
   #define Y2_OVERCURRENT    2000
1505 1518
   #define Y2_STALLCURRENT   1500
1519
+  #define Y2_MAX_VOLTAGE     127
1520
+  #define Y2_CHAIN_POS         0
1506 1521
 
1507
-  #define Z_MICROSTEPS        16
1522
+  #define Z_MICROSTEPS       128
1508 1523
   #define Z_OVERCURRENT     2000
1509 1524
   #define Z_STALLCURRENT    1500
1525
+  #define Z_MAX_VOLTAGE      127
1526
+  #define Z_CHAIN_POS          0
1510 1527
 
1511
-  #define Z2_MICROSTEPS       16
1528
+  #define Z2_MICROSTEPS      128
1512 1529
   #define Z2_OVERCURRENT    2000
1513 1530
   #define Z2_STALLCURRENT   1500
1531
+  #define Z2_MAX_VOLTAGE     127
1532
+  #define Z2_CHAIN_POS         0
1514 1533
 
1515
-  #define Z3_MICROSTEPS       16
1534
+  #define Z3_MICROSTEPS      128
1516 1535
   #define Z3_OVERCURRENT    2000
1517 1536
   #define Z3_STALLCURRENT   1500
1537
+  #define Z3_MAX_VOLTAGE     127
1538
+  #define Z3_CHAIN_POS         0
1518 1539
 
1519
-  #define E0_MICROSTEPS       16
1540
+  #define E0_MICROSTEPS      128
1520 1541
   #define E0_OVERCURRENT    2000
1521 1542
   #define E0_STALLCURRENT   1500
1543
+  #define E0_MAX_VOLTAGE     127
1544
+  #define E0_CHAIN_POS         0
1522 1545
 
1523
-  #define E1_MICROSTEPS       16
1546
+  #define E1_MICROSTEPS      128
1524 1547
   #define E1_OVERCURRENT    2000
1525 1548
   #define E1_STALLCURRENT   1500
1549
+  #define E1_MAX_VOLTAGE     127
1550
+  #define E1_CHAIN_POS         0
1526 1551
 
1527
-  #define E2_MICROSTEPS       16
1552
+  #define E2_MICROSTEPS      128
1528 1553
   #define E2_OVERCURRENT    2000
1529 1554
   #define E2_STALLCURRENT   1500
1555
+  #define E2_MAX_VOLTAGE     127
1556
+  #define E2_CHAIN_POS         0
1530 1557
 
1531
-  #define E3_MICROSTEPS       16
1558
+  #define E3_MICROSTEPS      128
1532 1559
   #define E3_OVERCURRENT    2000
1533 1560
   #define E3_STALLCURRENT   1500
1561
+  #define E3_MAX_VOLTAGE     127
1562
+  #define E3_CHAIN_POS         0
1534 1563
 
1535
-  #define E4_MICROSTEPS       16
1564
+  #define E4_MICROSTEPS      128
1536 1565
   #define E4_OVERCURRENT    2000
1537 1566
   #define E4_STALLCURRENT   1500
1567
+  #define E4_MAX_VOLTAGE     127
1568
+  #define E4_CHAIN_POS         0
1538 1569
 
1539
-  #define E5_MICROSTEPS       16
1570
+  #define E5_MICROSTEPS      128
1540 1571
   #define E5_OVERCURRENT    2000
1541 1572
   #define E5_STALLCURRENT   1500
1573
+  #define E5_MAX_VOLTAGE     127
1574
+  #define E5_CHAIN_POS         0
1575
+
1576
+
1577
+  /**
1578
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1579
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1580
+    * Other detected conditions can be used to stop the current print.
1581
+    * Relevant g-codes:
1582
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1583
+    *         I not present or I0 or I1 - X, Y, Z or E0
1584
+    *         I2 - X2, Y2, Z2 or E1
1585
+    *         I3 - Z3 or E3
1586
+    *         I4 - E4
1587
+    *         I5 - E5
1588
+    * M916 - Increase drive level until get thermal warning
1589
+    * M917 - Find minimum current thresholds
1590
+    * M918 - Increase speed until max or error
1591
+    * M122 S0/1 - Report driver parameters
1592
+  */
1593
+  //#define MONITOR_L6470_DRIVER_STATUS
1594
+
1595
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1596
+    #define KVAL_HOLD_STEP_DOWN     1
1597
+    //#define L6470_STOP_ON_ERROR
1598
+  #endif
1599
+
1600
+  #define L6470_CHITCHAT     // enable display of additional status info
1542 1601
 
1543 1602
 #endif // L6470
1544 1603
 

+ 75
- 16
Marlin/src/config/examples/delta/MKS/SBASE/Configuration_adv.h View File

@@ -1510,62 +1510,121 @@
1510 1510
 /**
1511 1511
  * L6470 Stepper Driver options
1512 1512
  *
1513
- * The Arduino-L6470 library is required for this stepper driver.
1513
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1514 1514
  * https://github.com/ameyer/Arduino-L6470
1515
+ *
1516
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1517
+ *     L6470_CHAIN_SCK_PIN
1518
+ *     L6470_CHAIN_MISO_PIN
1519
+ *     L6470_CHAIN_MOSI_PIN
1520
+ *     L6470_CHAIN_SS_PIN
1521
+ *     L6470_RESET_CHAIN_PIN  (optional)
1515 1522
  */
1516 1523
 #if HAS_DRIVER(L6470)
1517 1524
 
1518
-  #define X_MICROSTEPS        16 // number of microsteps
1519
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1520
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1525
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1526
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1527
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1528
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1529
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1521 1530
 
1522
-  #define X2_MICROSTEPS       16
1531
+  #define X2_MICROSTEPS      128
1523 1532
   #define X2_OVERCURRENT    2000
1524 1533
   #define X2_STALLCURRENT   1500
1534
+  #define X2_MAX_VOLTAGE     127
1535
+  #define X2_CHAIN_POS         0
1525 1536
 
1526
-  #define Y_MICROSTEPS        16
1537
+  #define Y_MICROSTEPS       128
1527 1538
   #define Y_OVERCURRENT     2000
1528 1539
   #define Y_STALLCURRENT    1500
1540
+  #define Y_MAX_VOLTAGE      127
1541
+  #define Y_CHAIN_POS          0
1529 1542
 
1530
-  #define Y2_MICROSTEPS       16
1543
+  #define Y2_MICROSTEPS      128
1531 1544
   #define Y2_OVERCURRENT    2000
1532 1545
   #define Y2_STALLCURRENT   1500
1546
+  #define Y2_MAX_VOLTAGE     127
1547
+  #define Y2_CHAIN_POS         0
1533 1548
 
1534
-  #define Z_MICROSTEPS        16
1549
+  #define Z_MICROSTEPS       128
1535 1550
   #define Z_OVERCURRENT     2000
1536 1551
   #define Z_STALLCURRENT    1500
1552
+  #define Z_MAX_VOLTAGE      127
1553
+  #define Z_CHAIN_POS          0
1537 1554
 
1538
-  #define Z2_MICROSTEPS       16
1555
+  #define Z2_MICROSTEPS      128
1539 1556
   #define Z2_OVERCURRENT    2000
1540 1557
   #define Z2_STALLCURRENT   1500
1558
+  #define Z2_MAX_VOLTAGE     127
1559
+  #define Z2_CHAIN_POS         0
1541 1560
 
1542
-  #define Z3_MICROSTEPS       16
1561
+  #define Z3_MICROSTEPS      128
1543 1562
   #define Z3_OVERCURRENT    2000
1544 1563
   #define Z3_STALLCURRENT   1500
1564
+  #define Z3_MAX_VOLTAGE     127
1565
+  #define Z3_CHAIN_POS         0
1545 1566
 
1546
-  #define E0_MICROSTEPS       16
1567
+  #define E0_MICROSTEPS      128
1547 1568
   #define E0_OVERCURRENT    2000
1548 1569
   #define E0_STALLCURRENT   1500
1570
+  #define E0_MAX_VOLTAGE     127
1571
+  #define E0_CHAIN_POS         0
1549 1572
 
1550
-  #define E1_MICROSTEPS       16
1573
+  #define E1_MICROSTEPS      128
1551 1574
   #define E1_OVERCURRENT    2000
1552 1575
   #define E1_STALLCURRENT   1500
1576
+  #define E1_MAX_VOLTAGE     127
1577
+  #define E1_CHAIN_POS         0
1553 1578
 
1554
-  #define E2_MICROSTEPS       16
1579
+  #define E2_MICROSTEPS      128
1555 1580
   #define E2_OVERCURRENT    2000
1556 1581
   #define E2_STALLCURRENT   1500
1582
+  #define E2_MAX_VOLTAGE     127
1583
+  #define E2_CHAIN_POS         0
1557 1584
 
1558
-  #define E3_MICROSTEPS       16
1585
+  #define E3_MICROSTEPS      128
1559 1586
   #define E3_OVERCURRENT    2000
1560 1587
   #define E3_STALLCURRENT   1500
1588
+  #define E3_MAX_VOLTAGE     127
1589
+  #define E3_CHAIN_POS         0
1561 1590
 
1562
-  #define E4_MICROSTEPS       16
1591
+  #define E4_MICROSTEPS      128
1563 1592
   #define E4_OVERCURRENT    2000
1564 1593
   #define E4_STALLCURRENT   1500
1594
+  #define E4_MAX_VOLTAGE     127
1595
+  #define E4_CHAIN_POS         0
1565 1596
 
1566
-  #define E5_MICROSTEPS       16
1597
+  #define E5_MICROSTEPS      128
1567 1598
   #define E5_OVERCURRENT    2000
1568 1599
   #define E5_STALLCURRENT   1500
1600
+  #define E5_MAX_VOLTAGE     127
1601
+  #define E5_CHAIN_POS         0
1602
+
1603
+
1604
+  /**
1605
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1606
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1607
+    * Other detected conditions can be used to stop the current print.
1608
+    * Relevant g-codes:
1609
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1610
+    *         I not present or I0 or I1 - X, Y, Z or E0
1611
+    *         I2 - X2, Y2, Z2 or E1
1612
+    *         I3 - Z3 or E3
1613
+    *         I4 - E4
1614
+    *         I5 - E5
1615
+    * M916 - Increase drive level until get thermal warning
1616
+    * M917 - Find minimum current thresholds
1617
+    * M918 - Increase speed until max or error
1618
+    * M122 S0/1 - Report driver parameters
1619
+  */
1620
+  //#define MONITOR_L6470_DRIVER_STATUS
1621
+
1622
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1623
+    #define KVAL_HOLD_STEP_DOWN     1
1624
+    //#define L6470_STOP_ON_ERROR
1625
+  #endif
1626
+
1627
+  #define L6470_CHITCHAT     // enable display of additional status info
1569 1628
 
1570 1629
 #endif // L6470
1571 1630
 

+ 75
- 16
Marlin/src/config/examples/delta/Tevo Little Monster/Configuration_adv.h View File

@@ -1510,62 +1510,121 @@
1510 1510
 /**
1511 1511
  * L6470 Stepper Driver options
1512 1512
  *
1513
- * The Arduino-L6470 library is required for this stepper driver.
1513
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1514 1514
  * https://github.com/ameyer/Arduino-L6470
1515
+ *
1516
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1517
+ *     L6470_CHAIN_SCK_PIN
1518
+ *     L6470_CHAIN_MISO_PIN
1519
+ *     L6470_CHAIN_MOSI_PIN
1520
+ *     L6470_CHAIN_SS_PIN
1521
+ *     L6470_RESET_CHAIN_PIN  (optional)
1515 1522
  */
1516 1523
 #if HAS_DRIVER(L6470)
1517 1524
 
1518
-  #define X_MICROSTEPS        16 // number of microsteps
1519
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1520
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1525
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1526
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1527
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1528
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1529
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1521 1530
 
1522
-  #define X2_MICROSTEPS       16
1531
+  #define X2_MICROSTEPS      128
1523 1532
   #define X2_OVERCURRENT    2000
1524 1533
   #define X2_STALLCURRENT   1500
1534
+  #define X2_MAX_VOLTAGE     127
1535
+  #define X2_CHAIN_POS         0
1525 1536
 
1526
-  #define Y_MICROSTEPS        16
1537
+  #define Y_MICROSTEPS       128
1527 1538
   #define Y_OVERCURRENT     2000
1528 1539
   #define Y_STALLCURRENT    1500
1540
+  #define Y_MAX_VOLTAGE      127
1541
+  #define Y_CHAIN_POS          0
1529 1542
 
1530
-  #define Y2_MICROSTEPS       16
1543
+  #define Y2_MICROSTEPS      128
1531 1544
   #define Y2_OVERCURRENT    2000
1532 1545
   #define Y2_STALLCURRENT   1500
1546
+  #define Y2_MAX_VOLTAGE     127
1547
+  #define Y2_CHAIN_POS         0
1533 1548
 
1534
-  #define Z_MICROSTEPS        16
1549
+  #define Z_MICROSTEPS       128
1535 1550
   #define Z_OVERCURRENT     2000
1536 1551
   #define Z_STALLCURRENT    1500
1552
+  #define Z_MAX_VOLTAGE      127
1553
+  #define Z_CHAIN_POS          0
1537 1554
 
1538
-  #define Z2_MICROSTEPS       16
1555
+  #define Z2_MICROSTEPS      128
1539 1556
   #define Z2_OVERCURRENT    2000
1540 1557
   #define Z2_STALLCURRENT   1500
1558
+  #define Z2_MAX_VOLTAGE     127
1559
+  #define Z2_CHAIN_POS         0
1541 1560
 
1542
-  #define Z3_MICROSTEPS       16
1561
+  #define Z3_MICROSTEPS      128
1543 1562
   #define Z3_OVERCURRENT    2000
1544 1563
   #define Z3_STALLCURRENT   1500
1564
+  #define Z3_MAX_VOLTAGE     127
1565
+  #define Z3_CHAIN_POS         0
1545 1566
 
1546
-  #define E0_MICROSTEPS       16
1567
+  #define E0_MICROSTEPS      128
1547 1568
   #define E0_OVERCURRENT    2000
1548 1569
   #define E0_STALLCURRENT   1500
1570
+  #define E0_MAX_VOLTAGE     127
1571
+  #define E0_CHAIN_POS         0
1549 1572
 
1550
-  #define E1_MICROSTEPS       16
1573
+  #define E1_MICROSTEPS      128
1551 1574
   #define E1_OVERCURRENT    2000
1552 1575
   #define E1_STALLCURRENT   1500
1576
+  #define E1_MAX_VOLTAGE     127
1577
+  #define E1_CHAIN_POS         0
1553 1578
 
1554
-  #define E2_MICROSTEPS       16
1579
+  #define E2_MICROSTEPS      128
1555 1580
   #define E2_OVERCURRENT    2000
1556 1581
   #define E2_STALLCURRENT   1500
1582
+  #define E2_MAX_VOLTAGE     127
1583
+  #define E2_CHAIN_POS         0
1557 1584
 
1558
-  #define E3_MICROSTEPS       16
1585
+  #define E3_MICROSTEPS      128
1559 1586
   #define E3_OVERCURRENT    2000
1560 1587
   #define E3_STALLCURRENT   1500
1588
+  #define E3_MAX_VOLTAGE     127
1589
+  #define E3_CHAIN_POS         0
1561 1590
 
1562
-  #define E4_MICROSTEPS       16
1591
+  #define E4_MICROSTEPS      128
1563 1592
   #define E4_OVERCURRENT    2000
1564 1593
   #define E4_STALLCURRENT   1500
1594
+  #define E4_MAX_VOLTAGE     127
1595
+  #define E4_CHAIN_POS         0
1565 1596
 
1566
-  #define E5_MICROSTEPS       16
1597
+  #define E5_MICROSTEPS      128
1567 1598
   #define E5_OVERCURRENT    2000
1568 1599
   #define E5_STALLCURRENT   1500
1600
+  #define E5_MAX_VOLTAGE     127
1601
+  #define E5_CHAIN_POS         0
1602
+
1603
+
1604
+  /**
1605
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1606
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1607
+    * Other detected conditions can be used to stop the current print.
1608
+    * Relevant g-codes:
1609
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1610
+    *         I not present or I0 or I1 - X, Y, Z or E0
1611
+    *         I2 - X2, Y2, Z2 or E1
1612
+    *         I3 - Z3 or E3
1613
+    *         I4 - E4
1614
+    *         I5 - E5
1615
+    * M916 - Increase drive level until get thermal warning
1616
+    * M917 - Find minimum current thresholds
1617
+    * M918 - Increase speed until max or error
1618
+    * M122 S0/1 - Report driver parameters
1619
+  */
1620
+  //#define MONITOR_L6470_DRIVER_STATUS
1621
+
1622
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1623
+    #define KVAL_HOLD_STEP_DOWN     1
1624
+    //#define L6470_STOP_ON_ERROR
1625
+  #endif
1626
+
1627
+  #define L6470_CHITCHAT     // enable display of additional status info
1569 1628
 
1570 1629
 #endif // L6470
1571 1630
 

+ 75
- 16
Marlin/src/config/examples/delta/generic/Configuration_adv.h View File

@@ -1510,62 +1510,121 @@
1510 1510
 /**
1511 1511
  * L6470 Stepper Driver options
1512 1512
  *
1513
- * The Arduino-L6470 library is required for this stepper driver.
1513
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1514 1514
  * https://github.com/ameyer/Arduino-L6470
1515
+ *
1516
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1517
+ *     L6470_CHAIN_SCK_PIN
1518
+ *     L6470_CHAIN_MISO_PIN
1519
+ *     L6470_CHAIN_MOSI_PIN
1520
+ *     L6470_CHAIN_SS_PIN
1521
+ *     L6470_RESET_CHAIN_PIN  (optional)
1515 1522
  */
1516 1523
 #if HAS_DRIVER(L6470)
1517 1524
 
1518
-  #define X_MICROSTEPS        16 // number of microsteps
1519
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1520
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1525
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1526
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1527
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1528
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1529
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1521 1530
 
1522
-  #define X2_MICROSTEPS       16
1531
+  #define X2_MICROSTEPS      128
1523 1532
   #define X2_OVERCURRENT    2000
1524 1533
   #define X2_STALLCURRENT   1500
1534
+  #define X2_MAX_VOLTAGE     127
1535
+  #define X2_CHAIN_POS         0
1525 1536
 
1526
-  #define Y_MICROSTEPS        16
1537
+  #define Y_MICROSTEPS       128
1527 1538
   #define Y_OVERCURRENT     2000
1528 1539
   #define Y_STALLCURRENT    1500
1540
+  #define Y_MAX_VOLTAGE      127
1541
+  #define Y_CHAIN_POS          0
1529 1542
 
1530
-  #define Y2_MICROSTEPS       16
1543
+  #define Y2_MICROSTEPS      128
1531 1544
   #define Y2_OVERCURRENT    2000
1532 1545
   #define Y2_STALLCURRENT   1500
1546
+  #define Y2_MAX_VOLTAGE     127
1547
+  #define Y2_CHAIN_POS         0
1533 1548
 
1534
-  #define Z_MICROSTEPS        16
1549
+  #define Z_MICROSTEPS       128
1535 1550
   #define Z_OVERCURRENT     2000
1536 1551
   #define Z_STALLCURRENT    1500
1552
+  #define Z_MAX_VOLTAGE      127
1553
+  #define Z_CHAIN_POS          0
1537 1554
 
1538
-  #define Z2_MICROSTEPS       16
1555
+  #define Z2_MICROSTEPS      128
1539 1556
   #define Z2_OVERCURRENT    2000
1540 1557
   #define Z2_STALLCURRENT   1500
1558
+  #define Z2_MAX_VOLTAGE     127
1559
+  #define Z2_CHAIN_POS         0
1541 1560
 
1542
-  #define Z3_MICROSTEPS       16
1561
+  #define Z3_MICROSTEPS      128
1543 1562
   #define Z3_OVERCURRENT    2000
1544 1563
   #define Z3_STALLCURRENT   1500
1564
+  #define Z3_MAX_VOLTAGE     127
1565
+  #define Z3_CHAIN_POS         0
1545 1566
 
1546
-  #define E0_MICROSTEPS       16
1567
+  #define E0_MICROSTEPS      128
1547 1568
   #define E0_OVERCURRENT    2000
1548 1569
   #define E0_STALLCURRENT   1500
1570
+  #define E0_MAX_VOLTAGE     127
1571
+  #define E0_CHAIN_POS         0
1549 1572
 
1550
-  #define E1_MICROSTEPS       16
1573
+  #define E1_MICROSTEPS      128
1551 1574
   #define E1_OVERCURRENT    2000
1552 1575
   #define E1_STALLCURRENT   1500
1576
+  #define E1_MAX_VOLTAGE     127
1577
+  #define E1_CHAIN_POS         0
1553 1578
 
1554
-  #define E2_MICROSTEPS       16
1579
+  #define E2_MICROSTEPS      128
1555 1580
   #define E2_OVERCURRENT    2000
1556 1581
   #define E2_STALLCURRENT   1500
1582
+  #define E2_MAX_VOLTAGE     127
1583
+  #define E2_CHAIN_POS         0
1557 1584
 
1558
-  #define E3_MICROSTEPS       16
1585
+  #define E3_MICROSTEPS      128
1559 1586
   #define E3_OVERCURRENT    2000
1560 1587
   #define E3_STALLCURRENT   1500
1588
+  #define E3_MAX_VOLTAGE     127
1589
+  #define E3_CHAIN_POS         0
1561 1590
 
1562
-  #define E4_MICROSTEPS       16
1591
+  #define E4_MICROSTEPS      128
1563 1592
   #define E4_OVERCURRENT    2000
1564 1593
   #define E4_STALLCURRENT   1500
1594
+  #define E4_MAX_VOLTAGE     127
1595
+  #define E4_CHAIN_POS         0
1565 1596
 
1566
-  #define E5_MICROSTEPS       16
1597
+  #define E5_MICROSTEPS      128
1567 1598
   #define E5_OVERCURRENT    2000
1568 1599
   #define E5_STALLCURRENT   1500
1600
+  #define E5_MAX_VOLTAGE     127
1601
+  #define E5_CHAIN_POS         0
1602
+
1603
+
1604
+  /**
1605
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1606
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1607
+    * Other detected conditions can be used to stop the current print.
1608
+    * Relevant g-codes:
1609
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1610
+    *         I not present or I0 or I1 - X, Y, Z or E0
1611
+    *         I2 - X2, Y2, Z2 or E1
1612
+    *         I3 - Z3 or E3
1613
+    *         I4 - E4
1614
+    *         I5 - E5
1615
+    * M916 - Increase drive level until get thermal warning
1616
+    * M917 - Find minimum current thresholds
1617
+    * M918 - Increase speed until max or error
1618
+    * M122 S0/1 - Report driver parameters
1619
+  */
1620
+  //#define MONITOR_L6470_DRIVER_STATUS
1621
+
1622
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1623
+    #define KVAL_HOLD_STEP_DOWN     1
1624
+    //#define L6470_STOP_ON_ERROR
1625
+  #endif
1626
+
1627
+  #define L6470_CHITCHAT     // enable display of additional status info
1569 1628
 
1570 1629
 #endif // L6470
1571 1630
 

+ 75
- 16
Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h View File

@@ -1510,62 +1510,121 @@
1510 1510
 /**
1511 1511
  * L6470 Stepper Driver options
1512 1512
  *
1513
- * The Arduino-L6470 library is required for this stepper driver.
1513
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1514 1514
  * https://github.com/ameyer/Arduino-L6470
1515
+ *
1516
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1517
+ *     L6470_CHAIN_SCK_PIN
1518
+ *     L6470_CHAIN_MISO_PIN
1519
+ *     L6470_CHAIN_MOSI_PIN
1520
+ *     L6470_CHAIN_SS_PIN
1521
+ *     L6470_RESET_CHAIN_PIN  (optional)
1515 1522
  */
1516 1523
 #if HAS_DRIVER(L6470)
1517 1524
 
1518
-  #define X_MICROSTEPS        16 // number of microsteps
1519
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1520
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1525
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1526
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1527
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1528
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1529
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1521 1530
 
1522
-  #define X2_MICROSTEPS       16
1531
+  #define X2_MICROSTEPS      128
1523 1532
   #define X2_OVERCURRENT    2000
1524 1533
   #define X2_STALLCURRENT   1500
1534
+  #define X2_MAX_VOLTAGE     127
1535
+  #define X2_CHAIN_POS         0
1525 1536
 
1526
-  #define Y_MICROSTEPS        16
1537
+  #define Y_MICROSTEPS       128
1527 1538
   #define Y_OVERCURRENT     2000
1528 1539
   #define Y_STALLCURRENT    1500
1540
+  #define Y_MAX_VOLTAGE      127
1541
+  #define Y_CHAIN_POS          0
1529 1542
 
1530
-  #define Y2_MICROSTEPS       16
1543
+  #define Y2_MICROSTEPS      128
1531 1544
   #define Y2_OVERCURRENT    2000
1532 1545
   #define Y2_STALLCURRENT   1500
1546
+  #define Y2_MAX_VOLTAGE     127
1547
+  #define Y2_CHAIN_POS         0
1533 1548
 
1534
-  #define Z_MICROSTEPS        16
1549
+  #define Z_MICROSTEPS       128
1535 1550
   #define Z_OVERCURRENT     2000
1536 1551
   #define Z_STALLCURRENT    1500
1552
+  #define Z_MAX_VOLTAGE      127
1553
+  #define Z_CHAIN_POS          0
1537 1554
 
1538
-  #define Z2_MICROSTEPS       16
1555
+  #define Z2_MICROSTEPS      128
1539 1556
   #define Z2_OVERCURRENT    2000
1540 1557
   #define Z2_STALLCURRENT   1500
1558
+  #define Z2_MAX_VOLTAGE     127
1559
+  #define Z2_CHAIN_POS         0
1541 1560
 
1542
-  #define Z3_MICROSTEPS       16
1561
+  #define Z3_MICROSTEPS      128
1543 1562
   #define Z3_OVERCURRENT    2000
1544 1563
   #define Z3_STALLCURRENT   1500
1564
+  #define Z3_MAX_VOLTAGE     127
1565
+  #define Z3_CHAIN_POS         0
1545 1566
 
1546
-  #define E0_MICROSTEPS       16
1567
+  #define E0_MICROSTEPS      128
1547 1568
   #define E0_OVERCURRENT    2000
1548 1569
   #define E0_STALLCURRENT   1500
1570
+  #define E0_MAX_VOLTAGE     127
1571
+  #define E0_CHAIN_POS         0
1549 1572
 
1550
-  #define E1_MICROSTEPS       16
1573
+  #define E1_MICROSTEPS      128
1551 1574
   #define E1_OVERCURRENT    2000
1552 1575
   #define E1_STALLCURRENT   1500
1576
+  #define E1_MAX_VOLTAGE     127
1577
+  #define E1_CHAIN_POS         0
1553 1578
 
1554
-  #define E2_MICROSTEPS       16
1579
+  #define E2_MICROSTEPS      128
1555 1580
   #define E2_OVERCURRENT    2000
1556 1581
   #define E2_STALLCURRENT   1500
1582
+  #define E2_MAX_VOLTAGE     127
1583
+  #define E2_CHAIN_POS         0
1557 1584
 
1558
-  #define E3_MICROSTEPS       16
1585
+  #define E3_MICROSTEPS      128
1559 1586
   #define E3_OVERCURRENT    2000
1560 1587
   #define E3_STALLCURRENT   1500
1588
+  #define E3_MAX_VOLTAGE     127
1589
+  #define E3_CHAIN_POS         0
1561 1590
 
1562
-  #define E4_MICROSTEPS       16
1591
+  #define E4_MICROSTEPS      128
1563 1592
   #define E4_OVERCURRENT    2000
1564 1593
   #define E4_STALLCURRENT   1500
1594
+  #define E4_MAX_VOLTAGE     127
1595
+  #define E4_CHAIN_POS         0
1565 1596
 
1566
-  #define E5_MICROSTEPS       16
1597
+  #define E5_MICROSTEPS      128
1567 1598
   #define E5_OVERCURRENT    2000
1568 1599
   #define E5_STALLCURRENT   1500
1600
+  #define E5_MAX_VOLTAGE     127
1601
+  #define E5_CHAIN_POS         0
1602
+
1603
+
1604
+  /**
1605
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1606
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1607
+    * Other detected conditions can be used to stop the current print.
1608
+    * Relevant g-codes:
1609
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1610
+    *         I not present or I0 or I1 - X, Y, Z or E0
1611
+    *         I2 - X2, Y2, Z2 or E1
1612
+    *         I3 - Z3 or E3
1613
+    *         I4 - E4
1614
+    *         I5 - E5
1615
+    * M916 - Increase drive level until get thermal warning
1616
+    * M917 - Find minimum current thresholds
1617
+    * M918 - Increase speed until max or error
1618
+    * M122 S0/1 - Report driver parameters
1619
+  */
1620
+  //#define MONITOR_L6470_DRIVER_STATUS
1621
+
1622
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1623
+    #define KVAL_HOLD_STEP_DOWN     1
1624
+    //#define L6470_STOP_ON_ERROR
1625
+  #endif
1626
+
1627
+  #define L6470_CHITCHAT     // enable display of additional status info
1569 1628
 
1570 1629
 #endif // L6470
1571 1630
 

+ 75
- 16
Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h View File

@@ -1510,62 +1510,121 @@
1510 1510
 /**
1511 1511
  * L6470 Stepper Driver options
1512 1512
  *
1513
- * The Arduino-L6470 library is required for this stepper driver.
1513
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1514 1514
  * https://github.com/ameyer/Arduino-L6470
1515
+ *
1516
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1517
+ *     L6470_CHAIN_SCK_PIN
1518
+ *     L6470_CHAIN_MISO_PIN
1519
+ *     L6470_CHAIN_MOSI_PIN
1520
+ *     L6470_CHAIN_SS_PIN
1521
+ *     L6470_RESET_CHAIN_PIN  (optional)
1515 1522
  */
1516 1523
 #if HAS_DRIVER(L6470)
1517 1524
 
1518
-  #define X_MICROSTEPS        16 // number of microsteps
1519
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1520
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1525
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1526
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1527
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1528
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1529
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1521 1530
 
1522
-  #define X2_MICROSTEPS       16
1531
+  #define X2_MICROSTEPS      128
1523 1532
   #define X2_OVERCURRENT    2000
1524 1533
   #define X2_STALLCURRENT   1500
1534
+  #define X2_MAX_VOLTAGE     127
1535
+  #define X2_CHAIN_POS         0
1525 1536
 
1526
-  #define Y_MICROSTEPS        16
1537
+  #define Y_MICROSTEPS       128
1527 1538
   #define Y_OVERCURRENT     2000
1528 1539
   #define Y_STALLCURRENT    1500
1540
+  #define Y_MAX_VOLTAGE      127
1541
+  #define Y_CHAIN_POS          0
1529 1542
 
1530
-  #define Y2_MICROSTEPS       16
1543
+  #define Y2_MICROSTEPS      128
1531 1544
   #define Y2_OVERCURRENT    2000
1532 1545
   #define Y2_STALLCURRENT   1500
1546
+  #define Y2_MAX_VOLTAGE     127
1547
+  #define Y2_CHAIN_POS         0
1533 1548
 
1534
-  #define Z_MICROSTEPS        16
1549
+  #define Z_MICROSTEPS       128
1535 1550
   #define Z_OVERCURRENT     2000
1536 1551
   #define Z_STALLCURRENT    1500
1552
+  #define Z_MAX_VOLTAGE      127
1553
+  #define Z_CHAIN_POS          0
1537 1554
 
1538
-  #define Z2_MICROSTEPS       16
1555
+  #define Z2_MICROSTEPS      128
1539 1556
   #define Z2_OVERCURRENT    2000
1540 1557
   #define Z2_STALLCURRENT   1500
1558
+  #define Z2_MAX_VOLTAGE     127
1559
+  #define Z2_CHAIN_POS         0
1541 1560
 
1542
-  #define Z3_MICROSTEPS       16
1561
+  #define Z3_MICROSTEPS      128
1543 1562
   #define Z3_OVERCURRENT    2000
1544 1563
   #define Z3_STALLCURRENT   1500
1564
+  #define Z3_MAX_VOLTAGE     127
1565
+  #define Z3_CHAIN_POS         0
1545 1566
 
1546
-  #define E0_MICROSTEPS       16
1567
+  #define E0_MICROSTEPS      128
1547 1568
   #define E0_OVERCURRENT    2000
1548 1569
   #define E0_STALLCURRENT   1500
1570
+  #define E0_MAX_VOLTAGE     127
1571
+  #define E0_CHAIN_POS         0
1549 1572
 
1550
-  #define E1_MICROSTEPS       16
1573
+  #define E1_MICROSTEPS      128
1551 1574
   #define E1_OVERCURRENT    2000
1552 1575
   #define E1_STALLCURRENT   1500
1576
+  #define E1_MAX_VOLTAGE     127
1577
+  #define E1_CHAIN_POS         0
1553 1578
 
1554
-  #define E2_MICROSTEPS       16
1579
+  #define E2_MICROSTEPS      128
1555 1580
   #define E2_OVERCURRENT    2000
1556 1581
   #define E2_STALLCURRENT   1500
1582
+  #define E2_MAX_VOLTAGE     127
1583
+  #define E2_CHAIN_POS         0
1557 1584
 
1558
-  #define E3_MICROSTEPS       16
1585
+  #define E3_MICROSTEPS      128
1559 1586
   #define E3_OVERCURRENT    2000
1560 1587
   #define E3_STALLCURRENT   1500
1588
+  #define E3_MAX_VOLTAGE     127
1589
+  #define E3_CHAIN_POS         0
1561 1590
 
1562
-  #define E4_MICROSTEPS       16
1591
+  #define E4_MICROSTEPS      128
1563 1592
   #define E4_OVERCURRENT    2000
1564 1593
   #define E4_STALLCURRENT   1500
1594
+  #define E4_MAX_VOLTAGE     127
1595
+  #define E4_CHAIN_POS         0
1565 1596
 
1566
-  #define E5_MICROSTEPS       16
1597
+  #define E5_MICROSTEPS      128
1567 1598
   #define E5_OVERCURRENT    2000
1568 1599
   #define E5_STALLCURRENT   1500
1600
+  #define E5_MAX_VOLTAGE     127
1601
+  #define E5_CHAIN_POS         0
1602
+
1603
+
1604
+  /**
1605
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1606
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1607
+    * Other detected conditions can be used to stop the current print.
1608
+    * Relevant g-codes:
1609
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1610
+    *         I not present or I0 or I1 - X, Y, Z or E0
1611
+    *         I2 - X2, Y2, Z2 or E1
1612
+    *         I3 - Z3 or E3
1613
+    *         I4 - E4
1614
+    *         I5 - E5
1615
+    * M916 - Increase drive level until get thermal warning
1616
+    * M917 - Find minimum current thresholds
1617
+    * M918 - Increase speed until max or error
1618
+    * M122 S0/1 - Report driver parameters
1619
+  */
1620
+  //#define MONITOR_L6470_DRIVER_STATUS
1621
+
1622
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1623
+    #define KVAL_HOLD_STEP_DOWN     1
1624
+    //#define L6470_STOP_ON_ERROR
1625
+  #endif
1626
+
1627
+  #define L6470_CHITCHAT     // enable display of additional status info
1569 1628
 
1570 1629
 #endif // L6470
1571 1630
 

+ 75
- 16
Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/makibox/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h View File

@@ -1508,62 +1508,121 @@
1508 1508
 /**
1509 1509
  * L6470 Stepper Driver options
1510 1510
  *
1511
- * The Arduino-L6470 library is required for this stepper driver.
1511
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1512 1512
  * https://github.com/ameyer/Arduino-L6470
1513
+ *
1514
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1515
+ *     L6470_CHAIN_SCK_PIN
1516
+ *     L6470_CHAIN_MISO_PIN
1517
+ *     L6470_CHAIN_MOSI_PIN
1518
+ *     L6470_CHAIN_SS_PIN
1519
+ *     L6470_RESET_CHAIN_PIN  (optional)
1513 1520
  */
1514 1521
 #if HAS_DRIVER(L6470)
1515 1522
 
1516
-  #define X_MICROSTEPS        16 // number of microsteps
1517
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1518
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1523
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1524
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1525
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1526
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1527
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1519 1528
 
1520
-  #define X2_MICROSTEPS       16
1529
+  #define X2_MICROSTEPS      128
1521 1530
   #define X2_OVERCURRENT    2000
1522 1531
   #define X2_STALLCURRENT   1500
1532
+  #define X2_MAX_VOLTAGE     127
1533
+  #define X2_CHAIN_POS         0
1523 1534
 
1524
-  #define Y_MICROSTEPS        16
1535
+  #define Y_MICROSTEPS       128
1525 1536
   #define Y_OVERCURRENT     2000
1526 1537
   #define Y_STALLCURRENT    1500
1538
+  #define Y_MAX_VOLTAGE      127
1539
+  #define Y_CHAIN_POS          0
1527 1540
 
1528
-  #define Y2_MICROSTEPS       16
1541
+  #define Y2_MICROSTEPS      128
1529 1542
   #define Y2_OVERCURRENT    2000
1530 1543
   #define Y2_STALLCURRENT   1500
1544
+  #define Y2_MAX_VOLTAGE     127
1545
+  #define Y2_CHAIN_POS         0
1531 1546
 
1532
-  #define Z_MICROSTEPS        16
1547
+  #define Z_MICROSTEPS       128
1533 1548
   #define Z_OVERCURRENT     2000
1534 1549
   #define Z_STALLCURRENT    1500
1550
+  #define Z_MAX_VOLTAGE      127
1551
+  #define Z_CHAIN_POS          0
1535 1552
 
1536
-  #define Z2_MICROSTEPS       16
1553
+  #define Z2_MICROSTEPS      128
1537 1554
   #define Z2_OVERCURRENT    2000
1538 1555
   #define Z2_STALLCURRENT   1500
1556
+  #define Z2_MAX_VOLTAGE     127
1557
+  #define Z2_CHAIN_POS         0
1539 1558
 
1540
-  #define Z3_MICROSTEPS       16
1559
+  #define Z3_MICROSTEPS      128
1541 1560
   #define Z3_OVERCURRENT    2000
1542 1561
   #define Z3_STALLCURRENT   1500
1562
+  #define Z3_MAX_VOLTAGE     127
1563
+  #define Z3_CHAIN_POS         0
1543 1564
 
1544
-  #define E0_MICROSTEPS       16
1565
+  #define E0_MICROSTEPS      128
1545 1566
   #define E0_OVERCURRENT    2000
1546 1567
   #define E0_STALLCURRENT   1500
1568
+  #define E0_MAX_VOLTAGE     127
1569
+  #define E0_CHAIN_POS         0
1547 1570
 
1548
-  #define E1_MICROSTEPS       16
1571
+  #define E1_MICROSTEPS      128
1549 1572
   #define E1_OVERCURRENT    2000
1550 1573
   #define E1_STALLCURRENT   1500
1574
+  #define E1_MAX_VOLTAGE     127
1575
+  #define E1_CHAIN_POS         0
1551 1576
 
1552
-  #define E2_MICROSTEPS       16
1577
+  #define E2_MICROSTEPS      128
1553 1578
   #define E2_OVERCURRENT    2000
1554 1579
   #define E2_STALLCURRENT   1500
1580
+  #define E2_MAX_VOLTAGE     127
1581
+  #define E2_CHAIN_POS         0
1555 1582
 
1556
-  #define E3_MICROSTEPS       16
1583
+  #define E3_MICROSTEPS      128
1557 1584
   #define E3_OVERCURRENT    2000
1558 1585
   #define E3_STALLCURRENT   1500
1586
+  #define E3_MAX_VOLTAGE     127
1587
+  #define E3_CHAIN_POS         0
1559 1588
 
1560
-  #define E4_MICROSTEPS       16
1589
+  #define E4_MICROSTEPS      128
1561 1590
   #define E4_OVERCURRENT    2000
1562 1591
   #define E4_STALLCURRENT   1500
1592
+  #define E4_MAX_VOLTAGE     127
1593
+  #define E4_CHAIN_POS         0
1563 1594
 
1564
-  #define E5_MICROSTEPS       16
1595
+  #define E5_MICROSTEPS      128
1565 1596
   #define E5_OVERCURRENT    2000
1566 1597
   #define E5_STALLCURRENT   1500
1598
+  #define E5_MAX_VOLTAGE     127
1599
+  #define E5_CHAIN_POS         0
1600
+
1601
+
1602
+  /**
1603
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1604
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1605
+    * Other detected conditions can be used to stop the current print.
1606
+    * Relevant g-codes:
1607
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1608
+    *         I not present or I0 or I1 - X, Y, Z or E0
1609
+    *         I2 - X2, Y2, Z2 or E1
1610
+    *         I3 - Z3 or E3
1611
+    *         I4 - E4
1612
+    *         I5 - E5
1613
+    * M916 - Increase drive level until get thermal warning
1614
+    * M917 - Find minimum current thresholds
1615
+    * M918 - Increase speed until max or error
1616
+    * M122 S0/1 - Report driver parameters
1617
+  */
1618
+  //#define MONITOR_L6470_DRIVER_STATUS
1619
+
1620
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1621
+    #define KVAL_HOLD_STEP_DOWN     1
1622
+    //#define L6470_STOP_ON_ERROR
1623
+  #endif
1624
+
1625
+  #define L6470_CHITCHAT     // enable display of additional status info
1567 1626
 
1568 1627
 #endif // L6470
1569 1628
 

+ 75
- 16
Marlin/src/config/examples/wt150/Configuration_adv.h View File

@@ -1509,62 +1509,121 @@
1509 1509
 /**
1510 1510
  * L6470 Stepper Driver options
1511 1511
  *
1512
- * The Arduino-L6470 library is required for this stepper driver.
1512
+ * Arduino-L6470 library (0.7.0 or higher) is required for this stepper driver.
1513 1513
  * https://github.com/ameyer/Arduino-L6470
1514
+ *
1515
+ * Requires the following to be defined in your pins_YOUR_BOARD file
1516
+ *     L6470_CHAIN_SCK_PIN
1517
+ *     L6470_CHAIN_MISO_PIN
1518
+ *     L6470_CHAIN_MOSI_PIN
1519
+ *     L6470_CHAIN_SS_PIN
1520
+ *     L6470_RESET_CHAIN_PIN  (optional)
1514 1521
  */
1515 1522
 #if HAS_DRIVER(L6470)
1516 1523
 
1517
-  #define X_MICROSTEPS        16 // number of microsteps
1518
-  #define X_OVERCURRENT     2000 // maxc current in mA. If the current goes over this value, the driver will switch off
1519
-  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall
1524
+  #define X_MICROSTEPS       128 // number of microsteps (VALID: 1, 2, 4, 8, 16, 32, 128 & 128)
1525
+  #define X_OVERCURRENT     2000 // current in mA where the driver will detect an over current (VALID: 375 x (1 - 16) - 6A max - rounds down)
1526
+  #define X_STALLCURRENT    1500 // current in mA where the driver will detect a stall (VALID: 31.25 * (1-128) -  4A max - rounds down)
1527
+  #define X_MAX_VOLTAGE      127 // 0-255, max effective voltage seen by stepper
1528
+  #define X_CHAIN_POS          0 // position in SPI chain, 0 - not in chain, 1- nearest MOSI
1520 1529
 
1521
-  #define X2_MICROSTEPS       16
1530
+  #define X2_MICROSTEPS      128
1522 1531
   #define X2_OVERCURRENT    2000
1523 1532
   #define X2_STALLCURRENT   1500
1533
+  #define X2_MAX_VOLTAGE     127
1534
+  #define X2_CHAIN_POS         0
1524 1535
 
1525
-  #define Y_MICROSTEPS        16
1536
+  #define Y_MICROSTEPS       128
1526 1537
   #define Y_OVERCURRENT     2000
1527 1538
   #define Y_STALLCURRENT    1500
1539
+  #define Y_MAX_VOLTAGE      127
1540
+  #define Y_CHAIN_POS          0
1528 1541
 
1529
-  #define Y2_MICROSTEPS       16
1542
+  #define Y2_MICROSTEPS      128
1530 1543
   #define Y2_OVERCURRENT    2000
1531 1544
   #define Y2_STALLCURRENT   1500
1545
+  #define Y2_MAX_VOLTAGE     127
1546
+  #define Y2_CHAIN_POS         0
1532 1547
 
1533
-  #define Z_MICROSTEPS        16
1548
+  #define Z_MICROSTEPS       128
1534 1549
   #define Z_OVERCURRENT     2000
1535 1550
   #define Z_STALLCURRENT    1500
1551
+  #define Z_MAX_VOLTAGE      127
1552
+  #define Z_CHAIN_POS          0
1536 1553
 
1537
-  #define Z2_MICROSTEPS       16
1554
+  #define Z2_MICROSTEPS      128
1538 1555
   #define Z2_OVERCURRENT    2000
1539 1556
   #define Z2_STALLCURRENT   1500
1557
+  #define Z2_MAX_VOLTAGE     127
1558
+  #define Z2_CHAIN_POS         0
1540 1559
 
1541
-  #define Z3_MICROSTEPS       16
1560
+  #define Z3_MICROSTEPS      128
1542 1561
   #define Z3_OVERCURRENT    2000
1543 1562
   #define Z3_STALLCURRENT   1500
1563
+  #define Z3_MAX_VOLTAGE     127
1564
+  #define Z3_CHAIN_POS         0
1544 1565
 
1545
-  #define E0_MICROSTEPS       16
1566
+  #define E0_MICROSTEPS      128
1546 1567
   #define E0_OVERCURRENT    2000
1547 1568
   #define E0_STALLCURRENT   1500
1569
+  #define E0_MAX_VOLTAGE     127
1570
+  #define E0_CHAIN_POS         0
1548 1571
 
1549
-  #define E1_MICROSTEPS       16
1572
+  #define E1_MICROSTEPS      128
1550 1573
   #define E1_OVERCURRENT    2000
1551 1574
   #define E1_STALLCURRENT   1500
1575
+  #define E1_MAX_VOLTAGE     127
1576
+  #define E1_CHAIN_POS         0
1552 1577
 
1553
-  #define E2_MICROSTEPS       16
1578
+  #define E2_MICROSTEPS      128
1554 1579
   #define E2_OVERCURRENT    2000
1555 1580
   #define E2_STALLCURRENT   1500
1581
+  #define E2_MAX_VOLTAGE     127
1582
+  #define E2_CHAIN_POS         0
1556 1583
 
1557
-  #define E3_MICROSTEPS       16
1584
+  #define E3_MICROSTEPS      128
1558 1585
   #define E3_OVERCURRENT    2000
1559 1586
   #define E3_STALLCURRENT   1500
1587
+  #define E3_MAX_VOLTAGE     127
1588
+  #define E3_CHAIN_POS         0
1560 1589
 
1561
-  #define E4_MICROSTEPS       16
1590
+  #define E4_MICROSTEPS      128
1562 1591
   #define E4_OVERCURRENT    2000
1563 1592
   #define E4_STALLCURRENT   1500
1593
+  #define E4_MAX_VOLTAGE     127
1594
+  #define E4_CHAIN_POS         0
1564 1595
 
1565
-  #define E5_MICROSTEPS       16
1596
+  #define E5_MICROSTEPS      128
1566 1597
   #define E5_OVERCURRENT    2000
1567 1598
   #define E5_STALLCURRENT   1500
1599
+  #define E5_MAX_VOLTAGE     127
1600
+  #define E5_CHAIN_POS         0
1601
+
1602
+
1603
+  /**
1604
+    * Monitor L6470 drivers for error conditions like over temperature and over current.
1605
+    * In the case of over temperature Marlin can decrease the drive until the error condition clears.
1606
+    * Other detected conditions can be used to stop the current print.
1607
+    * Relevant g-codes:
1608
+    * M906 - I1/2/3/4/5  Set or get motor drive level using axis codes X, Y, Z, E. Report values if no axis codes given.
1609
+    *         I not present or I0 or I1 - X, Y, Z or E0
1610
+    *         I2 - X2, Y2, Z2 or E1
1611
+    *         I3 - Z3 or E3
1612
+    *         I4 - E4
1613
+    *         I5 - E5
1614
+    * M916 - Increase drive level until get thermal warning
1615
+    * M917 - Find minimum current thresholds
1616
+    * M918 - Increase speed until max or error
1617
+    * M122 S0/1 - Report driver parameters
1618
+  */
1619
+  //#define MONITOR_L6470_DRIVER_STATUS
1620
+
1621
+  #if ENABLED(MONITOR_L6470_DRIVER_STATUS)
1622
+    #define KVAL_HOLD_STEP_DOWN     1
1623
+    //#define L6470_STOP_ON_ERROR
1624
+  #endif
1625
+
1626
+  #define L6470_CHITCHAT     // enable display of additional status info
1568 1627
 
1569 1628
 #endif // L6470
1570 1629
 

+ 4
- 0
Marlin/src/core/enum.h View File

@@ -43,6 +43,10 @@ enum AxisEnum : unsigned char {
43 43
   NO_AXIS   = 0xFF
44 44
 };
45 45
 
46
+#if HAS_DRIVER(L6470)
47
+  enum L6470_driver_enum : unsigned char { X, Y, Z, X2, Y2, Z2, Z3, E0, E1, E2, E3, E4, E5 };
48
+#endif
49
+
46 50
 #define LOOP_S_LE_N(VAR, S, N) for (uint8_t VAR=(S); VAR<=(N); VAR++)
47 51
 #define LOOP_S_L_N(VAR, S, N) for (uint8_t VAR=(S); VAR<(N); VAR++)
48 52
 #define LOOP_LE_N(VAR, N) LOOP_S_LE_N(VAR, 0, N)

+ 7
- 0
Marlin/src/core/utility.cpp View File

@@ -441,3 +441,10 @@ void safe_delay(millis_t ms) {
441 441
   }
442 442
 
443 443
 #endif // DEBUG_LEVELING_FEATURE
444
+
445
+void print_bin(const uint16_t val) {
446
+  for (uint8_t i = 16; i--;) {
447
+    SERIAL_ECHO(TEST(val, i));
448
+    if (!(i & 0x3)) SERIAL_CHAR(' ');
449
+  }
450
+}

+ 2
- 0
Marlin/src/core/utility.h View File

@@ -119,3 +119,5 @@ inline void serial_delay(const millis_t ms) {
119 119
 #if ENABLED(DEBUG_LEVELING_FEATURE)
120 120
   void log_machine_info();
121 121
 #endif
122
+
123
+void print_bin(const uint16_t val);

+ 1
- 1
Marlin/src/feature/pause.cpp View File

@@ -294,7 +294,7 @@ bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/,
294 294
   #endif
295 295
 
296 296
   // Disable extruders steppers for manual filament changing (only on boards that have separate ENABLE_PINS)
297
-  #if (E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN) || AXIS_DRIVER_TYPE(E0, TMC2660) || AXIS_DRIVER_TYPE(E1, TMC2660) || AXIS_DRIVER_TYPE(E2, TMC2660) || AXIS_DRIVER_TYPE(E3, TMC2660) || AXIS_DRIVER_TYPE(E4, TMC2660) || AXIS_DRIVER_TYPE(E5, TMC2660)
297
+  #if (E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN) || AXIS_DRIVER_TYPE_E0(TMC2660) || AXIS_DRIVER_TYPE_E1(TMC2660) || AXIS_DRIVER_TYPE_E2(TMC2660) || AXIS_DRIVER_TYPE_E3(TMC2660) || AXIS_DRIVER_TYPE_E4(TMC2660) || AXIS_DRIVER_TYPE_E5(TMC2660)
298 298
     disable_e_stepper(active_extruder);
299 299
     safe_delay(100);
300 300
   #endif

+ 12
- 0
Marlin/src/gcode/calibrate/G28.cpp View File

@@ -45,6 +45,10 @@
45 45
 
46 46
 #include "../../lcd/ultralcd.h"
47 47
 
48
+#if HAS_DRIVER(L6470)                         // set L6470 absolute position registers to counts
49
+  #include "../../libs/L6470/L6470_Marlin.h"
50
+#endif
51
+
48 52
 #if ENABLED(QUICK_HOME)
49 53
 
50 54
   static void quick_home_xy() {
@@ -440,4 +444,12 @@ void GcodeSuite::G28(const bool always_home_all) {
440 444
   #if ENABLED(DEBUG_LEVELING_FEATURE)
441 445
     if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("<<< G28");
442 446
   #endif
447
+
448
+  #if HAS_DRIVER(L6470)
449
+    // Set L6470 absolute position registers to counts
450
+    for (uint8_t j = 1; j <= L6470::chain[0]; j++) {
451
+      const uint8_t cv = L6470::chain[j];
452
+      L6470.set_param(cv, L6470_ABS_POS, stepper.position((AxisEnum)L6470.axis_xref[cv]));
453
+    }
454
+  #endif
443 455
 }

+ 1
- 1
Marlin/src/gcode/control/M17_M18_M84.cpp View File

@@ -55,7 +55,7 @@ void GcodeSuite::M18_M84() {
55 55
       if (parser.seen('Y')) disable_Y();
56 56
       if (parser.seen('Z')) disable_Z();
57 57
       // Only disable on boards that have separate ENABLE_PINS or another method for disabling the driver
58
-      #if (E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN) || AXIS_DRIVER_TYPE(E0, TMC2660) || AXIS_DRIVER_TYPE(E1, TMC2660) || AXIS_DRIVER_TYPE(E2, TMC2660) || AXIS_DRIVER_TYPE(E3, TMC2660) || AXIS_DRIVER_TYPE(E4, TMC2660) || AXIS_DRIVER_TYPE(E5, TMC2660)
58
+      #if (E0_ENABLE_PIN != X_ENABLE_PIN && E1_ENABLE_PIN != Y_ENABLE_PIN) || AXIS_DRIVER_TYPE_E0(TMC2660) || AXIS_DRIVER_TYPE_E1(TMC2660) || AXIS_DRIVER_TYPE_E2(TMC2660) || AXIS_DRIVER_TYPE_E3(TMC2660) || AXIS_DRIVER_TYPE_E4(TMC2660) || AXIS_DRIVER_TYPE_E5(TMC2660)
59 59
         if (parser.seen('E')) disable_e_steppers();
60 60
       #endif
61 61
     }

+ 115
- 0
Marlin/src/gcode/feature/L6470/M122.cpp View File

@@ -0,0 +1,115 @@
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
+
23
+#include "../../../inc/MarlinConfig.h"
24
+
25
+#if HAS_DRIVER(L6470)
26
+
27
+#include "../../gcode.h"
28
+#include "../../../libs/L6470/L6470_Marlin.h"
29
+#include "../../../module/stepper_indirection.h"
30
+
31
+inline void echo_yes_no(const bool yes) { serialprintPGM(yes ? PSTR(" YES") : PSTR(" NO ")); }
32
+
33
+void L6470_status_decode(const uint16_t status, const uint8_t axis) {
34
+  if (L6470.spi_abort) return;  // don't do anything if set_directions() has occurred
35
+  L6470.say_axis(axis);
36
+  #if ENABLED(L6470_CHITCHAT)
37
+    char temp_buf[20];
38
+    sprintf_P(temp_buf, PSTR("   status: %4x   "), status);
39
+    SERIAL_ECHO(temp_buf);
40
+    print_bin(status);
41
+  #endif
42
+  SERIAL_ECHOPGM("\n...OUTPUT: ");
43
+  serialprintPGM(status & STATUS_HIZ ? PSTR("OFF") : PSTR("ON "));
44
+  SERIAL_ECHOPGM("   BUSY: "); echo_yes_no(!(status & STATUS_BUSY));
45
+  SERIAL_ECHOPGM("   DIR: ");
46
+  serialprintPGM((((status & STATUS_DIR) >> 4) ^ L6470.index_to_dir[axis]) ? PSTR("FORWARD") : PSTR("REVERSE"));
47
+  SERIAL_ECHOPGM("   Last Command: ");
48
+  if (status & STATUS_WRONG_CMD) SERIAL_ECHOPGM("IN");
49
+  SERIAL_ECHOPGM("VALID    ");
50
+  serialprintPGM(status & STATUS_NOTPERF_CMD ? PSTR("Not PERFORMED") : PSTR("COMPLETED    "));
51
+  SERIAL_ECHOPAIR("\n...THERMAL: ", !(status & STATUS_TH_SD) ? "SHUTDOWN" : !(status & STATUS_TH_WRN) ? "WARNING " : "OK      ");
52
+  SERIAL_ECHOPGM("   OVERCURRENT:"); echo_yes_no(!(status & STATUS_OCD));
53
+  SERIAL_ECHOPGM("   STALL:"); echo_yes_no(!(status & STATUS_STEP_LOSS_A) || !(status & STATUS_STEP_LOSS_B));
54
+  SERIAL_ECHOPGM("   STEP-CLOCK MODE:"); echo_yes_no(status & STATUS_SCK_MOD);
55
+  SERIAL_EOL();
56
+}
57
+
58
+/**
59
+ * M122: Debug L6470 drivers
60
+ */
61
+void GcodeSuite::M122() {
62
+
63
+  L6470.spi_active = true;    // let set_directions() know we're in the middle of a series of SPI transfers
64
+
65
+  #define L6470_SAY_STATUS(Q) L6470_status_decode(stepper##Q.getStatus(), Q)
66
+
67
+  //if (parser.seen('S'))
68
+  // tmc_set_report_status(parser.value_bool());
69
+  //else
70
+
71
+  #if AXIS_DRIVER_TYPE_X(L6470)
72
+    L6470_SAY_STATUS(X);
73
+  #endif
74
+  #if AXIS_DRIVER_TYPE_X2(L6470)
75
+    L6470_SAY_STATUS(X2);
76
+  #endif
77
+  #if AXIS_DRIVER_TYPE_Y(L6470)
78
+    L6470_SAY_STATUS(Y);
79
+  #endif
80
+  #if AXIS_DRIVER_TYPE_Y2(L6470)
81
+    L6470_SAY_STATUS(Y2);
82
+  #endif
83
+  #if AXIS_DRIVER_TYPE_Z(L6470)
84
+    L6470_SAY_STATUS(Z);
85
+  #endif
86
+  #if AXIS_DRIVER_TYPE_Z2(L6470)
87
+    L6470_SAY_STATUS(Z2);
88
+  #endif
89
+  #if AXIS_DRIVER_TYPE_Z3(L6470)
90
+    L6470_SAY_STATUS(Z3);
91
+  #endif
92
+  #if AXIS_DRIVER_TYPE_E0(L6470)
93
+    L6470_SAY_STATUS(E0);
94
+  #endif
95
+  #if AXIS_DRIVER_TYPE_E1(L6470)
96
+    L6470_SAY_STATUS(E1);
97
+  #endif
98
+  #if AXIS_DRIVER_TYPE_E2(L6470)
99
+    L6470_SAY_STATUS(E2);
100
+  #endif
101
+  #if AXIS_DRIVER_TYPE_E3(L6470)
102
+    L6470_SAY_STATUS(E3);
103
+  #endif
104
+  #if AXIS_DRIVER_TYPE_E4(L6470)
105
+    L6470_SAY_STATUS(E4);
106
+  #endif
107
+  #if AXIS_DRIVER_TYPE_E5(L6470)
108
+    L6470_SAY_STATUS(E5);
109
+  #endif
110
+
111
+  L6470.spi_active = false;   // done with all SPI transfers - clear handshake flags
112
+  L6470.spi_abort = false;
113
+}
114
+
115
+#endif // HAS_DRIVER(L6470)

+ 259
- 0
Marlin/src/gcode/feature/L6470/M906.cpp View File

@@ -0,0 +1,259 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2018 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
+
23
+#include "../../../inc/MarlinConfig.h"
24
+
25
+#if HAS_DRIVER(L6470)
26
+
27
+#include "../../gcode.h"
28
+#include "../../../libs/L6470/L6470_Marlin.h"
29
+#include "../../../module/stepper_indirection.h"
30
+#include "../../../module/planner.h"
31
+
32
+/**
33
+ *
34
+ * M906: report or set KVAL_HOLD which sets the maximum effective voltage provided by the
35
+ *       PWMs to the steppers
36
+ *
37
+ * J - select which driver(s) to monitor on multi-driver axis
38
+ *     0 - (default) monitor all drivers on the axis or E0
39
+ *     1 - monitor only X, Y, Z or E1
40
+ *     2 - monitor only X2, Y2, Z2 or E2
41
+ *     3 - monitor only Z3 or E3
42
+ *     4 - monitor only E4
43
+ *     5 - monitor only E5
44
+ * Xxxx, Yxxx, Zxxx, Exxx - axis to be monitored with displacement
45
+ *     xxx (1-255) is distance moved on either side of current position
46
+ *
47
+ * I - over current threshold
48
+ *     optional - will report current value from driver if not specified
49
+ *
50
+ * K - value for KVAL_HOLD (0 - 255) (optional)
51
+ *     optional - will report current value from driver if not specified
52
+ *
53
+ */
54
+
55
+/**
56
+ * Sets KVAL_HOLD wich affects the current being driven through the stepper.
57
+ *
58
+ * L6470 is used in the STEP-CLOCK mode.  KVAL_HOLD is the only KVAL_xxx
59
+ * that affects the effective voltage seen by the stepper.
60
+ *
61
+ */
62
+
63
+/**
64
+ * MACRO to fetch information on the items associated with current limiting
65
+ * and maximum voltage output.
66
+ *
67
+ * L6470 can be setup to shutdown if either current threshold is exceeded.
68
+ *
69
+ * L6470 output current can not be set directly.  It is set indirectly by
70
+ * setting the maximum effective output voltage.
71
+ *
72
+ *  Effective output voltage is set by PWM duty cycle.
73
+ *
74
+ *  Maximum effective output voltage is affected by MANY variables.  The main ones are:
75
+ *    KVAL_HOLD
76
+ *    KVAL_RUN
77
+ *    KVAL_ACC
78
+ *    KVAL_DEC
79
+ *    Vs compensation (if enabled)
80
+ */
81
+
82
+void L6470_report_current(L6470 &motor, const uint8_t axis) {
83
+  if (L6470.spi_abort) return;  // don't do anything if set_directions() has occurred
84
+  const uint16_t status = motor.getStatus() ;
85
+  const uint8_t overcurrent_threshold = (uint8_t)motor.GetParam(L6470_OCD_TH),
86
+                stall_threshold = (uint8_t)motor.GetParam(L6470_STALL_TH),
87
+                motor_status = (status  & (STATUS_MOT_STATUS)) >> 13,
88
+                adc_out = motor.GetParam(L6470_ADC_OUT),
89
+                adc_out_limited = constrain(adc_out, 8, 24);
90
+  const float comp_coef = 1600.0f / adc_out_limited;
91
+  const int microsteps = _BV(motor.GetParam(L6470_STEP_MODE) & 0x07);
92
+  char temp_buf[80];
93
+  L6470.say_axis(axis);
94
+  #if ENABLED(L6470_CHITCHAT)
95
+    sprintf_P(temp_buf, PSTR("   status: %4x   "), status);
96
+    SERIAL_ECHO(temp_buf);
97
+    print_bin(status);
98
+  #endif
99
+  sprintf_P(temp_buf, PSTR("\n...OverCurrent Threshold: %2d (%4d mA)"), overcurrent_threshold, (overcurrent_threshold + 1) * 375);
100
+  SERIAL_ECHO(temp_buf);
101
+  sprintf_P(temp_buf, PSTR("   Stall Threshold: %2d (%7.2f mA)"), stall_threshold, (stall_threshold + 1) * 31.25);
102
+  SERIAL_ECHO(temp_buf);
103
+  SERIAL_ECHOPGM("   Motor Status: ");
104
+  const char * const stat_str;
105
+  switch (motor_status) {
106
+    default:
107
+    case 0: stat_str = PSTR("stopped"); break;
108
+    case 1: stat_str = PSTR("accelerating"); break;
109
+    case 2: stat_str = PSTR("decelerating"); break;
110
+    case 3: stat_str = PSTR("at constant speed"); break;
111
+  }
112
+  serialprintPGM(stat_str);
113
+  SERIAL_EOL();
114
+  SERIAL_ECHOPAIR("...microsteps: ", microsteps);
115
+  SERIAL_ECHOPAIR("   ADC_OUT: ", adc_out);
116
+  SERIAL_ECHOPGM("   Vs_compensation: ");
117
+  serialprintPGM((motor.GetParam(L6470_CONFIG) & CONFIG_EN_VSCOMP) ? PSTR("ENABLED ") : PSTR("DISABLED"));
118
+  sprintf_P(temp_buf, PSTR("   Compensation coefficient: ~%4.2f\n"), comp_coef * 0.01f);
119
+  SERIAL_ECHO(temp_buf);
120
+  SERIAL_ECHOPAIR("...KVAL_HOLD: ", motor.GetParam(L6470_KVAL_HOLD));
121
+  SERIAL_ECHOPAIR("   KVAL_RUN : ", motor.GetParam(L6470_KVAL_RUN));
122
+  SERIAL_ECHOPAIR("   KVAL_ACC: ", motor.GetParam(L6470_KVAL_ACC));
123
+  SERIAL_ECHOPAIR("   KVAL_DEC: ", motor.GetParam(L6470_KVAL_DEC));
124
+  SERIAL_ECHOPGM("   V motor max =  ");
125
+  switch (motor_status) {
126
+    case 0: sprintf_P(temp_buf, PSTR(" %4.1f%% (KVAL_HOLD)\n"), float(motor.GetParam(L6470_KVAL_HOLD)) * 100 / 256); break;
127
+    case 1: sprintf_P(temp_buf, PSTR(" %4.1f%% (KVAL_RUN) \n"), float(motor.GetParam(L6470_KVAL_RUN)) * 100 / 256); break;
128
+    case 2: sprintf_P(temp_buf, PSTR(" %4.1f%% (KVAL_ACC) \n"), float(motor.GetParam(L6470_KVAL_ACC)) * 100 / 256); break;
129
+    case 3: sprintf_P(temp_buf, PSTR(" %4.1f%% (KVAL_DEC) \n"), float(motor.GetParam(L6470_KVAL_DEC)) * 100 / 256); break;
130
+  }
131
+  SERIAL_ECHO(temp_buf);
132
+}
133
+
134
+void GcodeSuite::M906() {
135
+  #define L6470_SET_KVAL_HOLD(Q) stepper##Q.SetParam(L6470_KVAL_HOLD, value)
136
+
137
+  L6470_ECHOLNPGM("M906");
138
+
139
+  bool report_current = true;
140
+
141
+  #if HAS_DRIVER(L6470)
142
+    const uint8_t index = parser.byteval('I');
143
+  #endif
144
+
145
+  LOOP_XYZE(i) if (uint8_t value = parser.byteval(axis_codes[i])) {
146
+
147
+    report_current = false;
148
+
149
+    if (planner.has_blocks_queued() || planner.cleaning_buffer_counter) {
150
+      SERIAL_ECHOLNPGM("ERROR - can't set KVAL_HOLD while steppers are moving");
151
+      return;
152
+    }
153
+
154
+    switch (i) {
155
+      case X_AXIS:
156
+        #if AXIS_DRIVER_TYPE_X(L6470)
157
+          if (index == 0) L6470_SET_KVAL_HOLD(X);
158
+        #endif
159
+        #if AXIS_DRIVER_TYPE_X2(L6470)
160
+          if (index == 1) L6470_SET_KVAL_HOLD(X2);
161
+        #endif
162
+        break;
163
+      case Y_AXIS:
164
+        #if AXIS_DRIVER_TYPE_Y(L6470)
165
+          if (index == 0) L6470_SET_KVAL_HOLD(Y);
166
+        #endif
167
+        #if AXIS_DRIVER_TYPE_Y2(L6470)
168
+          if (index == 1) L6470_SET_KVAL_HOLD(Y2);
169
+        #endif
170
+        break;
171
+      case Z_AXIS:
172
+        #if AXIS_DRIVER_TYPE_Z(L6470)
173
+          if (index == 0) L6470_SET_KVAL_HOLD(Z);
174
+        #endif
175
+        #if AXIS_DRIVER_TYPE_Z2(L6470)
176
+          if (index == 1) L6470_SET_KVAL_HOLD(Z2);
177
+        #endif
178
+        #if AXIS_DRIVER_TYPE_Z3(L6470)
179
+          if (index == 2) L6470_SET_KVAL_HOLD(Z3);
180
+        #endif
181
+        break;
182
+      case E_AXIS: {
183
+        const int8_t target_extruder = get_target_extruder_from_command();
184
+        if (target_extruder < 0) return;
185
+        switch (target_extruder) {
186
+          #if AXIS_DRIVER_TYPE_E0(L6470)
187
+            case 0: L6470_SET_KVAL_HOLD(E0); break;
188
+          #endif
189
+          #if AXIS_DRIVER_TYPE_E1(L6470)
190
+            case 1: L6470_SET_KVAL_HOLD(E1); break;
191
+          #endif
192
+          #if AXIS_DRIVER_TYPE_E2(L6470)
193
+            case 2: L6470_SET_KVAL_HOLD(E2); break;
194
+          #endif
195
+          #if AXIS_DRIVER_TYPE_E3(L6470)
196
+            case 3: L6470_SET_KVAL_HOLD(E3); break;
197
+          #endif
198
+          #if AXIS_DRIVER_TYPE_E4(L6470)
199
+            case 4: L6470_SET_KVAL_HOLD(E4); break;
200
+          #endif
201
+          #if AXIS_DRIVER_TYPE_E5(L6470)
202
+            case 5: L6470_SET_KVAL_HOLD(E5); break;
203
+          #endif
204
+        }
205
+      } break;
206
+    }
207
+  }
208
+
209
+  if (report_current) {
210
+    #define L6470_REPORT_CURRENT(Q) L6470_report_current(stepper##Q, Q)
211
+
212
+    L6470.spi_active = true;    // let set_directions() know we're in the middle of a series of SPI transfers
213
+
214
+    #if AXIS_DRIVER_TYPE_X(L6470)
215
+      L6470_REPORT_CURRENT(X);
216
+    #endif
217
+    #if AXIS_DRIVER_TYPE_X2(L6470)
218
+      L6470_REPORT_CURRENT(X2);
219
+    #endif
220
+    #if AXIS_DRIVER_TYPE_Y(L6470)
221
+      L6470_REPORT_CURRENT(Y);
222
+    #endif
223
+    #if AXIS_DRIVER_TYPE_Y2(L6470)
224
+      L6470_REPORT_CURRENT(Y2);
225
+    #endif
226
+    #if AXIS_DRIVER_TYPE_Z(L6470)
227
+      L6470_REPORT_CURRENT(Z);
228
+    #endif
229
+    #if AXIS_DRIVER_TYPE_Z2(L6470)
230
+      L6470_REPORT_CURRENT(Z2);
231
+    #endif
232
+    #if AXIS_DRIVER_TYPE_Z3(L6470)
233
+      L6470_REPORT_CURRENT(Z3);
234
+    #endif
235
+    #if AXIS_DRIVER_TYPE_E0(L6470)
236
+      L6470_REPORT_CURRENT(E0);
237
+    #endif
238
+    #if AXIS_DRIVER_TYPE_E1(L6470)
239
+      L6470_REPORT_CURRENT(E1);
240
+    #endif
241
+    #if AXIS_DRIVER_TYPE_E2(L6470)
242
+      L6470_REPORT_CURRENT(E2);
243
+    #endif
244
+    #if AXIS_DRIVER_TYPE_E3(L6470)
245
+      L6470_REPORT_CURRENT(E3);
246
+    #endif
247
+    #if AXIS_DRIVER_TYPE_E4(L6470)
248
+      L6470_REPORT_CURRENT(E4);
249
+    #endif
250
+    #if AXIS_DRIVER_TYPE_E5(L6470)
251
+      L6470_REPORT_CURRENT(E5);
252
+    #endif
253
+
254
+    L6470.spi_active = false;   // done with all SPI transfers - clear handshake flags
255
+    L6470.spi_abort = false;
256
+  }
257
+}
258
+
259
+#endif // HAS_DRIVER(L6470)

+ 544
- 0
Marlin/src/gcode/feature/L6470/M916-918.cpp View File

@@ -0,0 +1,544 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2018 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
+
23
+#include "../../../inc/MarlinConfig.h"
24
+
25
+#if HAS_DRIVER(L6470)
26
+
27
+#include "../../gcode.h"
28
+#include "../../../module/stepper_indirection.h"
29
+#include "../../../module/planner.h"
30
+#include "../../../libs/L6470/L6470_Marlin.h"
31
+
32
+/**
33
+ *
34
+ * M916: increase KVAL_HOLD until get thermal warning
35
+ *
36
+ *
37
+ * J - select which driver(s) to monitor on multi-driver axis
38
+ *     0 - (default) monitor all drivers on the axis or E0
39
+ *     1 - monitor only X, Y, Z, E1
40
+ *     2 - monitor only X2, Y2, Z2, E2
41
+ *     3 - monitor only Z3, E3
42
+ *
43
+ * Xxxx, Yxxx, Zxxx, Exxx - axis to be monitored with displacement
44
+ *     xxx (1-255) is distance moved on either side of current position
45
+ *
46
+ * F - feedrate
47
+ *     optional - will use default max feedrate from configuration.h if not specified
48
+ *
49
+ * K - starting value for KVAL_HOLD (0 - 255)
50
+ *     optional - will use & report current value from driver if not specified
51
+ *
52
+ */
53
+
54
+/**
55
+ * This routine is also useful for determining the approximate KVAL_HOLD
56
+ * where the stepper stops losing steps. The sound will get noticeably quieter
57
+ * as it stops losing steps.
58
+ */
59
+
60
+void GcodeSuite::M916() {
61
+
62
+  L6470_ECHOLNPGM("M916");
63
+
64
+  // Variables used by L6470_get_user_input function - some may not be used
65
+  char axis_mon[3][3] = { "  ", "  ", "  " };  // list of Axes to be monitored
66
+  uint8_t axis_index[3];
67
+  uint16_t axis_status[3];
68
+  uint8_t driver_count = 1;
69
+  float position_max;
70
+  float position_min;
71
+  float final_feedrate;
72
+  uint8_t kval_hold;
73
+  uint8_t ocd_th_val = 0;
74
+  uint8_t stall_th_val = 0;
75
+  uint16_t over_current_threshold;
76
+  constexpr bool over_current_flag = false;  // M916 doesn't play with the overcurrent thresholds
77
+
78
+  uint8_t j;   // general purpose counter
79
+
80
+  if (L6470.get_user_input(driver_count, axis_index, axis_mon, position_max, position_min, final_feedrate, kval_hold, over_current_flag, ocd_th_val, stall_th_val, over_current_threshold))
81
+    return;  // quit if invalid user input
82
+
83
+  L6470_ECHOLNPAIR("feedrate = ", final_feedrate);
84
+
85
+  planner.synchronize();                             // wait for all current movement commands to complete
86
+
87
+  for (j = 0; j < driver_count; j++)
88
+    L6470.get_status(axis_index[j]);  // clear out any pre-existing error flags
89
+
90
+  char temp_axis_string[] = " ";
91
+  temp_axis_string[0] = axis_mon[0][0];  // need to have a string for use within sprintf format section
92
+  char gcode_string[80];
93
+  uint16_t status_composite = 0;
94
+
95
+  L6470_ECHOLNPGM(".\n.");
96
+
97
+  do {
98
+
99
+    L6470_ECHOLNPAIR("kval_hold = ", kval_hold);   // set & report KVAL_HOLD for this run
100
+
101
+    for (j = 0; j < driver_count; j++)
102
+      L6470.set_param(axis_index[j], L6470_KVAL_HOLD, kval_hold);
103
+
104
+    // turn the motor(s) both directions
105
+    sprintf_P(gcode_string, PSTR("G0 %s%4.3f  F%4.3f"), temp_axis_string, position_min, final_feedrate);
106
+    gcode.process_subcommands_now_P(gcode_string);
107
+
108
+    sprintf_P(gcode_string, PSTR("G0 %s%4.3f  F%4.3f"), temp_axis_string, position_max, final_feedrate);
109
+    gcode.process_subcommands_now_P(gcode_string);
110
+
111
+    // get the status after the motors have stopped
112
+    planner.synchronize();
113
+
114
+    status_composite = 0;    // clear out the old bits
115
+
116
+    for (j = 0; j < driver_count; j++) {
117
+      axis_status[j] = (~L6470.get_status(axis_index[j])) & L6470_ERROR_MASK;    // bits of interest are all active low
118
+      status_composite |= axis_status[j] ;
119
+    }
120
+
121
+    if (status_composite && (status_composite & STATUS_UVLO)) {
122
+      L6470_ECHOLNPGM("Test aborted (Undervoltage lockout active)");
123
+      for (j = 0; j < driver_count; j++) {
124
+        L6470_ECHOPGM("...");
125
+        L6470.error_status_decode(axis_status[j], axis_index[j]);
126
+      }
127
+      return;
128
+    }
129
+
130
+    // increment KVAL_HOLD if not yet at thermal warning/shutdown
131
+    if (!(status_composite & (STATUS_TH_WRN | STATUS_TH_SD)))
132
+      kval_hold++;
133
+
134
+  } while (!(status_composite & (STATUS_TH_WRN | STATUS_TH_SD)) && kval_hold);  // exit when kval_hold == 0 (rolls over)
135
+
136
+  L6470_ECHOPGM(".\n.\nThermal warning/shutdown ");
137
+  if ((status_composite & (STATUS_TH_WRN | STATUS_TH_SD))) {
138
+    L6470_ECHOLNPGM("has occurred");
139
+    for (j = 0; j < driver_count; j++) {
140
+      L6470_ECHOPGM("...");
141
+      L6470.error_status_decode(axis_status[j], axis_index[j]);
142
+    }
143
+  }
144
+  else
145
+    L6470_ECHOLNPGM("(Unable to get)");
146
+
147
+  L6470_ECHOLNPGM(".");
148
+}
149
+
150
+/**
151
+ *
152
+ * M917: Find minimum current thresholds
153
+ *
154
+ *   Decrease OCD current until overcurrent error
155
+ *   Increase OCD until overcurrent error goes away
156
+ *   Decrease stall threshold until stall
157
+ *   Increase stall until stall error goes away
158
+ *
159
+ * J - select which driver(s) to monitor on multi-driver axis
160
+ *     0 - (default) monitor all drivers on the axis or E0
161
+ *     1 - monitor only X, Y, Z, E1
162
+ *     2 - monitor only X2, Y2, Z2, E2
163
+ * Xxxx, Yxxx, Zxxx, Exxx - axis to be monitored with displacement
164
+ *     xxx (1-255) is distance moved on either side of current position
165
+ *
166
+ * F - feedrate
167
+ *     optional - will use default max feedrate from Configuration.h if not specified
168
+ *
169
+ * I - starting over-current threshold
170
+ *     optional - will report current value from driver if not specified
171
+ *     if there are multiple drivers on the axis then all will be set the same
172
+ *
173
+ * K - value for KVAL_HOLD (0 - 255)
174
+ *     optional - will report current value from driver if not specified
175
+ *
176
+ */
177
+void GcodeSuite::M917() {
178
+
179
+  L6470_ECHOLNPGM("M917");
180
+
181
+  char axis_mon[3][3] = { "  ", "  ", "  " };  // list of axes to be monitored
182
+  uint8_t axis_index[3];
183
+  uint16_t axis_status[3];
184
+  uint8_t driver_count = 1;
185
+  float position_max;
186
+  float position_min;
187
+  float final_feedrate;
188
+  uint8_t kval_hold;
189
+  uint8_t ocd_th_val = 0;
190
+  uint8_t stall_th_val = 0;
191
+  uint16_t over_current_threshold;
192
+  constexpr bool over_current_flag = true;
193
+
194
+  uint8_t j;   // general purpose counter
195
+
196
+  if (L6470.get_user_input(driver_count, axis_index, axis_mon, position_max, position_min, final_feedrate, kval_hold, over_current_flag, ocd_th_val, stall_th_val, over_current_threshold))
197
+    return;  // quit if invalid user input
198
+
199
+  L6470_ECHOLNPAIR("feedrate = ", final_feedrate);
200
+
201
+  planner.synchronize();                             // wait for all current movement commands to complete
202
+  for (j = 0; j < driver_count; j++)
203
+    L6470.get_status(axis_index[j]);  // clear out any pre-existing error flags
204
+  char temp_axis_string[] = " ";
205
+  temp_axis_string[0] = axis_mon[0][0];  // need to have a string for use within sprintf format section
206
+  char gcode_string[80];
207
+  uint16_t status_composite = 0;
208
+  uint8_t test_phase = 0;
209
+        // 0 - decreasing OCD - exit when OCD warning occurs (ignore STALL)
210
+        // 1 - increasing OCD - exit when OCD warning stops (ignore STALL) -
211
+        // 2 - OCD finalized - decreasing STALL - exit when STALL warning happens
212
+        // 3 - OCD finalized - increasing STALL - exit when STALL warning stop
213
+        // 4 - all testing completed
214
+  L6470_ECHOPAIR(".\n.\n.\nover_current threshold : ", (ocd_th_val + 1) * 375);   // first status display
215
+  L6470_ECHOPAIR("  (OCD_TH:  : ", ocd_th_val);
216
+  L6470_ECHOPAIR(")   Stall threshold: ", (stall_th_val + 1) * 31.25);
217
+  L6470_ECHOPAIR("  (STALL_TH: ", stall_th_val);
218
+  L6470_ECHOLNPGM(")");
219
+
220
+  do {
221
+
222
+    L6470_ECHOPAIR("STALL threshold : ", (stall_th_val + 1) * 31.25);
223
+    L6470_ECHOLNPAIR("   OCD threshold : ", (ocd_th_val + 1) * 375);
224
+
225
+    sprintf_P(gcode_string, PSTR("G0 %s%4.3f  F%4.3f"), temp_axis_string, position_min, final_feedrate);
226
+    gcode.process_subcommands_now_P(gcode_string);
227
+
228
+    sprintf_P(gcode_string, PSTR("G0 %s%4.3f  F%4.3f"), temp_axis_string, position_max, final_feedrate);
229
+    gcode.process_subcommands_now_P(gcode_string);
230
+
231
+    planner.synchronize();
232
+
233
+    status_composite = 0;    // clear out the old bits
234
+
235
+    for (j = 0; j < driver_count; j++) {
236
+      axis_status[j] = (~L6470.get_status(axis_index[j])) & L6470_ERROR_MASK;    // bits of interest are all active low
237
+      status_composite |= axis_status[j];
238
+    }
239
+
240
+    if (status_composite && (status_composite & STATUS_UVLO)) {
241
+      L6470_ECHOLNPGM("Test aborted (Undervoltage lockout active)");
242
+      for (j = 0; j < driver_count; j++) {
243
+        L6470_ECHOPGM("...");
244
+        L6470.error_status_decode(axis_status[j], axis_index[j]);
245
+      }
246
+      return;
247
+    }
248
+
249
+    if (status_composite & (STATUS_TH_WRN | STATUS_TH_SD)) {
250
+      L6470_ECHOLNPGM("thermal problem - waiting for chip(s) to cool down ");
251
+      uint16_t status_composite_temp = 0;
252
+      uint8_t k = 0;
253
+      do {
254
+        k++;
255
+        if (!(k % 4)) {
256
+          kval_hold *= 0.95;
257
+          L6470_EOL();
258
+          L6470_ECHOLNPAIR("Lowering KVAL_HOLD by about 5% to ", kval_hold);
259
+          for (j = 0; j < driver_count; j++)
260
+            L6470.set_param(axis_index[j], L6470_KVAL_HOLD, kval_hold);
261
+        }
262
+        L6470_ECHOLNPGM(".");
263
+        gcode.reset_stepper_timeout(); // reset_stepper_timeout to keep steppers powered
264
+        watchdog_reset();   // beat the dog
265
+        safe_delay(5000);
266
+        status_composite_temp = 0;
267
+        for (j = 0; j < driver_count; j++) {
268
+          axis_status[j] = (~L6470.get_status(axis_index[j])) & L6470_ERROR_MASK;    // bits of interest are all active low
269
+          status_composite_temp |= axis_status[j];
270
+        }
271
+      }
272
+      while (status_composite_temp & (STATUS_TH_WRN | STATUS_TH_SD));
273
+      L6470_EOL();
274
+    }
275
+    if (status_composite & (STATUS_STEP_LOSS_A | STATUS_STEP_LOSS_B | STATUS_OCD)) {
276
+      switch (test_phase) {
277
+
278
+        case 0: {
279
+          if (status_composite & STATUS_OCD) {
280
+            // phase 0 with OCD warning - time to go to next phase
281
+            if (ocd_th_val >=15) {
282
+              ocd_th_val = 15;           // limit to max
283
+              test_phase = 2;            // at highest value so skip phase 1
284
+              L6470_ECHOLNPGM("LOGIC E0A OCD at highest - skip to 2");
285
+            }
286
+            else {
287
+              ocd_th_val++;              // normal exit to next phase
288
+              test_phase = 1;            // setup for first pass of phase 1
289
+              L6470_ECHOLNPGM("LOGIC E0B - inc OCD  & go to 1");
290
+            }
291
+          }
292
+          else {  // phase 0 without OCD warning - keep on decrementing if can
293
+            if (ocd_th_val) {
294
+              ocd_th_val--;              // try lower value
295
+              L6470_ECHOLNPGM("LOGIC E0C - dec OCD");
296
+            }
297
+            else {
298
+              test_phase = 2;            // at lowest value without warning so skip phase 1
299
+              L6470_ECHOLNPGM("LOGIC E0D - OCD at latest - go to 2");
300
+            }
301
+          }
302
+        } break;
303
+
304
+        case 1: {
305
+          if (status_composite & STATUS_OCD) {
306
+            // phase 1 with OCD warning - increment if can
307
+            if (ocd_th_val >= 15) {
308
+              ocd_th_val = 15;           // limit to max
309
+              test_phase = 2;            // at highest value so go to next phase
310
+              L6470_ECHOLNPGM("LOGIC E1A - OCD at max - go to 2");
311
+            }
312
+            else {
313
+              ocd_th_val++;              // try a higher value
314
+              L6470_ECHOLNPGM("LOGIC E1B - inc OCD");
315
+            }
316
+          }
317
+          else { // phase 1 without OCD warning - normal exit to phase 2
318
+            test_phase = 2;
319
+            L6470_ECHOLNPGM("LOGIC E1C - no OCD warning - go to 1");
320
+          }
321
+        } break;
322
+
323
+        case 2: {
324
+          if (status_composite & (STATUS_STEP_LOSS_A | STATUS_STEP_LOSS_B)) {
325
+            // phase 2 with stall warning - time to go to next phase
326
+            if (stall_th_val >= 127) {
327
+              stall_th_val = 127;  // limit to max
328
+              L6470_ECHOLNPGM("LOGIC E2A - STALL warning, STALL at max, quit");
329
+              L6470_ECHOLNPGM("finished - STALL at maximum value but still have stall warning");
330
+              test_phase = 4;
331
+            }
332
+            else {
333
+              test_phase = 3;              // normal exit to next phase (found failing value of STALL)
334
+              stall_th_val++;              // setup for first pass of phase 3
335
+              L6470_ECHOLNPGM("LOGIC E2B - INC - STALL warning, inc Stall, go to 3");
336
+            }
337
+          }
338
+          else {  // phase 2 without stall warning - decrement if can
339
+            if (stall_th_val) {
340
+              stall_th_val--;              // try a lower value
341
+              L6470_ECHOLNPGM("LOGIC E2C - no STALL, dec STALL");
342
+            }
343
+            else {
344
+              L6470_ECHOLNPGM("finished - STALL at lowest value but still do NOT have stall warning");
345
+              test_phase = 4;
346
+              L6470_ECHOLNPGM("LOGIC E2D - no STALL, at lowest so quit");
347
+            }
348
+          }
349
+        } break;
350
+
351
+        case 3: {
352
+          if (status_composite & (STATUS_STEP_LOSS_A | STATUS_STEP_LOSS_B)) {
353
+            // phase 3 with stall warning - increment if can
354
+            if (stall_th_val >= 127) {
355
+              stall_th_val = 127; // limit to max
356
+              L6470_ECHOLNPGM("finished - STALL at maximum value but still have stall warning");
357
+              test_phase = 4;
358
+              L6470_ECHOLNPGM("LOGIC E3A - STALL, at max so quit");
359
+            }
360
+            else {
361
+              stall_th_val++;              // still looking for passing value
362
+              L6470_ECHOLNPGM("LOGIC E3B - STALL, inc stall");
363
+            }
364
+          }
365
+          else {  //phase 3 without stall warning  but have OCD warning
366
+            L6470_ECHOLNPGM("Hardware problem - OCD warning without STALL warning");
367
+            test_phase = 4;
368
+            L6470_ECHOLNPGM("LOGIC E3C - not STALLED, hardware problem (quit)");
369
+          }
370
+        } break;
371
+
372
+      }
373
+
374
+    }
375
+    else {
376
+      switch (test_phase) {
377
+        case 0: { // phase 0 without OCD warning - keep on decrementing if can
378
+          if (ocd_th_val) {
379
+            ocd_th_val--;             // try lower value
380
+            L6470_ECHOLNPGM("LOGIC N0A - DEC OCD");
381
+          }
382
+          else {
383
+            test_phase = 2;           // at lowest value without warning so skip phase 1
384
+            L6470_ECHOLNPGM("LOGIC N0B - OCD at lowest (go to phase 2)");
385
+          }
386
+        } break;
387
+
388
+        case 1: L6470_ECHOLNPGM("LOGIC N1 (go directly to 2)"); // phase 1 without OCD warning - drop directly to phase 2
389
+
390
+        case 2: { // phase 2 without stall warning - keep on decrementing if can
391
+          if (stall_th_val) {
392
+            stall_th_val--;              // try a lower value (stay in phase 2)
393
+            L6470_ECHOLNPGM("LOGIC N2B - dec STALL");
394
+          }
395
+          else {
396
+            L6470_ECHOLNPGM("finished - STALL at lowest value but still no stall warning");
397
+            test_phase = 4;
398
+            L6470_ECHOLNPGM("LOGIC N2C - STALL at lowest (quit)");
399
+          }
400
+        } break;
401
+
402
+        case 3: { test_phase = 4;
403
+           L6470_ECHOLNPGM("LOGIC N3 - finished!");
404
+        } break;  // phase 3 without any warnings - desired exit
405
+      }  //
406
+    }  // end of status checks
407
+
408
+    if (test_phase != 4) {
409
+      for (j = 0; j < driver_count; j++) {                       // update threshold(s)
410
+        L6470.set_param(axis_index[j], L6470_OCD_TH, ocd_th_val);
411
+        L6470.set_param(axis_index[j], L6470_STALL_TH, stall_th_val);
412
+        if (L6470.get_param(axis_index[j], L6470_OCD_TH) != ocd_th_val) L6470_ECHOLNPGM("OCD mismatch");
413
+        if (L6470.get_param(axis_index[j], L6470_STALL_TH) != stall_th_val) L6470_ECHOLNPGM("STALL mismatch");
414
+      }
415
+    }
416
+
417
+  } while (test_phase != 4);
418
+
419
+  if (status_composite) {
420
+    L6470_ECHOLNPGM("Completed with errors");
421
+    for (j = 0; j < driver_count; j++) {
422
+      L6470_ECHOPGM("...");
423
+      L6470.error_status_decode(axis_status[j], axis_index[j]);
424
+    }
425
+  }
426
+  else
427
+    L6470_ECHOLNPGM("Completed with no errors");
428
+
429
+} // M917
430
+
431
+/**
432
+ *
433
+ * M918: increase speed until error or max feedrate achieved (as shown in configuration.h))
434
+ *
435
+ * J - select which driver(s) to monitor on multi-driver axis
436
+ *     0 - (default) monitor all drivers on the axis or E0
437
+ *     1 - monitor only X, Y, Z, E1
438
+ *     2 - monitor only X2, Y2, Z2, E2
439
+ * Xxxx, Yxxx, Zxxx, Exxx - axis to be monitored with displacement
440
+ *     xxx (1-255) is distance moved on either side of current position
441
+ *
442
+ * I - over current threshold
443
+ *     optional - will report current value from driver if not specified
444
+ *
445
+ * K - value for KVAL_HOLD (0 - 255) (optional)
446
+ *     optional - will report current value from driver if not specified
447
+ *
448
+ */
449
+void GcodeSuite::M918() {
450
+
451
+  L6470_ECHOLNPGM("M918");
452
+
453
+  char axis_mon[3][3] = { "  ", "  ", "  " };  // List of axes to monitor
454
+  uint8_t axis_index[3];
455
+  uint16_t axis_status[3];
456
+  uint8_t driver_count = 1;
457
+  float position_max, position_min;
458
+  float final_feedrate;
459
+  uint8_t kval_hold;
460
+  uint8_t ocd_th_val = 0;
461
+  uint8_t stall_th_val = 0;
462
+  uint16_t over_current_threshold;
463
+  constexpr bool over_current_flag = true;
464
+
465
+  uint8_t j;   // general purpose counter
466
+
467
+  if (L6470.get_user_input(driver_count, axis_index, axis_mon, position_max, position_min, final_feedrate, kval_hold, over_current_flag, ocd_th_val, stall_th_val, over_current_threshold))
468
+    return;  // quit if invalid user input
469
+
470
+  uint8_t m_steps = parser.byteval('M');
471
+  LIMIT(m_steps, 0, 128);
472
+  L6470_ECHOLNPAIR("M = ", m_steps);
473
+
474
+  int8_t m_bits = -1;
475
+       if (m_steps > 85) m_bits = 7;  // 128 (no synch output)
476
+  else if (m_steps > 42) m_bits = 6;  //  64 (no synch output)
477
+  else if (m_steps > 22) m_bits = 5;  //  32 (no synch output)
478
+  else if (m_steps > 12) m_bits = 4;  //  16 (no synch output)
479
+  else if (m_steps >  5) m_bits = 3;  //   8 (no synch output)
480
+  else if (m_steps >  2) m_bits = 2;  //   4 (no synch output)
481
+  else if (m_steps == 2) m_bits = 1;  //   2 (no synch output)
482
+  else if (m_steps == 1) m_bits = 0;  //   1 (no synch output)
483
+  else if (m_steps == 0) m_bits = 7;  // 128 (no synch output)
484
+
485
+  if (m_bits >= 0) {
486
+    const int micros = _BV(m_bits);
487
+    if (micros < 100) { L6470_CHAR(' '); if (micros < 10) L6470_CHAR(' '); }
488
+    L6470_ECHO(micros);
489
+    L6470_ECHOPGM(" uSTEPS");
490
+  }
491
+
492
+  for (j = 0; j < driver_count; j++)
493
+    L6470.set_param(axis_index[j], L6470_STEP_MODE, m_bits);   // set microsteps
494
+
495
+  L6470_ECHOLNPAIR("target (maximum) feedrate = ",final_feedrate);
496
+
497
+  float feedrate_inc = final_feedrate / 10, // start at 1/10 of max & go up by 1/10 per step)
498
+        current_feedrate = 0;
499
+
500
+  planner.synchronize();                  // wait for all current movement commands to complete
501
+
502
+  for (j = 0; j < driver_count; j++)
503
+    L6470.get_status(axis_index[j]);      // clear all error flags
504
+
505
+  char temp_axis_string[2];
506
+  temp_axis_string[0] = axis_mon[0][0];   // need to have a string for use within sprintf format section
507
+  temp_axis_string[1] = '\n';
508
+
509
+  char gcode_string[80];
510
+  uint16_t status_composite = 0;
511
+  L6470_ECHOLNPGM(".\n.\n.");            // make the feedrate prints easier to see
512
+
513
+  do {
514
+    current_feedrate += feedrate_inc;
515
+    L6470_ECHOLNPAIR("...feedrate = ", current_feedrate);
516
+
517
+    sprintf_P(gcode_string, PSTR("G0 %s%4.3f F%4.3f"), temp_axis_string, position_min, current_feedrate);
518
+    gcode.process_subcommands_now_P(gcode_string);
519
+
520
+    sprintf_P(gcode_string, PSTR("G0 %s%4.3f F%4.3f"), temp_axis_string, position_max, current_feedrate);
521
+    gcode.process_subcommands_now_P(gcode_string);
522
+
523
+    planner.synchronize();
524
+
525
+    for (j = 0; j < driver_count; j++) {
526
+      axis_status[j] = (~L6470.get_status(axis_index[j])) & 0x0800;    // bits of interest are all active low
527
+      status_composite |= axis_status[j];
528
+    }
529
+    if (status_composite) break;       // quit if any errors flags are raised
530
+  } while (current_feedrate < final_feedrate * 0.99);
531
+
532
+  if (status_composite) {
533
+    L6470_ECHOLNPGM("Completed with errors");
534
+    for (j = 0; j < driver_count; j++) {
535
+      L6470_ECHOPGM("...");
536
+      L6470.error_status_decode(axis_status[j], axis_index[j]);
537
+    }
538
+  }
539
+  else
540
+    L6470_ECHOLNPGM("Completed with no errors");
541
+
542
+} // M918
543
+
544
+#endif // HAS_DRIVER(L6470)

+ 8
- 0
Marlin/src/gcode/gcode.cpp View File

@@ -667,6 +667,14 @@ void GcodeSuite::process_parsed_command(
667 667
         #endif
668 668
       #endif
669 669
 
670
+      #if HAS_DRIVER(L6470)
671
+        case 122: M122(); break;                                   // M122: Report status
672
+        case 906: M906(); break;                                   // M906: Set or get motor drive level
673
+        case 916: M916(); break;                                   // M916: L6470 tuning: Increase drive level until thermal warning
674
+        case 917: M917(); break;                                   // M917: L6470 tuning: Find minimum current thresholds
675
+        case 918: M918(); break;                                   // M918: L6470 tuning: Increase speed until max or error
676
+      #endif
677
+
670 678
       #if HAS_MICROSTEPS
671 679
         case 350: M350(); break;                                  // M350: Set microstepping mode. Warning: Steps per unit remains unchanged. S code sets stepping mode for all drivers.
672 680
         case 351: M351(); break;                                  // M351: Toggle MS1 MS2 pins directly, S# determines MS1 or MS2, X# sets the pin high/low.

+ 10
- 0
Marlin/src/gcode/gcode.h View File

@@ -240,6 +240,8 @@
240 240
  * M912 - Clear stepper driver overtemperature pre-warn condition flag. (Requires at least one _DRIVER_TYPE defined as TMC2130/TMC2208/TMC2660)
241 241
  * M913 - Set HYBRID_THRESHOLD speed. (Requires HYBRID_THRESHOLD)
242 242
  * M914 - Set StallGuard sensitivity. (Requires SENSORLESS_HOMING or SENSORLESS_PROBING)
243
+ * M917 - L6470 tuning: Find minimum current thresholds
244
+ * M918 - L6470 tuning: Increase speed until max or error
243 245
  *
244 246
  * M360 - SCARA calibration: Move to cal-position ThetaA (0 deg calibration)
245 247
  * M361 - SCARA calibration: Move to cal-position ThetaB (90 deg calibration - steps per degree)
@@ -812,6 +814,14 @@ private:
812 814
     #endif
813 815
   #endif
814 816
 
817
+  #if HAS_DRIVER(L6470)
818
+    static void M122();
819
+    static void M906();
820
+    static void M916();
821
+    static void M917();
822
+    static void M918();
823
+  #endif
824
+
815 825
   #if HAS_DIGIPOTSS || HAS_MOTOR_CURRENT_PWM || ENABLED(DIGIPOT_I2C) || ENABLED(DAC_STEPPER_CURRENT)
816 826
     static void M907();
817 827
     #if HAS_DIGIPOTSS || ENABLED(DAC_STEPPER_CURRENT)

+ 62
- 0
Marlin/src/gcode/host/M114.cpp View File

@@ -28,6 +28,12 @@
28 28
 
29 29
 #if ENABLED(M114_DETAIL)
30 30
 
31
+  #if HAS_DRIVER(L6470)
32
+    //C:\Users\bobku\Documents\GitHub\Marlin-Bob-2\Marlin\src\gcode\host\M114.cpp
33
+    //C:\Users\bobku\Documents\GitHub\Marlin-Bob-2\Marlin\src\module\bob_L6470.cpp
34
+    #include "../../module/L6470/L6470_Marlin.h"
35
+  #endif
36
+
31 37
   void report_xyze(const float pos[], const uint8_t n = 4, const uint8_t precision = 3) {
32 38
     char str[12];
33 39
     for (uint8_t i = 0; i < n; i++) {
@@ -79,6 +85,62 @@
79 85
 
80 86
     planner.synchronize();
81 87
 
88
+    #if HAS_DRIVER(L6470)
89
+      char temp_buf[80];
90
+      int32_t temp;
91
+      //#define ABS_POS_SIGN_MASK 0b1111 1111 1110 0000 0000 0000 0000 0000
92
+      #define ABS_POS_SIGN_MASK 0b11111111111000000000000000000000
93
+      #define REPORT_ABSOLUTE_POS(Q) do{                            \
94
+          L6470.say_axis(Q, false);                                 \
95
+          temp = L6470_GETPARAM(L6470_ABS_POS,Q);                   \
96
+          if (temp & ABS_POS_SIGN_MASK) temp |= ABS_POS_SIGN_MASK;  \
97
+          sprintf_P(temp_buf, PSTR(":%8ld   "), temp);              \
98
+          L6470_ECHO(temp_buf);                                     \
99
+        }while(0)
100
+
101
+      L6470_ECHOPGM("\nL6470:");
102
+      #if AXIS_DRIVER_TYPE_X(L6470)
103
+        REPORT_ABSOLUTE_POS(X);
104
+      #endif
105
+      #if AXIS_DRIVER_TYPE_X2(L6470)
106
+        REPORT_ABSOLUTE_POS(X2);
107
+      #endif
108
+      #if AXIS_DRIVER_TYPE_Y(L6470)
109
+        REPORT_ABSOLUTE_POS(Y);
110
+      #endif
111
+      #if AXIS_DRIVER_TYPE_Y2(L6470)
112
+        REPORT_ABSOLUTE_POS(Y2);
113
+      #endif
114
+      #if AXIS_DRIVER_TYPE_Z(L6470)
115
+        REPORT_ABSOLUTE_POS(Z);
116
+      #endif
117
+      #if AXIS_DRIVER_TYPE_Z2(L6470)
118
+        REPORT_ABSOLUTE_POS(Z2);
119
+      #endif
120
+      #if AXIS_DRIVER_TYPE_Z3(L6470)
121
+        REPORT_ABSOLUTE_POS(Z3);
122
+      #endif
123
+      #if AXIS_DRIVER_TYPE_E0(L6470)
124
+        REPORT_ABSOLUTE_POS(E0);
125
+      #endif
126
+      #if AXIS_DRIVER_TYPE_E1(L6470)
127
+        REPORT_ABSOLUTE_POS(E1);
128
+      #endif
129
+      #if AXIS_DRIVER_TYPE_E2(L6470)
130
+        REPORT_ABSOLUTE_POS(E2);
131
+      #endif
132
+      #if AXIS_DRIVER_TYPE_E3(L6470)
133
+        REPORT_ABSOLUTE_POS(E3);
134
+      #endif
135
+      #if AXIS_DRIVER_TYPE_E4(L6470)
136
+        REPORT_ABSOLUTE_POS(E4);
137
+      #endif
138
+      #if AXIS_DRIVER_TYPE_E5(L6470)
139
+        REPORT_ABSOLUTE_POS(E5);
140
+      #endif
141
+      SERIAL_EOL();
142
+    #endif // HAS_DRIVER(L6470)
143
+
82 144
     SERIAL_ECHOPGM("Stepper:");
83 145
     LOOP_XYZE(i) {
84 146
       SERIAL_CHAR(' ');

+ 1
- 1
Marlin/src/inc/Conditionals_post.h View File

@@ -1630,7 +1630,7 @@
1630 1630
 // If platform requires early initialization of watchdog to properly boot
1631 1631
 #define EARLY_WATCHDOG (ENABLED(USE_WATCHDOG) && defined(ARDUINO_ARCH_SAM))
1632 1632
 
1633
-#define USE_EXECUTE_COMMANDS_IMMEDIATE (ENABLED(G29_RETRY_AND_RECOVER) || ENABLED(GCODE_MACROS) || ENABLED(POWER_LOSS_RECOVERY))
1633
+#define USE_EXECUTE_COMMANDS_IMMEDIATE (ENABLED(G29_RETRY_AND_RECOVER) || ENABLED(GCODE_MACROS) || ENABLED(POWER_LOSS_RECOVERY) || HAS_DRIVER(L6470))
1634 1634
 
1635 1635
 #if ENABLED(Z_TRIPLE_STEPPER_DRIVERS)
1636 1636
   #define Z_STEPPER_COUNT 3

+ 105
- 0
Marlin/src/libs/L6470/000_l6470_read_me.md View File

@@ -0,0 +1,105 @@
1
+Arduino-6470 library revision 0.7.0 or above is required.
2
+
3
+This software can be used with any L647x chip and the powerSTEP01. L647x and powerSTEP01 devices can not be mixed within a system. A flag in the library must be set to enable use of a powerSTEP01.
4
+
5
+These devices use voltage PWMs to drive the stepper phases. Phase current is not directly controlled. Each microstep corresponds to a particular PWM duty cycle. The KVAL\_HOLD register scales the PWM duty cycle.
6
+
7
+This software assumes that all L6470 drivers are in one SPI daisy chain.
8
+
9
+``` {.gcode}
10
+    The hardware setup is:
11
+
12
+        MOSI from controller tied to SDI on the first device
13
+
14
+        SDO of the first device is tied to SDI of the next device
15
+
16
+        SDO of the last device is tied to MISO of the controller
17
+
18
+        all devices share the same SCK, SS\_PIN and RESET\_PIN
19
+
20
+        Each L6470 passes the data it saw on its SDI to its neighbor on the **NEXT** SPI cycle (8 bit delay).
21
+
22
+        Each L6470 acts on the **last** SPI data it saw when the SS\_PIN **goes high**.
23
+```
24
+
25
+The L6470 drivers operate in STEP\_CLOCK mode. In this mode the direction and enable are done via SPI commands and the phase currents are changed in response to step pulses (generated in the usual way).
26
+
27
+There are two different SPI routines used.
28
+
29
+-   **uint8\_t** L6470\_Transfer(uint8\_t data, int \_SSPin, const uint8\_t chain\_position) is used to setup the chips and by the maintenance/status code. This code uses the Arduino-6470 library.
30
+
31
+-   **void** L6470\_Transfer(uint8\_t L6470\_buf[], const uint8\_t length) is used by the set\_directions() routine to send the direction/enable commands. The library is NOT used by this code.
32
+
33
+**HARDWARE/SOFTWARE interaction**
34
+
35
+Powering up a stepper and setting the direction are done by the same command. Can't do one without the other.
36
+
37
+**All** directions are set **every time** a new block is popped off the queue by the stepper ISR.
38
+
39
+SPI transfers, when setting the directions, are minimized by using arrays and a SPI routine dedicated to this function. L6470 library calls are not used. For N L6470 drivers, this results in a N byte transfer. If library calls were used then N\*N bytes would be sent.
40
+
41
+**Power up (reset) sequence:**
42
+
43
+1.  Stepper objects are created before the **setup()** entry point is reached.
44
+
45
+2.  After the **setup()** entry point is reached and before the steppers are initialized, L6470\_init() is called to do the following
46
+
47
+3.  If present, the hardware reset is pulsed.
48
+
49
+4.  The L6470\_chain array is populated during **setup()**. This array is used to tell where in the SPI stream the commands/data for an stepper is positioned.
50
+
51
+5.  The L6470 soft SPI pins are initialized.
52
+
53
+6.  The L6470 chips are initialized during **setup()**. They can be re-initialized using the **L6470\_init\_to\_defaults()** function
54
+
55
+The steppers are **NOT** powered up during this sequence.
56
+
57
+**L6470\_chain** array
58
+
59
+This array is used by all routines that transmit SPI data.
60
+
61
+``` {.gcode}
62
+  Location 0 - number of drivers in chain
63
+
64
+  Location 1 - axis index for first device in the chain (closest to MOSI)
65
+
66
+  …
67
+
68
+  Location N - axis index for last device in the N device long chain (closest to MISO)
69
+```
70
+
71
+**Direction set and enable**
72
+
73
+The DIR\_WRITE macros for the L6470 drivers are written so that the standard X, Y, Z and extruder logic used by the set\_directions() routine is not altered. These macros write the correct forward/reverse command to the corresponding location in the array *L6470\_dir\_commands*.
74
+
75
+At the end of the set\_directions() routine, the array *L6470\_chain* is used to grab the corresponding direction/enable commands out of the array *L6470\_dir\_commands* and put them in the correct sequence in the array *L6470\_buf*. Array *L6470\_buf* is then passed to the **void** L6470\_Transfer function which actually sends the data to the devices.
76
+
77
+**Utilities and misc**
78
+
79
+The **absolute position** registers should accurately reflect Marlin’s stepper position counts. They are set to zero during initialization. G28 sets them to the Marlin counts for the corresponding axis after homing. NOTE – these registers are often the negative of the Marlin counts. This is because the Marlin counts reflect the logical direction while the registers reflect the stepper direction. The register contents are displayed via the M114 D command.
80
+
81
+The **L6470\_monitor** feature reads the status of each device every half second. It will report if there are any error conditions present or if communications has been lost/restored. The KVAL\_HOLD value is reduced every 2 – 2.5 seconds if the thermal warning or thermal shutdown conditions are present.
82
+
83
+**M122** displays the settings of most of the bits in the status register plus a couple of other items.
84
+
85
+**M906** can be used to set the KVAL\_HOLD register one driver at a time. If a setting is not included with the command then the contents of the registers that affect the phase current/voltage are displayed.
86
+
87
+**M916, M917 & M918**
88
+
89
+These utilities are used to tune the system. They can get you in the ballpark for acceptable jerk, acceleration, top speed and KVAL\_HOLD settings. In general they seem to provide an overly optimistic KVAL\_HOLD setting because of the lag between setting KVAL\_HOLD and the driver reaching final temperature. Enabling the **L6470\_monitor** feature during prints will provide the **final useful KVAL\_HOLD setting**.
90
+
91
+The amount of power needed to move the stepper without skipping steps increases as jerk, acceleration and top speed increase. The power dissipated by the driver increases as the power to the stepper increases. The net result is a balancing act between jerk, acceleration, top speed and power dissipated by the driver.
92
+
93
+**M916 -** Increases KVAL\_HOLD while moving one axis until get thermal warning. This routine is also useful for determining the approximate KVAL\_HOLD where the stepper stops losing steps. The sound will get noticeably quieter as it stops losing steps.
94
+
95
+**M917 -** Find minimum current thresholds. This is done by doing the following steps while moving an axis:
96
+
97
+1.  Decrease OCD current until overcurrent error
98
+
99
+2.  Increase OCD until overcurrent error goes away
100
+
101
+3.  Decrease stall threshold until stall error
102
+
103
+4.  Increase stall until stall error goes away
104
+
105
+**M918 -** Increase speed until error or max feedrate achieved.

+ 793
- 0
Marlin/src/libs/L6470/L6470_Marlin.cpp View File

@@ -0,0 +1,793 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2019 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
+
23
+/**
24
+ *  The monitor_driver routines are a close copy of the TMC code
25
+ */
26
+
27
+#include "../../inc/MarlinConfig.h"
28
+
29
+#if HAS_DRIVER(L6470)
30
+
31
+#include "L6470_Marlin.h"
32
+
33
+L6470_Marlin L6470;
34
+
35
+#include "../stepper_indirection.h"
36
+#include "../../gcode/gcode.h"
37
+#include "../planner.h"
38
+
39
+uint8_t L6470_Marlin::dir_commands[MAX_L6470];  // array to hold direction command for each driver
40
+
41
+char L6470_Marlin::index_to_axis[MAX_L6470][3] = { "X ", "Y ", "Z ", "X2", "Y2", "Z2", "Z3", "E0", "E1", "E2", "E3", "E4", "E5" };
42
+
43
+bool L6470_Marlin::index_to_dir[MAX_L6470] =  {
44
+  INVERT_X_DIR                        ,  // 0 X
45
+  INVERT_Y_DIR                        ,  // 1 Y
46
+  INVERT_Z_DIR                        ,  // 2 Z
47
+  #if ENABLED(X_DUAL_STEPPER_DRIVERS)
48
+    INVERT_X_DIR ^ INVERT_X2_VS_X_DIR ,  // 3 X2
49
+  #else
50
+    INVERT_X_DIR                      ,  // 3 X2
51
+  #endif
52
+  #if ENABLED(Y_DUAL_STEPPER_DRIVERS)
53
+    INVERT_Y_DIR ^ INVERT_Y2_VS_Y_DIR ,  // 4 Y2
54
+  #else
55
+    INVERT_Y_DIR                      ,  // 4 Y2
56
+  #endif
57
+  INVERT_Z_DIR                        ,  // 5 Z2
58
+  INVERT_Z_DIR                        ,  // 6 Z3
59
+  INVERT_E0_DIR                       ,  // 7 E0
60
+  INVERT_E1_DIR                       ,  // 8 E1
61
+  INVERT_E2_DIR                       ,  // 9 E2
62
+  INVERT_E3_DIR                       ,  //10 E3
63
+  INVERT_E4_DIR                       ,  //11 E4
64
+  INVERT_E5_DIR                       ,  //12 E5
65
+};
66
+
67
+uint8_t L6470_Marlin::axis_xref[MAX_L6470] = {
68
+  AxisEnum(X_AXIS), // X
69
+  AxisEnum(Y_AXIS), // Y
70
+  AxisEnum(Z_AXIS), // Z
71
+  AxisEnum(X_AXIS), // X2
72
+  AxisEnum(Y_AXIS), // Y2
73
+  AxisEnum(Z_AXIS), // Z2
74
+  AxisEnum(Z_AXIS), // Z3
75
+  AxisEnum(E_AXIS), // E0
76
+  AxisEnum(E_AXIS), // E1
77
+  AxisEnum(E_AXIS), // E2
78
+  AxisEnum(E_AXIS), // E3
79
+  AxisEnum(E_AXIS), // E4
80
+  AxisEnum(E_AXIS)  // E5
81
+};
82
+
83
+volatile bool L6470_Marlin::spi_abort = false;
84
+bool L6470_Marlin::spi_active = false;
85
+
86
+void L6470_Marlin::populate_chain_array() {
87
+
88
+  #define _L6470_INIT_SPI(Q)  do{ stepper##Q.set_chain_info(Q, Q##_CHAIN_POS); }while(0)
89
+
90
+  #if AXIS_DRIVER_TYPE_X(L6470)
91
+    _L6470_INIT_SPI(X);
92
+  #endif
93
+  #if AXIS_DRIVER_TYPE_X2(L6470)
94
+    _L6470_INIT_SPI(X2);
95
+  #endif
96
+  #if AXIS_DRIVER_TYPE_Y(L6470)
97
+    _L6470_INIT_SPI(Y);
98
+  #endif
99
+  #if AXIS_DRIVER_TYPE_Y2(L6470)
100
+    _L6470_INIT_SPI(Y2);
101
+  #endif
102
+  #if AXIS_DRIVER_TYPE_Z(L6470)
103
+    _L6470_INIT_SPI(Z);
104
+  #endif
105
+  #if AXIS_DRIVER_TYPE_Z2(L6470)
106
+    _L6470_INIT_SPI(Z2);
107
+  #endif
108
+  #if AXIS_DRIVER_TYPE_Z3(L6470)
109
+    _L6470_INIT_SPI(Z3);
110
+  #endif
111
+  #if AXIS_DRIVER_TYPE_E0(L6470)
112
+    _L6470_INIT_SPI(E0);
113
+  #endif
114
+  #if AXIS_DRIVER_TYPE_E1(L6470)
115
+    _L6470_INIT_SPI(E1);
116
+  #endif
117
+  #if AXIS_DRIVER_TYPE_E2(L6470)
118
+    _L6470_INIT_SPI(E2);
119
+  #endif
120
+  #if AXIS_DRIVER_TYPE_E3(L6470)
121
+    _L6470_INIT_SPI(E3);
122
+  #endif
123
+  #if AXIS_DRIVER_TYPE_E4(L6470)
124
+    _L6470_INIT_SPI(E4);
125
+  #endif
126
+  #if AXIS_DRIVER_TYPE_E5(L6470)
127
+    _L6470_INIT_SPI(E5);
128
+  #endif
129
+}
130
+
131
+void L6470_Marlin::init() {               // Set up SPI and then init chips
132
+  #if PIN_EXISTS(L6470_RESET_CHAIN)
133
+    OUT_WRITE(L6470_RESET_CHAIN_PIN, LOW);  // hardware reset of drivers
134
+    delay(1);
135
+    OUT_WRITE(L6470_RESET_CHAIN_PIN, HIGH);
136
+    delay(1);                     // need about 650uS for the chip to fully start up
137
+  #endif
138
+  populate_chain_array();   // Set up array to control where in the SPI transfer sequence a particular stepper's data goes
139
+  L6470_spi_init();               // Set up L6470 soft SPI pins
140
+  init_to_defaults();             // init the chips
141
+}
142
+
143
+uint16_t L6470_Marlin::get_status(const uint8_t axis) {
144
+
145
+  #define GET_L6470_STATUS(Q) stepper##Q.getStatus()
146
+
147
+  switch (axis) {
148
+    #if AXIS_DRIVER_TYPE_X(L6470)
149
+      case  0: return GET_L6470_STATUS(X);
150
+    #endif
151
+    #if AXIS_DRIVER_TYPE_Y(L6470)
152
+      case  1: return GET_L6470_STATUS(Y);
153
+    #endif
154
+    #if AXIS_DRIVER_TYPE_Z(L6470)
155
+      case  2: return GET_L6470_STATUS(Z);
156
+    #endif
157
+    #if AXIS_DRIVER_TYPE_X2(L6470)
158
+      case  3: return GET_L6470_STATUS(X2);
159
+    #endif
160
+    #if AXIS_DRIVER_TYPE_Y2(L6470)
161
+      case  4: return GET_L6470_STATUS(Y2);
162
+    #endif
163
+    #if AXIS_DRIVER_TYPE_Z2(L6470)
164
+      case  5: return GET_L6470_STATUS(Z2);
165
+    #endif
166
+    #if AXIS_DRIVER_TYPE_Z3(L6470)
167
+      case  6: return GET_L6470_STATUS(Z3);
168
+    #endif
169
+    #if AXIS_DRIVER_TYPE_E0(L6470)
170
+      case  7: return GET_L6470_STATUS(E0);
171
+    #endif
172
+    #if AXIS_DRIVER_TYPE_E1(L6470)
173
+      case  8: return GET_L6470_STATUS(E1);
174
+    #endif
175
+    #if AXIS_DRIVER_TYPE_E2(L6470)
176
+      case  9: return GET_L6470_STATUS(E2);
177
+    #endif
178
+    #if AXIS_DRIVER_TYPE_E3(L6470)
179
+      case 10: return GET_L6470_STATUS(E3);
180
+    #endif
181
+    #if AXIS_DRIVER_TYPE_E4(L6470)
182
+      case 11: return GET_L6470_STATUS(E4);
183
+    #endif
184
+    #if AXIS_DRIVER_TYPE_E5(L6470)
185
+      case 12: return GET_L6470_STATUS(E5);
186
+    #endif
187
+  }
188
+
189
+  return 0; // Not needed but kills a compiler warning
190
+}
191
+
192
+uint32_t L6470_Marlin::get_param(uint8_t axis, uint8_t param) {
193
+
194
+  #define GET_L6470_PARAM(Q) L6470_GETPARAM(param,Q)
195
+
196
+  switch (axis) {
197
+    #if AXIS_DRIVER_TYPE_X(L6470)
198
+      case  0: return GET_L6470_PARAM(X);
199
+    #endif
200
+    #if AXIS_DRIVER_TYPE_Y(L6470)
201
+      case  1: return GET_L6470_PARAM(Y);
202
+    #endif
203
+    #if AXIS_DRIVER_TYPE_Z(L6470)
204
+      case  2: return GET_L6470_PARAM(Z);
205
+    #endif
206
+    #if AXIS_DRIVER_TYPE_X2(L6470)
207
+      case  3: return GET_L6470_PARAM(X2);
208
+    #endif
209
+    #if AXIS_DRIVER_TYPE_Y2(L6470)
210
+      case  4: return GET_L6470_PARAM(Y2);
211
+    #endif
212
+    #if AXIS_DRIVER_TYPE_Z2(L6470)
213
+      case  5: return GET_L6470_PARAM(Z2);
214
+    #endif
215
+    #if AXIS_DRIVER_TYPE_Z3(L6470)
216
+      case  6: return GET_L6470_PARAM(Z3);
217
+    #endif
218
+    #if AXIS_DRIVER_TYPE_E0(L6470)
219
+      case  7: return GET_L6470_PARAM(E0);
220
+    #endif
221
+    #if AXIS_DRIVER_TYPE_E1(L6470)
222
+      case  8: return GET_L6470_PARAM(E1);
223
+    #endif
224
+    #if AXIS_DRIVER_TYPE_E2(L6470)
225
+      case  9: return GET_L6470_PARAM(E2);
226
+    #endif
227
+    #if AXIS_DRIVER_TYPE_E3(L6470)
228
+      case 10: return GET_L6470_PARAM(E3);
229
+    #endif
230
+    #if AXIS_DRIVER_TYPE_E4(L6470)
231
+      case 11: return GET_L6470_PARAM(E4);
232
+    #endif
233
+    #if AXIS_DRIVER_TYPE_E5(L6470)
234
+      case 12: return GET_L6470_PARAM(E5);
235
+    #endif
236
+  }
237
+
238
+  return 0 ; // not needed but kills a compiler warning
239
+}
240
+
241
+void L6470_Marlin::set_param(uint8_t axis, uint8_t param, uint32_t value) {
242
+
243
+  #define SET_L6470_PARAM(Q) stepper##Q.SetParam(param, value)
244
+
245
+  switch (axis) {
246
+    #if AXIS_DRIVER_TYPE_X(L6470)
247
+      case  0: SET_L6470_PARAM(X);
248
+    #endif
249
+    #if AXIS_DRIVER_TYPE_Y(L6470)
250
+      case  1: SET_L6470_PARAM(Y);
251
+    #endif
252
+    #if AXIS_DRIVER_TYPE_Z(L6470)
253
+      case  2: SET_L6470_PARAM(Z);
254
+    #endif
255
+    #if AXIS_DRIVER_TYPE_X2(L6470)
256
+      case  3: SET_L6470_PARAM(X2);
257
+    #endif
258
+    #if AXIS_DRIVER_TYPE_Y2(L6470)
259
+      case  4: SET_L6470_PARAM(Y2);
260
+    #endif
261
+    #if AXIS_DRIVER_TYPE_Z2(L6470)
262
+      case  5: SET_L6470_PARAM(Z2);
263
+    #endif
264
+    #if AXIS_DRIVER_TYPE_Z3(L6470)
265
+      case  6: SET_L6470_PARAM(Z3);
266
+    #endif
267
+    #if AXIS_DRIVER_TYPE_E0(L6470)
268
+      case  7: SET_L6470_PARAM(E0);
269
+    #endif
270
+    #if AXIS_DRIVER_TYPE_E1(L6470)
271
+      case  8: SET_L6470_PARAM(E1);
272
+    #endif
273
+    #if AXIS_DRIVER_TYPE_E2(L6470)
274
+      case  9: SET_L6470_PARAM(E2);
275
+    #endif
276
+    #if AXIS_DRIVER_TYPE_E3(L6470)
277
+      case 10: SET_L6470_PARAM(E3);
278
+    #endif
279
+    #if AXIS_DRIVER_TYPE_E4(L6470)
280
+      case 11: SET_L6470_PARAM(E4);
281
+    #endif
282
+    #if AXIS_DRIVER_TYPE_E5(L6470)
283
+      case 12: SET_L6470_PARAM(E5);
284
+    #endif
285
+  }
286
+}
287
+
288
+inline void echo_min_max(const char a, const float &min, const float &max) {
289
+  L6470_CHAR(' '); L6470_CHAR(a);
290
+  L6470_ECHOPAIR(" min = ", min);
291
+  L6470_ECHOLNPAIR("  max = ", max);
292
+}
293
+inline void echo_oct_used(const float &oct, const bool stall) {
294
+  L6470_ECHOPAIR("over_current_threshold used     : ", oct);
295
+  serialprintPGM(stall ? PSTR("  (Stall") : PSTR("  (OCD"));
296
+  L6470_ECHOLNPGM(" threshold)");
297
+}
298
+inline void err_out_of_bounds() { L6470_ECHOLNPGM("ERROR - motion out of bounds"); }
299
+
300
+bool L6470_Marlin::get_user_input(uint8_t &driver_count, uint8_t axis_index[3], char axis_mon[3][3],
301
+                          float &position_max, float &position_min, float &final_feedrate, uint8_t &kval_hold,
302
+                          bool over_current_flag, uint8_t &OCD_TH_val, uint8_t &STALL_TH_val, uint16_t &over_current_threshold
303
+) {
304
+  // Return TRUE if the calling routine needs to abort/kill
305
+
306
+  uint16_t displacement = 0;  // " = 0" to eliminate compiler warning
307
+  uint8_t j;   // general purpose counter
308
+
309
+  if (!all_axes_homed()) {
310
+    L6470_ECHOLNPGM("ERROR - home all before running this command");
311
+    //return true;
312
+  }
313
+
314
+  LOOP_XYZE(i) if (uint16_t _displacement = parser.intval(axis_codes[i])) {
315
+    displacement = _displacement;
316
+    uint8_t axis_offset = parser.byteval('J');
317
+    axis_mon[0][0] = axis_codes[i];   // axis ASCII value (target character)
318
+    if (axis_offset >= 2 || axis_mon[0][0] == 'E')  // Single axis, E0, or E1
319
+      axis_mon[0][1] = axis_offset + '0';
320
+    else if (axis_offset == 0) {              // one or more axes
321
+      uint8_t driver_count_local = 0;         // can't use "driver_count" directly as a subscript because it's passed by reference
322
+      for (j = 0; j < MAX_L6470; j++)         // see how many drivers on this axis
323
+        if (axis_mon[0][0] == index_to_axis[j][0]) {
324
+          axis_mon[driver_count_local][0] = axis_mon[0][0];
325
+          axis_mon[driver_count_local][1] = index_to_axis[j][1];
326
+          axis_mon[driver_count_local][2] = index_to_axis[j][2];   // append end of string
327
+          axis_index[driver_count_local] = j;                      // set axis index
328
+          driver_count_local++;
329
+        }
330
+      driver_count = driver_count_local;
331
+    }
332
+    break; // only take first axis found
333
+  }
334
+
335
+  //
336
+  // Position calcs & checks
337
+  //
338
+
339
+  const float center[] = {
340
+    LOGICAL_X_POSITION(current_position[X_AXIS]),
341
+    LOGICAL_Y_POSITION(current_position[Y_AXIS]),
342
+    LOGICAL_Z_POSITION(current_position[Z_AXIS]),
343
+    current_position[E_AXIS]
344
+  };
345
+
346
+  switch (axis_mon[0][0]) {
347
+    default: position_max = position_min = 0; break;
348
+
349
+    case 'X': {
350
+      position_min = center[X_AXIS] - displacement;
351
+      position_max = center[X_AXIS] + displacement;
352
+      echo_min_max('X', position_min, position_max);
353
+      if (false
354
+        #ifdef X_MIN_POS
355
+          || position_min < (X_MIN_POS)
356
+        #endif
357
+        #ifdef X_MAX_POS
358
+          || position_max > (X_MAX_POS)
359
+        #endif
360
+      ) {
361
+        err_out_of_bounds();
362
+        return true;
363
+      }
364
+    } break;
365
+
366
+    case 'Y': {
367
+      position_min = center[Y_AXIS] - displacement;
368
+      position_max = center[Y_AXIS] + displacement;
369
+      echo_min_max('Y', position_min, position_max);
370
+      if (false
371
+        #ifdef Y_MIN_POS
372
+          || position_min < (Y_MIN_POS)
373
+        #endif
374
+        #ifdef Y_MAX_POS
375
+          || position_max > (Y_MAX_POS)
376
+        #endif
377
+      ) {
378
+        err_out_of_bounds();
379
+        return true;
380
+      }
381
+    } break;
382
+
383
+    case 'Z': {
384
+      position_min = center[E_AXIS] - displacement;
385
+      position_max = center[E_AXIS] + displacement;
386
+      echo_min_max('Z', position_min, position_max);
387
+      if (false
388
+        #ifdef Z_MIN_POS
389
+          || position_min < (Z_MIN_POS)
390
+        #endif
391
+        #ifdef Z_MAX_POS
392
+          || position_max > (Z_MAX_POS)
393
+        #endif
394
+      ) {
395
+        err_out_of_bounds();
396
+        return true;
397
+      }
398
+    } break;
399
+
400
+    case 'E': {
401
+      position_min = center[E_AXIS] - displacement;
402
+      position_max = center[E_AXIS] + displacement;
403
+      echo_min_max('E', position_min, position_max);
404
+    } break;
405
+  }
406
+
407
+  //
408
+  // Work on the drivers
409
+  //
410
+  for (uint8_t k = 0; k < driver_count; k++) {
411
+    bool not_found = true;
412
+    for (j = 1; j <= L6470::chain[0]; j++) {
413
+      const char * const ind_axis = index_to_axis[L6470::chain[j]];
414
+      if (ind_axis[0] == axis_mon[k][0] && ind_axis[1] == axis_mon[k][1]) { // See if a L6470 driver
415
+        not_found = false;
416
+        break;
417
+      }
418
+    }
419
+    if (not_found) {
420
+      driver_count = k;
421
+      axis_mon[k][0] = ' ';  // mark this entry invalid
422
+      break;
423
+    }
424
+  }
425
+
426
+  if (driver_count == 0) {
427
+    L6470_ECHOLNPGM("ERROR - not a L6470 axis");
428
+    return true;
429
+  }
430
+
431
+  L6470_ECHOPGM("Monitoring:");
432
+  for (j = 0; j < driver_count; j++) L6470_ECHOPAIR("  ", axis_mon[j]);
433
+  L6470_EOL();
434
+
435
+  // now have a list of driver(s) to monitor
436
+
437
+  //
438
+  // kVAL_HOLD checks & settings
439
+  //
440
+
441
+  kval_hold = parser.byteval('K');
442
+  if (kval_hold) {
443
+    L6470_ECHOLNPAIR("kval_hold = ", kval_hold);
444
+    for (j = 0; j < driver_count; j++)
445
+      set_param(axis_index[j], L6470_KVAL_HOLD, kval_hold);
446
+  }
447
+  else {
448
+    // only print the KVAL_HOLD from one of the drivers
449
+    kval_hold = get_param(axis_index[0], L6470_KVAL_HOLD);
450
+    L6470_ECHOLNPAIR("KVAL_HOLD = ", kval_hold);
451
+  }
452
+
453
+  //
454
+  // Overcurrent checks & settings
455
+  //
456
+
457
+  if (over_current_flag) {
458
+
459
+    uint8_t OCD_TH_val_local = 0,       // compiler thinks OCD_TH_val is unused if use it directly
460
+            STALL_TH_val_local = 0;     // just in case ...
461
+
462
+    over_current_threshold = parser.intval('I');
463
+
464
+    if (over_current_threshold) {
465
+
466
+      OCD_TH_val_local = over_current_threshold/375;
467
+      LIMIT(OCD_TH_val_local, 0, 15);
468
+      STALL_TH_val_local = over_current_threshold/31.25;
469
+      LIMIT(STALL_TH_val_local, 0, 127);
470
+      uint16_t OCD_TH_actual = (OCD_TH_val_local + 1) * 375,
471
+               STALL_TH_actual = (STALL_TH_val_local + 1) * 31.25;
472
+      if (OCD_TH_actual < STALL_TH_actual) {
473
+        OCD_TH_val_local++;
474
+        OCD_TH_actual = (OCD_TH_val_local + 1) * 375;
475
+      }
476
+
477
+      L6470_ECHOLNPAIR("over_current_threshold specified: ", over_current_threshold);
478
+      echo_oct_used(STALL_TH_actual, true);
479
+      echo_oct_used(OCD_TH_actual, false);
480
+
481
+      #define SET_OVER_CURRENT(Q) do { stepper##Q.SetParam(L6470_STALL_TH, STALL_TH_val_local); stepper##Q.SetParam(L6470_OCD_TH, OCD_TH_val_local);} while (0)
482
+
483
+      for (j = 0; j < driver_count; j++) {
484
+        set_param(axis_index[j], L6470_STALL_TH, STALL_TH_val_local);
485
+        set_param(axis_index[j], L6470_OCD_TH, OCD_TH_val_local);
486
+      }
487
+    }
488
+    else {
489
+      // only get & print the OVER_CURRENT values from one of the drivers
490
+      STALL_TH_val_local = get_param(axis_index[0], L6470_STALL_TH);
491
+      OCD_TH_val_local = get_param(axis_index[0], L6470_OCD_TH);
492
+
493
+      echo_oct_used((STALL_TH_val_local + 1) * 31.25, true);
494
+      echo_oct_used((OCD_TH_val_local + 1) * 375, false);
495
+    } // over_current_threshold
496
+
497
+    for (j = 0; j < driver_count; j++) {                 // set all drivers on axis the same
498
+      set_param(axis_index[j], L6470_STALL_TH, STALL_TH_val_local);
499
+      set_param(axis_index[j], L6470_OCD_TH, OCD_TH_val_local);
500
+    }
501
+
502
+    OCD_TH_val = OCD_TH_val_local;        // force compiler to update the main routine's copy
503
+    STALL_TH_val = STALL_TH_val_local;    // force compiler to update the main routine's copy
504
+  } // end of overcurrent
505
+
506
+  //
507
+  // Feedrate
508
+  //
509
+
510
+  final_feedrate = parser.floatval('F');
511
+  if (final_feedrate == 0) {
512
+    static constexpr float default_max_feedrate[] = DEFAULT_MAX_FEEDRATE;
513
+    const uint8_t num_feedrates = COUNT(default_max_feedrate);
514
+    for (j = 0; j < num_feedrates; j++) {
515
+      if (axis_codes[j] == axis_mon[0][0]) {
516
+        final_feedrate = default_max_feedrate[j];
517
+        break;
518
+      }
519
+    }
520
+    if (j == 3 && num_feedrates > 4) {   // have more than one extruder feedrate
521
+      uint8_t extruder_num = axis_mon[0][1] - '0';
522
+      if (j <= num_feedrates - extruder_num)     // have a feedrate specifically for this extruder
523
+        final_feedrate = default_max_feedrate[j + extruder_num];
524
+      else
525
+        final_feedrate = default_max_feedrate[3];  // use E0 feedrate for this extruder
526
+    }
527
+    final_feedrate *= 60;  // convert to mm/minute
528
+  } // end of feedrate
529
+
530
+  return false;   // FALSE indicates no user input problems
531
+}
532
+
533
+#if ENABLED(L6470_CHITCHAT)
534
+  inline void echo_yes_no(const bool yes) { serialprintPGM(yes ? PSTR("YES") : PSTR("NO ")); }
535
+#endif
536
+
537
+void L6470_Marlin::say_axis(const uint8_t axis, const bool label/*=true*/) {
538
+  if (label) SERIAL_ECHOPGM("AXIS:");
539
+  SERIAL_CHAR(' ');
540
+  SERIAL_CHAR(index_to_axis[axis][0]);
541
+  SERIAL_CHAR(index_to_axis[axis][1]);
542
+  SERIAL_CHAR(' ');
543
+}
544
+
545
+void L6470_Marlin::error_status_decode(const uint16_t status, const uint8_t axis) {  // assumes status bits have been inverted
546
+  #if ENABLED(L6470_CHITCHAT)
547
+    char temp_buf[10];
548
+    say_axis(axis);
549
+    sprintf_P(temp_buf, PSTR("  %4x   "), status);
550
+    L6470_ECHO(temp_buf);
551
+    print_bin(status);
552
+    L6470_ECHOPGM("  THERMAL: ");
553
+    serialprintPGM((status & STATUS_TH_SD) ? PSTR("SHUTDOWN") : (status & STATUS_TH_WRN) ? PSTR("WARNING ") : PSTR("OK      "));
554
+    L6470_ECHOPGM("   OVERCURRENT: ");
555
+    echo_yes_no(status & STATUS_OCD);
556
+    L6470_ECHOPGM("   STALL: ");
557
+    echo_yes_no(status & (STATUS_STEP_LOSS_A | STATUS_STEP_LOSS_B));
558
+    L6470_EOL();
559
+  #else
560
+    UNUSED(status); UNUSED(axis);
561
+  #endif
562
+}
563
+
564
+//////////////////////////////////////////////////////////////////////////////////////////////////
565
+////
566
+////  MONITOR_L6470_DRIVER_STATUS routines
567
+////
568
+//////////////////////////////////////////////////////////////////////////////////////////////////
569
+
570
+#if ENABLED(MONITOR_L6470_DRIVER_STATUS)
571
+
572
+  struct L6470_driver_data {
573
+    uint8_t driver_index;
574
+    uint32_t driver_status;
575
+    bool is_otw;
576
+    uint8_t otw_counter;
577
+    bool is_ot;
578
+    bool is_hi_Z;
579
+    uint8_t com_counter;
580
+  };
581
+
582
+  L6470_driver_data driver_L6470_data[] = {
583
+    #if AXIS_DRIVER_TYPE_X(L6470)
584
+      {  0, 0, 0, 0, 0, 0, 0 },
585
+    #endif
586
+    #if AXIS_DRIVER_TYPE_Y(L6470)
587
+      {  1, 0, 0, 0, 0, 0, 0 },
588
+    #endif
589
+    #if AXIS_DRIVER_TYPE_Z(L6470)
590
+      {  2, 0, 0, 0, 0, 0, 0 },
591
+    #endif
592
+    #if AXIS_DRIVER_TYPE_X2(L6470)
593
+      {  3, 0, 0, 0, 0, 0, 0 },
594
+    #endif
595
+    #if AXIS_DRIVER_TYPE_Y2(L6470)
596
+      {  4, 0, 0, 0, 0, 0, 0 },
597
+    #endif
598
+    #if AXIS_DRIVER_TYPE_Z2(L6470)
599
+      {  5, 0, 0, 0, 0, 0, 0 },
600
+    #endif
601
+    #if AXIS_DRIVER_TYPE_Z3(L6470)
602
+      {  6, 0, 0, 0, 0, 0, 0 },
603
+    #endif
604
+    #if AXIS_DRIVER_TYPE_E0(L6470)
605
+      {  7, 0, 0, 0, 0, 0, 0 },
606
+    #endif
607
+    #if AXIS_DRIVER_TYPE_E1(L6470)
608
+      {  8, 0, 0, 0, 0, 0, 0 },
609
+    #endif
610
+    #if AXIS_DRIVER_TYPE_E2(L6470)
611
+      {  9, 0, 0, 0, 0, 0, 0 },
612
+    #endif
613
+    #if AXIS_DRIVER_TYPE_E3(L6470)
614
+      { 10, 0, 0, 0, 0, 0, 0 },
615
+    #endif
616
+    #if AXIS_DRIVER_TYPE_E4(L6470)
617
+      { 11, 0, 0, 0, 0, 0, 0 },
618
+    #endif
619
+    #if AXIS_DRIVER_TYPE_E5(L6470)
620
+      { 12, 0, 0, 0, 0, 0, 0 }
621
+    #endif
622
+  };
623
+
624
+  inline void append_stepper_err(char * &p, const uint8_t stepper_index, const char * const err=NULL) {
625
+    p += sprintf_P(p, PSTR("Stepper %c%c "), char(index_to_axis[stepper_index][0]), char(index_to_axis[stepper_index][1]));
626
+    if (err) p += sprintf_P(p, err);
627
+  }
628
+
629
+  void L6470_monitor_update(uint8_t stepper_index, uint16_t status) {
630
+    if (spi_abort) return;  // don't do anything if set_directions() has occurred
631
+    uint8_t kval_hold;
632
+    char temp_buf[120];
633
+    char* p = &temp_buf[0];
634
+    uint8_t j;
635
+    for (j = 0; j < L6470::chain[0]; j++) // find the table for this stepper
636
+      if (driver_L6470_data[j].driver_index == stepper_index) break;
637
+
638
+    driver_L6470_data[j].driver_status = status;
639
+    uint16_t _status = ~status;     // all error bits are active low
640
+
641
+    if (status == 0 || status == 0xFFFF) {              // com problem
642
+      if (driver_L6470_data[j].com_counter == 0) {      // warn user when it first happens
643
+        driver_L6470_data[j].com_counter++;
644
+        append_stepper_err(p, stepper_index, PSTR(" - communications lost\n"));
645
+        L6470_ECHO(temp_buf);
646
+      }
647
+      else {
648
+        driver_L6470_data[j].com_counter++;
649
+        if (driver_L6470_data[j].com_counter > 240) {  // remind of com problem about every 2 minutes
650
+          driver_L6470_data[j].com_counter = 1;
651
+          append_stepper_err(p, stepper_index, PSTR(" - still no communications\n"));
652
+          L6470_ECHO(temp_buf);
653
+        }
654
+      }
655
+    }
656
+    else {
657
+      if (driver_L6470_data[j].com_counter) {   // comms re-established
658
+        driver_L6470_data[j].com_counter = 0;
659
+        append_stepper_err(p, stepper_index, PSTR(" - communications re-established\n.. setting all drivers to default values\n"));
660
+        L6470_ECHO(temp_buf);
661
+        init_to_defaults();
662
+      }
663
+      else {
664
+        // no com problems - do the usual checks
665
+        if (_status & L6470_ERROR_MASK) {
666
+          append_stepper_err(p, stepper_index);
667
+
668
+          if (status & STATUS_HIZ) {                         // the driver has shut down  HiZ is active high
669
+            driver_L6470_data[j].is_hi_Z = true;
670
+            p += sprintf_P(p, PSTR("%cIS SHUT DOWN"), ' ');
671
+            //         if (_status & STATUS_TH_SD) {                     // strange - TH_SD never seems to go active, must be implied by the HiZ and TH_WRN
672
+            if (_status & STATUS_TH_WRN) {                    // over current shutdown
673
+              p += sprintf_P(p, PSTR("%cdue to over temperature"), ' ');
674
+              driver_L6470_data[j].is_ot = true;
675
+              kval_hold = get_param(stepper_index, L6470_KVAL_HOLD) - 2 * KVAL_HOLD_STEP_DOWN;
676
+              set_param(stepper_index, L6470_KVAL_HOLD, kval_hold);     // reduce KVAL_HOLD
677
+              p += sprintf_P(p, PSTR(" - KVAL_HOLD reduced by %d to %d"), 2 * KVAL_HOLD_STEP_DOWN, kval_hold);   // let user know
678
+            }
679
+            else
680
+              driver_L6470_data[j].is_ot = false;
681
+          }
682
+          else {
683
+            driver_L6470_data[j].is_hi_Z = false;
684
+
685
+            if (_status & STATUS_TH_WRN) {     // have an over temperature warning
686
+              driver_L6470_data[j].is_otw = true;
687
+              driver_L6470_data[j].otw_counter++;
688
+              kval_hold = get_param(stepper_index, L6470_KVAL_HOLD);
689
+              if (driver_L6470_data[j].otw_counter > 4) {  // otw present for 2 - 2.5 seconds, reduce KVAL_HOLD
690
+                kval_hold -= KVAL_HOLD_STEP_DOWN;
691
+                set_param(stepper_index, L6470_KVAL_HOLD, kval_hold);     // reduce KVAL_HOLD
692
+                p += sprintf_P(p, PSTR(" - KVAL_HOLD reduced by %d to %d"), KVAL_HOLD_STEP_DOWN, kval_hold);   // let user know
693
+                driver_L6470_data[j].otw_counter = 0;
694
+                driver_L6470_data[j].is_otw = true;
695
+              }
696
+              else if (driver_L6470_data[j].otw_counter)
697
+                p += sprintf_P(p, PSTR("%c- thermal warning"), ' ');   // warn user
698
+            }
699
+          }
700
+
701
+          #ifdef L6470_STOP_ON_ERROR
702
+            if (_status & (STATUS_UVLO | STATUS_TH_WRN | STATUS_TH_SD))
703
+            kill(temp_buf);
704
+          #endif
705
+
706
+
707
+          #if ENABLED(L6470_CHITCHAT)
708
+
709
+            if (_status & STATUS_OCD)
710
+            p += sprintf_P(p, PSTR("%c  over current"), ' ');
711
+
712
+            if (_status & (STATUS_STEP_LOSS_A | STATUS_STEP_LOSS_B))
713
+            p += sprintf_P(p, PSTR("%c  stall"), ' ');
714
+
715
+            if (_status & STATUS_UVLO)
716
+            p += sprintf_P(p, PSTR("%c  under voltage lock out"), ' ');
717
+
718
+            p += sprintf_P(p, PSTR("%c\n"), ' ');
719
+          #endif
720
+
721
+          L6470_ECHOLN(temp_buf);  // print the error message
722
+        }
723
+        else {
724
+          driver_L6470_data[j].is_ot = false;
725
+          driver_L6470_data[j].otw_counter = 0;   //clear out warning indicators
726
+          driver_L6470_data[j].is_otw = false;
727
+
728
+        } // end usual checks
729
+      } // comms established but have errors
730
+    } // comms re-established
731
+  } // end L6470_monitor_update()
732
+
733
+  #define MONITOR_L6470_DRIVE(Q) L6470_monitor_update(Q, stepper##Q.getStatus())
734
+
735
+  void L6470_Marlin::monitor_driver() {
736
+    static millis_t next_cOT = 0;
737
+    if (ELAPSED(millis(), next_cOT)) {
738
+      next_cOT = millis() + 500;
739
+
740
+      spi_active = true;    // let set_directions() know we're in the middle of a series of SPI transfers
741
+
742
+      #if AXIS_DRIVER_TYPE_X(L6470)
743
+        MONITOR_L6470_DRIVE(X);
744
+      #endif
745
+      #if AXIS_DRIVER_TYPE_Y(L6470)
746
+        MONITOR_L6470_DRIVE(Y);
747
+      #endif
748
+      #if AXIS_DRIVER_TYPE_Z(L6470)
749
+        MONITOR_L6470_DRIVE(Z);
750
+      #endif
751
+      #if AXIS_DRIVER_TYPE_X2(L6470)
752
+        MONITOR_L6470_DRIVE(X2);
753
+      #endif
754
+      #if AXIS_DRIVER_TYPE_Y2(L6470)
755
+        MONITOR_L6470_DRIVE(Y2);
756
+      #endif
757
+      #if AXIS_DRIVER_TYPE_Z2(L6470)
758
+        MONITOR_L6470_DRIVE(Z2);
759
+      #endif
760
+      #if AXIS_DRIVER_TYPE_Z3(L6470)
761
+        MONITOR_L6470_DRIVE(Z3);
762
+      #endif
763
+      #if AXIS_DRIVER_TYPE_E0(L6470)
764
+        MONITOR_L6470_DRIVE(E0);
765
+      #endif
766
+      #if AXIS_DRIVER_TYPE_E1(L6470)
767
+        MONITOR_L6470_DRIVE(E1);
768
+      #endif
769
+      #if AXIS_DRIVER_TYPE_E2(L6470)
770
+        MONITOR_L6470_DRIVE(E2);
771
+      #endif
772
+      #if AXIS_DRIVER_TYPE_E3(L6470)
773
+        MONITOR_L6470_DRIVE(E3);
774
+      #endif
775
+      #if AXIS_DRIVER_TYPE_E4(L6470)
776
+        MONITOR_L6470_DRIVE(E4);
777
+      #endif
778
+      #if AXIS_DRIVER_TYPE_E5(L6470)
779
+        MONITOR_L6470_DRIVE(E5);
780
+      #endif
781
+
782
+      #if ENABLED(L6470_DEBUG)
783
+        if (report_L6470_status) L6470_EOL();
784
+      #endif
785
+
786
+      spi_active = false;   // done with all SPI transfers - clear handshake flags
787
+      spi_abort = false;
788
+    }
789
+  }
790
+
791
+#endif // MONITOR_L6470_DRIVER_STATUS
792
+
793
+#endif // HAS_DRIVER(L6470)

+ 93
- 0
Marlin/src/libs/L6470/L6470_Marlin.h View File

@@ -0,0 +1,93 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2018 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
+
23
+#include "../../inc/MarlinConfig.h"
24
+
25
+#include <L6470.h>
26
+
27
+#if ENABLED(L6470_CHITCHAT)
28
+  #define L6470_EOL()           SERIAL_EOL()
29
+  #define L6470_CHAR(C)         SERIAL_CHAR(C)
30
+  #define L6470_ECHO(V)         SERIAL_ECHO(V)
31
+  #define L6470_ECHOLN(V)       SERIAL_ECHOLN(V)
32
+  #define L6470_ECHOPGM(S)      SERIAL_ECHOPGM(S)
33
+  #define L6470_ECHOLNPGM(S)    SERIAL_ECHOLNPGM(S)
34
+  #define L6470_ECHOPAIR(S,V)   SERIAL_ECHOPAIR(S,V)
35
+  #define L6470_ECHOLNPAIR(S,V) SERIAL_ECHOLNPAIR(S,V)
36
+#else
37
+  #define L6470_EOL()           NOOP
38
+  #define L6470_CHAR(C)         NOOP
39
+  #define L6470_ECHO(V)         NOOP
40
+  #define L6470_ECHOLN(V)       NOOP
41
+  #define L6470_ECHOPGM(S)      NOOP
42
+  #define L6470_ECHOLNPGM(S)    NOOP
43
+  #define L6470_ECHOPAIR(S,V)   NOOP
44
+  #define L6470_ECHOLNPAIR(S,V) NOOP
45
+#endif
46
+
47
+#define L6470_GETPARAM(P,Q) stepper##Q.GetParam(P)
48
+
49
+#define MAX_L6470  (7 + MAX_EXTRUDERS) // Maximum number of axes in Marlin
50
+
51
+#define L6470_ERROR_MASK  (STATUS_UVLO | STATUS_TH_WRN | STATUS_TH_SD  | STATUS_OCD | STATUS_STEP_LOSS_A | STATUS_STEP_LOSS_B)
52
+#define dSPIN_STEP_CLOCK_FWD dSPIN_STEP_CLOCK
53
+#define dSPIN_STEP_CLOCK_REV dSPIN_STEP_CLOCK+1
54
+#define HAS_L6470_EXTRUDER ( AXIS_DRIVER_TYPE_E0(L6470) || AXIS_DRIVER_TYPE_E1(L6470) || AXIS_DRIVER_TYPE_E2(L6470) \
55
+                          || AXIS_DRIVER_TYPE_E3(L6470) || AXIS_DRIVER_TYPE_E4(L6470) || AXIS_DRIVER_TYPE_E5(L6470) )
56
+
57
+class L6470_Marlin {
58
+public:
59
+  static bool index_to_dir[MAX_L6470];
60
+  static uint8_t axis_xref[MAX_L6470];
61
+  static char index_to_axis[MAX_L6470][3];
62
+  static uint8_t dir_commands[MAX_L6470];
63
+
64
+  // flags to guarantee graceful switch if stepper interrupts L6470 SPI transfer
65
+  static volatile bool spi_abort;
66
+  static bool spi_active;
67
+
68
+  L6470_Marlin() {}
69
+
70
+  static uint16_t get_status(const uint8_t axis);
71
+
72
+  static uint32_t get_param(uint8_t axis, uint8_t param);
73
+
74
+  static void set_param(uint8_t axis, uint8_t param, uint32_t value);
75
+
76
+  static bool get_user_input(uint8_t &driver_count, uint8_t axis_index[3], char axis_mon[3][3],
77
+                             float &position_max, float &position_min, float &final_feedrate, uint8_t &kval_hold,
78
+                             bool over_current_flag, uint8_t &OCD_TH_val, uint8_t &STALL_TH_val, uint16_t &over_current_threshold);
79
+
80
+  static void error_status_decode(const uint16_t status, const uint8_t axis);
81
+
82
+  static void monitor_driver();
83
+
84
+  static void init();
85
+  static void init_to_defaults();
86
+
87
+  static void say_axis(const uint8_t axis, const bool label=true);
88
+
89
+private:
90
+  void populate_chain_array();
91
+};
92
+
93
+extern L6470_Marlin L6470;

+ 50
- 11
Marlin/src/module/stepper.cpp View File

@@ -79,6 +79,8 @@
79 79
 
80 80
 #include "stepper.h"
81 81
 
82
+Stepper stepper; // Singleton
83
+
82 84
 #ifdef __AVR__
83 85
   #include "speed_lookuptable.h"
84 86
 #endif
@@ -107,12 +109,14 @@
107 109
   #include "../feature/mixing.h"
108 110
 #endif
109 111
 
110
-Stepper stepper; // Singleton
111
-
112 112
 #if FILAMENT_RUNOUT_DISTANCE_MM > 0
113 113
   #include "../feature/runout.h"
114 114
 #endif
115 115
 
116
+#if HAS_DRIVER(L6470)
117
+  #include "../libs/L6470/L6470_Marlin.h"
118
+#endif
119
+
116 120
 // public:
117 121
 
118 122
 #if ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS || ENABLED(Z_STEPPER_AUTO_ALIGN)
@@ -350,22 +354,28 @@ void Stepper::wake_up() {
350 354
  */
351 355
 void Stepper::set_directions() {
352 356
 
353
-  #define SET_STEP_DIR(A) \
354
-    if (motor_direction(_AXIS(A))) { \
355
-      A##_APPLY_DIR(INVERT_## A##_DIR, false); \
356
-      count_direction[_AXIS(A)] = -1; \
357
-    } \
358
-    else { \
357
+  #if HAS_DRIVER(L6470)
358
+    uint8_t L6470_buf[MAX_L6470 + 1];   // chip command sequence - element 0 not used
359
+  #endif
360
+
361
+  #define SET_STEP_DIR(A)                       \
362
+    if (motor_direction(_AXIS(A))) {            \
363
+      A##_APPLY_DIR(INVERT_## A##_DIR, false);  \
364
+      count_direction[_AXIS(A)] = -1;           \
365
+    }                                           \
366
+    else {                                      \
359 367
       A##_APPLY_DIR(!INVERT_## A##_DIR, false); \
360
-      count_direction[_AXIS(A)] = 1; \
368
+      count_direction[_AXIS(A)] = 1;            \
361 369
     }
362 370
 
363 371
   #if HAS_X_DIR
364 372
     SET_STEP_DIR(X); // A
365 373
   #endif
374
+
366 375
   #if HAS_Y_DIR
367 376
     SET_STEP_DIR(Y); // B
368 377
   #endif
378
+
369 379
   #if HAS_Z_DIR
370 380
     SET_STEP_DIR(Z); // C
371 381
   #endif
@@ -394,6 +404,27 @@ void Stepper::set_directions() {
394 404
     #endif
395 405
   #endif // !LIN_ADVANCE
396 406
 
407
+  #if HAS_DRIVER(L6470)
408
+
409
+    if (L6470.spi_active) {
410
+      L6470.spi_abort = true;                     // interrupted a SPI transfer - need to shut it down gracefully
411
+      for (uint8_t j = 1; j <= L6470::chain[0]; j++)
412
+        L6470_buf[j] = dSPIN_NOP;                 // fill buffer with NOOP commands
413
+      L6470.transfer(L6470_buf, L6470::chain[0]);  // send enough NOOPs to complete any command
414
+      L6470.transfer(L6470_buf, L6470::chain[0]);
415
+      L6470.transfer(L6470_buf, L6470::chain[0]);
416
+    }
417
+
418
+    // The L6470.dir_commands[] array holds the direction command for each stepper
419
+
420
+    //scan command array and copy matches into L6470.transfer
421
+    for (uint8_t j = 1; j <= L6470::chain[0]; j++)
422
+      L6470_buf[j] = L6470.dir_commands[L6470::chain[j]];
423
+
424
+    L6470.transfer(L6470_buf, L6470::chain[0]);  // send the command stream to the drivers
425
+
426
+  #endif
427
+
397 428
   // A small delay may be needed after changing direction
398 429
   #if MINIMUM_STEPPER_DIR_DELAY > 0
399 430
     DELAY_NS(MINIMUM_STEPPER_DIR_DELAY);
@@ -1766,10 +1797,15 @@ uint32_t Stepper::stepper_block_phase_isr() {
1766 1797
         else LA_isr_rate = LA_ADV_NEVER;
1767 1798
       #endif
1768 1799
 
1769
-      if (current_block->direction_bits != last_direction_bits
1800
+      if (
1801
+        #if HAS_DRIVER(L6470)
1802
+          true  // Always set direction for L6470 (This also enables the chips)
1803
+        #else
1804
+          current_block->direction_bits != last_direction_bits
1770 1805
           #if DISABLED(MIXING_EXTRUDER)
1771 1806
             || stepper_extruder != last_moved_extruder
1772 1807
           #endif
1808
+        #endif
1773 1809
       ) {
1774 1810
         last_direction_bits = current_block->direction_bits;
1775 1811
         #if EXTRUDERS > 1
@@ -2113,7 +2149,10 @@ void Stepper::init() {
2113 2149
   ENABLE_STEPPER_DRIVER_INTERRUPT();
2114 2150
 
2115 2151
   sei();
2116
-  set_directions(); // Init directions to last_direction_bits = 0  Keeps Z from being reversed
2152
+
2153
+  Z_DIR_WRITE(0);    // Init directions to last_direction_bits = 0  Keeps Z from being reversed
2154
+  Z2_DIR_WRITE(0);
2155
+  Z3_DIR_WRITE(0);
2117 2156
 }
2118 2157
 
2119 2158
 /**

+ 152
- 129
Marlin/src/module/stepper_indirection.cpp View File

@@ -37,6 +37,10 @@
37 37
 
38 38
 #include "../module/stepper.h"
39 39
 
40
+#if HAS_DRIVER(L6470)
41
+  #include "L6470/L6470_Marlin.h"
42
+#endif
43
+
40 44
 //
41 45
 // TMC26X Driver objects and inits
42 46
 //
@@ -51,43 +55,43 @@
51 55
 
52 56
   #define _TMC26X_DEFINE(ST) TMC26XStepper stepper##ST(200, ST##_CS_PIN, ST##_STEP_PIN, ST##_DIR_PIN, ST##_MAX_CURRENT, ST##_SENSE_RESISTOR)
53 57
 
54
-  #if AXIS_DRIVER_TYPE(X, TMC26X)
58
+  #if AXIS_DRIVER_TYPE_X(TMC26X)
55 59
     _TMC26X_DEFINE(X);
56 60
   #endif
57
-  #if AXIS_DRIVER_TYPE(X2, TMC26X)
61
+  #if AXIS_DRIVER_TYPE_X2(TMC26X)
58 62
     _TMC26X_DEFINE(X2);
59 63
   #endif
60
-  #if AXIS_DRIVER_TYPE(Y, TMC26X)
64
+  #if AXIS_DRIVER_TYPE_Y(TMC26X)
61 65
     _TMC26X_DEFINE(Y);
62 66
   #endif
63
-  #if AXIS_DRIVER_TYPE(Y2, TMC26X)
67
+  #if AXIS_DRIVER_TYPE_Y2(TMC26X)
64 68
     _TMC26X_DEFINE(Y2);
65 69
   #endif
66
-  #if AXIS_DRIVER_TYPE(Z, TMC26X)
70
+  #if AXIS_DRIVER_TYPE_Z(TMC26X)
67 71
     _TMC26X_DEFINE(Z);
68 72
   #endif
69
-  #if AXIS_DRIVER_TYPE(Z2, TMC26X)
73
+  #if AXIS_DRIVER_TYPE_Z2(TMC26X)
70 74
     _TMC26X_DEFINE(Z2);
71 75
   #endif
72
-  #if AXIS_DRIVER_TYPE(Z3, TMC26X)
76
+  #if AXIS_DRIVER_TYPE_Z3(TMC26X)
73 77
     _TMC26X_DEFINE(Z3);
74 78
   #endif
75
-  #if AXIS_DRIVER_TYPE(E0, TMC26X)
79
+  #if AXIS_DRIVER_TYPE_E0(TMC26X)
76 80
     _TMC26X_DEFINE(E0);
77 81
   #endif
78
-  #if AXIS_DRIVER_TYPE(E1, TMC26X)
82
+  #if AXIS_DRIVER_TYPE_E1(TMC26X)
79 83
     _TMC26X_DEFINE(E1);
80 84
   #endif
81
-  #if AXIS_DRIVER_TYPE(E2, TMC26X)
85
+  #if AXIS_DRIVER_TYPE_E2(TMC26X)
82 86
     _TMC26X_DEFINE(E2);
83 87
   #endif
84
-  #if AXIS_DRIVER_TYPE(E3, TMC26X)
88
+  #if AXIS_DRIVER_TYPE_E3(TMC26X)
85 89
     _TMC26X_DEFINE(E3);
86 90
   #endif
87
-  #if AXIS_DRIVER_TYPE(E4, TMC26X)
91
+  #if AXIS_DRIVER_TYPE_E4(TMC26X)
88 92
     _TMC26X_DEFINE(E4);
89 93
   #endif
90
-  #if AXIS_DRIVER_TYPE(E5, TMC26X)
94
+  #if AXIS_DRIVER_TYPE_E5(TMC26X)
91 95
     _TMC26X_DEFINE(E5);
92 96
   #endif
93 97
 
@@ -97,43 +101,43 @@
97 101
   }while(0)
98 102
 
99 103
   void tmc26x_init_to_defaults() {
100
-    #if AXIS_DRIVER_TYPE(X, TMC26X)
104
+    #if AXIS_DRIVER_TYPE_X(TMC26X)
101 105
       _TMC26X_INIT(X);
102 106
     #endif
103
-    #if AXIS_DRIVER_TYPE(X2, TMC26X)
107
+    #if AXIS_DRIVER_TYPE_X2(TMC26X)
104 108
       _TMC26X_INIT(X2);
105 109
     #endif
106
-    #if AXIS_DRIVER_TYPE(Y, TMC26X)
110
+    #if AXIS_DRIVER_TYPE_Y(TMC26X)
107 111
       _TMC26X_INIT(Y);
108 112
     #endif
109
-    #if AXIS_DRIVER_TYPE(Y2, TMC26X)
113
+    #if AXIS_DRIVER_TYPE_Y2(TMC26X)
110 114
       _TMC26X_INIT(Y2);
111 115
     #endif
112
-    #if AXIS_DRIVER_TYPE(Z, TMC26X)
116
+    #if AXIS_DRIVER_TYPE_Z(TMC26X)
113 117
       _TMC26X_INIT(Z);
114 118
     #endif
115
-    #if AXIS_DRIVER_TYPE(Z2, TMC26X)
119
+    #if AXIS_DRIVER_TYPE_Z2(TMC26X)
116 120
       _TMC26X_INIT(Z2);
117 121
     #endif
118
-    #if AXIS_DRIVER_TYPE(Z3, TMC26X)
122
+    #if AXIS_DRIVER_TYPE_Z3(TMC26X)
119 123
       _TMC26X_INIT(Z3);
120 124
     #endif
121
-    #if AXIS_DRIVER_TYPE(E0, TMC26X)
125
+    #if AXIS_DRIVER_TYPE_E0(TMC26X)
122 126
       _TMC26X_INIT(E0);
123 127
     #endif
124
-    #if AXIS_DRIVER_TYPE(E1, TMC26X)
128
+    #if AXIS_DRIVER_TYPE_E1(TMC26X)
125 129
       _TMC26X_INIT(E1);
126 130
     #endif
127
-    #if AXIS_DRIVER_TYPE(E2, TMC26X)
131
+    #if AXIS_DRIVER_TYPE_E2(TMC26X)
128 132
       _TMC26X_INIT(E2);
129 133
     #endif
130
-    #if AXIS_DRIVER_TYPE(E3, TMC26X)
134
+    #if AXIS_DRIVER_TYPE_E3(TMC26X)
131 135
       _TMC26X_INIT(E3);
132 136
     #endif
133
-    #if AXIS_DRIVER_TYPE(E4, TMC26X)
137
+    #if AXIS_DRIVER_TYPE_E4(TMC26X)
134 138
       _TMC26X_INIT(E4);
135 139
     #endif
136
-    #if AXIS_DRIVER_TYPE(E5, TMC26X)
140
+    #if AXIS_DRIVER_TYPE_E5(TMC26X)
137 141
       _TMC26X_INIT(E5);
138 142
     #endif
139 143
   }
@@ -161,43 +165,43 @@
161 165
     #define TMC2130_DEFINE(ST) _TMC2130_DEFINE(ST, TMC_##ST##_LABEL)
162 166
   #endif
163 167
   // Stepper objects of TMC2130 steppers used
164
-  #if AXIS_DRIVER_TYPE(X, TMC2130)
168
+  #if AXIS_DRIVER_TYPE_X(TMC2130)
165 169
     TMC2130_DEFINE(X);
166 170
   #endif
167
-  #if AXIS_DRIVER_TYPE(X2, TMC2130)
171
+  #if AXIS_DRIVER_TYPE_X2(TMC2130)
168 172
     TMC2130_DEFINE(X2);
169 173
   #endif
170
-  #if AXIS_DRIVER_TYPE(Y, TMC2130)
174
+  #if AXIS_DRIVER_TYPE_Y(TMC2130)
171 175
     TMC2130_DEFINE(Y);
172 176
   #endif
173
-  #if AXIS_DRIVER_TYPE(Y2, TMC2130)
177
+  #if AXIS_DRIVER_TYPE_Y2(TMC2130)
174 178
     TMC2130_DEFINE(Y2);
175 179
   #endif
176
-  #if AXIS_DRIVER_TYPE(Z, TMC2130)
180
+  #if AXIS_DRIVER_TYPE_Z(TMC2130)
177 181
     TMC2130_DEFINE(Z);
178 182
   #endif
179
-  #if AXIS_DRIVER_TYPE(Z2, TMC2130)
183
+  #if AXIS_DRIVER_TYPE_Z2(TMC2130)
180 184
     TMC2130_DEFINE(Z2);
181 185
   #endif
182
-  #if AXIS_DRIVER_TYPE(Z3, TMC2130)
186
+  #if AXIS_DRIVER_TYPE_Z3(TMC2130)
183 187
     TMC2130_DEFINE(Z3);
184 188
   #endif
185
-  #if AXIS_DRIVER_TYPE(E0, TMC2130)
189
+  #if AXIS_DRIVER_TYPE_E0(TMC2130)
186 190
     TMC2130_DEFINE(E0);
187 191
   #endif
188
-  #if AXIS_DRIVER_TYPE(E1, TMC2130)
192
+  #if AXIS_DRIVER_TYPE_E1(TMC2130)
189 193
     TMC2130_DEFINE(E1);
190 194
   #endif
191
-  #if AXIS_DRIVER_TYPE(E2, TMC2130)
195
+  #if AXIS_DRIVER_TYPE_E2(TMC2130)
192 196
     TMC2130_DEFINE(E2);
193 197
   #endif
194
-  #if AXIS_DRIVER_TYPE(E3, TMC2130)
198
+  #if AXIS_DRIVER_TYPE_E3(TMC2130)
195 199
     TMC2130_DEFINE(E3);
196 200
   #endif
197
-  #if AXIS_DRIVER_TYPE(E4, TMC2130)
201
+  #if AXIS_DRIVER_TYPE_E4(TMC2130)
198 202
     TMC2130_DEFINE(E4);
199 203
   #endif
200
-  #if AXIS_DRIVER_TYPE(E5, TMC2130)
204
+  #if AXIS_DRIVER_TYPE_E5(TMC2130)
201 205
     TMC2130_DEFINE(E5);
202 206
   #endif
203 207
 
@@ -253,91 +257,91 @@
253 257
   #define TMC2208_DEFINE_SOFTWARE(ST) _TMC2208_DEFINE_SOFTWARE(ST, TMC_##ST##_LABEL)
254 258
 
255 259
   // Stepper objects of TMC2208 steppers used
256
-  #if AXIS_DRIVER_TYPE(X, TMC2208)
260
+  #if AXIS_DRIVER_TYPE_X(TMC2208)
257 261
     #ifdef X_HARDWARE_SERIAL
258 262
       TMC2208_DEFINE_HARDWARE(X);
259 263
     #else
260 264
       TMC2208_DEFINE_SOFTWARE(X);
261 265
     #endif
262 266
   #endif
263
-  #if AXIS_DRIVER_TYPE(X2, TMC2208)
267
+  #if AXIS_DRIVER_TYPE_X2(TMC2208)
264 268
     #ifdef X2_HARDWARE_SERIAL
265 269
       TMC2208_DEFINE_HARDWARE(X2);
266 270
     #else
267 271
       TMC2208_DEFINE_SOFTWARE(X2);
268 272
     #endif
269 273
   #endif
270
-  #if AXIS_DRIVER_TYPE(Y, TMC2208)
274
+  #if AXIS_DRIVER_TYPE_Y(TMC2208)
271 275
     #ifdef Y_HARDWARE_SERIAL
272 276
       TMC2208_DEFINE_HARDWARE(Y);
273 277
     #else
274 278
       TMC2208_DEFINE_SOFTWARE(Y);
275 279
     #endif
276 280
   #endif
277
-  #if AXIS_DRIVER_TYPE(Y2, TMC2208)
281
+  #if AXIS_DRIVER_TYPE_Y2(TMC2208)
278 282
     #ifdef Y2_HARDWARE_SERIAL
279 283
       TMC2208_DEFINE_HARDWARE(Y2);
280 284
     #else
281 285
       TMC2208_DEFINE_SOFTWARE(Y2);
282 286
     #endif
283 287
   #endif
284
-  #if AXIS_DRIVER_TYPE(Z, TMC2208)
288
+  #if AXIS_DRIVER_TYPE_Z(TMC2208)
285 289
     #ifdef Z_HARDWARE_SERIAL
286 290
       TMC2208_DEFINE_HARDWARE(Z);
287 291
     #else
288 292
       TMC2208_DEFINE_SOFTWARE(Z);
289 293
     #endif
290 294
   #endif
291
-  #if AXIS_DRIVER_TYPE(Z2, TMC2208)
295
+  #if AXIS_DRIVER_TYPE_Z2(TMC2208)
292 296
     #ifdef Z2_HARDWARE_SERIAL
293 297
       TMC2208_DEFINE_HARDWARE(Z2);
294 298
     #else
295 299
       TMC2208_DEFINE_SOFTWARE(Z2);
296 300
     #endif
297 301
   #endif
298
-  #if AXIS_DRIVER_TYPE(Z3, TMC2208)
302
+  #if AXIS_DRIVER_TYPE_Z3(TMC2208)
299 303
     #ifdef Z3_HARDWARE_SERIAL
300 304
       TMC2208_DEFINE_HARDWARE(Z3);
301 305
     #else
302 306
       TMC2208_DEFINE_SOFTWARE(Z3);
303 307
     #endif
304 308
   #endif
305
-  #if AXIS_DRIVER_TYPE(E0, TMC2208)
309
+  #if AXIS_DRIVER_TYPE_E0(TMC2208)
306 310
     #ifdef E0_HARDWARE_SERIAL
307 311
       TMC2208_DEFINE_HARDWARE(E0);
308 312
     #else
309 313
       TMC2208_DEFINE_SOFTWARE(E0);
310 314
     #endif
311 315
   #endif
312
-  #if AXIS_DRIVER_TYPE(E1, TMC2208)
316
+  #if AXIS_DRIVER_TYPE_E1(TMC2208)
313 317
     #ifdef E1_HARDWARE_SERIAL
314 318
       TMC2208_DEFINE_HARDWARE(E1);
315 319
     #else
316 320
       TMC2208_DEFINE_SOFTWARE(E1);
317 321
     #endif
318 322
   #endif
319
-  #if AXIS_DRIVER_TYPE(E2, TMC2208)
323
+  #if AXIS_DRIVER_TYPE_E2(TMC2208)
320 324
     #ifdef E2_HARDWARE_SERIAL
321 325
       TMC2208_DEFINE_HARDWARE(E2);
322 326
     #else
323 327
       TMC2208_DEFINE_SOFTWARE(E2);
324 328
     #endif
325 329
   #endif
326
-  #if AXIS_DRIVER_TYPE(E3, TMC2208)
330
+  #if AXIS_DRIVER_TYPE_E3(TMC2208)
327 331
     #ifdef E3_HARDWARE_SERIAL
328 332
       TMC2208_DEFINE_HARDWARE(E3);
329 333
     #else
330 334
       TMC2208_DEFINE_SOFTWARE(E3);
331 335
     #endif
332 336
   #endif
333
-  #if AXIS_DRIVER_TYPE(E4, TMC2208)
337
+  #if AXIS_DRIVER_TYPE_E4(TMC2208)
334 338
     #ifdef E4_HARDWARE_SERIAL
335 339
       TMC2208_DEFINE_HARDWARE(E4);
336 340
     #else
337 341
       TMC2208_DEFINE_SOFTWARE(E4);
338 342
     #endif
339 343
   #endif
340
-  #if AXIS_DRIVER_TYPE(E5, TMC2208)
344
+  #if AXIS_DRIVER_TYPE_E5(TMC2208)
341 345
     #ifdef E5_HARDWARE_SERIAL
342 346
       TMC2208_DEFINE_HARDWARE(E5);
343 347
     #else
@@ -346,91 +350,91 @@
346 350
   #endif
347 351
 
348 352
   void tmc2208_serial_begin() {
349
-    #if AXIS_DRIVER_TYPE(X, TMC2208)
353
+    #if AXIS_DRIVER_TYPE_X(TMC2208)
350 354
       #ifdef X_HARDWARE_SERIAL
351 355
         X_HARDWARE_SERIAL.begin(115200);
352 356
       #else
353 357
         stepperX.beginSerial(115200);
354 358
       #endif
355 359
     #endif
356
-    #if AXIS_DRIVER_TYPE(X2, TMC2208)
360
+    #if AXIS_DRIVER_TYPE_X2(TMC2208)
357 361
       #ifdef X2_HARDWARE_SERIAL
358 362
         X2_HARDWARE_SERIAL.begin(115200);
359 363
       #else
360 364
         stepperX2.beginSerial(115200);
361 365
       #endif
362 366
     #endif
363
-    #if AXIS_DRIVER_TYPE(Y, TMC2208)
367
+    #if AXIS_DRIVER_TYPE_Y(TMC2208)
364 368
       #ifdef Y_HARDWARE_SERIAL
365 369
         Y_HARDWARE_SERIAL.begin(115200);
366 370
       #else
367 371
         stepperY.beginSerial(115200);
368 372
       #endif
369 373
     #endif
370
-    #if AXIS_DRIVER_TYPE(Y2, TMC2208)
374
+    #if AXIS_DRIVER_TYPE_Y2(TMC2208)
371 375
       #ifdef Y2_HARDWARE_SERIAL
372 376
         Y2_HARDWARE_SERIAL.begin(115200);
373 377
       #else
374 378
         stepperY2.beginSerial(115200);
375 379
       #endif
376 380
     #endif
377
-    #if AXIS_DRIVER_TYPE(Z, TMC2208)
381
+    #if AXIS_DRIVER_TYPE_Z(TMC2208)
378 382
       #ifdef Z_HARDWARE_SERIAL
379 383
         Z_HARDWARE_SERIAL.begin(115200);
380 384
       #else
381 385
         stepperZ.beginSerial(115200);
382 386
       #endif
383 387
     #endif
384
-    #if AXIS_DRIVER_TYPE(Z2, TMC2208)
388
+    #if AXIS_DRIVER_TYPE_Z2(TMC2208)
385 389
       #ifdef Z2_HARDWARE_SERIAL
386 390
         Z2_HARDWARE_SERIAL.begin(115200);
387 391
       #else
388 392
         stepperZ2.beginSerial(115200);
389 393
       #endif
390 394
     #endif
391
-    #if AXIS_DRIVER_TYPE(Z3, TMC2208)
395
+    #if AXIS_DRIVER_TYPE_Z3(TMC2208)
392 396
       #ifdef Z3_HARDWARE_SERIAL
393 397
         Z3_HARDWARE_SERIAL.begin(115200);
394 398
       #else
395 399
         stepperZ3.beginSerial(115200);
396 400
       #endif
397 401
     #endif
398
-    #if AXIS_DRIVER_TYPE(E0, TMC2208)
402
+    #if AXIS_DRIVER_TYPE_E0(TMC2208)
399 403
       #ifdef E0_HARDWARE_SERIAL
400 404
         E0_HARDWARE_SERIAL.begin(115200);
401 405
       #else
402 406
         stepperE0.beginSerial(115200);
403 407
       #endif
404 408
     #endif
405
-    #if AXIS_DRIVER_TYPE(E1, TMC2208)
409
+    #if AXIS_DRIVER_TYPE_E1(TMC2208)
406 410
       #ifdef E1_HARDWARE_SERIAL
407 411
         E1_HARDWARE_SERIAL.begin(115200);
408 412
       #else
409 413
         stepperE1.beginSerial(115200);
410 414
       #endif
411 415
     #endif
412
-    #if AXIS_DRIVER_TYPE(E2, TMC2208)
416
+    #if AXIS_DRIVER_TYPE_E2(TMC2208)
413 417
       #ifdef E2_HARDWARE_SERIAL
414 418
         E2_HARDWARE_SERIAL.begin(115200);
415 419
       #else
416 420
         stepperE2.beginSerial(115200);
417 421
       #endif
418 422
     #endif
419
-    #if AXIS_DRIVER_TYPE(E3, TMC2208)
423
+    #if AXIS_DRIVER_TYPE_E3(TMC2208)
420 424
       #ifdef E3_HARDWARE_SERIAL
421 425
         E3_HARDWARE_SERIAL.begin(115200);
422 426
       #else
423 427
         stepperE3.beginSerial(115200);
424 428
       #endif
425 429
     #endif
426
-    #if AXIS_DRIVER_TYPE(E4, TMC2208)
430
+    #if AXIS_DRIVER_TYPE_E4(TMC2208)
427 431
       #ifdef E4_HARDWARE_SERIAL
428 432
         E4_HARDWARE_SERIAL.begin(115200);
429 433
       #else
430 434
         stepperE4.beginSerial(115200);
431 435
       #endif
432 436
     #endif
433
-    #if AXIS_DRIVER_TYPE(E5, TMC2208)
437
+    #if AXIS_DRIVER_TYPE_E5(TMC2208)
434 438
       #ifdef E5_HARDWARE_SERIAL
435 439
         E5_HARDWARE_SERIAL.begin(115200);
436 440
       #else
@@ -502,40 +506,40 @@
502 506
   #endif
503 507
 
504 508
   // Stepper objects of TMC2660 steppers used
505
-  #if AXIS_DRIVER_TYPE(X, TMC2660)
509
+  #if AXIS_DRIVER_TYPE_X(TMC2660)
506 510
     TMC2660_DEFINE(X);
507 511
   #endif
508
-  #if AXIS_DRIVER_TYPE(X2, TMC2660)
512
+  #if AXIS_DRIVER_TYPE_X2(TMC2660)
509 513
     TMC2660_DEFINE(X2);
510 514
   #endif
511
-  #if AXIS_DRIVER_TYPE(Y, TMC2660)
515
+  #if AXIS_DRIVER_TYPE_Y(TMC2660)
512 516
     TMC2660_DEFINE(Y);
513 517
   #endif
514
-  #if AXIS_DRIVER_TYPE(Y2, TMC2660)
518
+  #if AXIS_DRIVER_TYPE_Y2(TMC2660)
515 519
     TMC2660_DEFINE(Y2);
516 520
   #endif
517
-  #if AXIS_DRIVER_TYPE(Z, TMC2660)
521
+  #if AXIS_DRIVER_TYPE_Z(TMC2660)
518 522
     TMC2660_DEFINE(Z);
519 523
   #endif
520
-  #if AXIS_DRIVER_TYPE(Z2, TMC2660)
524
+  #if AXIS_DRIVER_TYPE_Z2(TMC2660)
521 525
     TMC2660_DEFINE(Z2);
522 526
   #endif
523
-  #if AXIS_DRIVER_TYPE(E0, TMC2660)
527
+  #if AXIS_DRIVER_TYPE_E0(TMC2660)
524 528
     TMC2660_DEFINE(E0);
525 529
   #endif
526
-  #if AXIS_DRIVER_TYPE(E1, TMC2660)
530
+  #if AXIS_DRIVER_TYPE_E1(TMC2660)
527 531
     TMC2660_DEFINE(E1);
528 532
   #endif
529
-  #if AXIS_DRIVER_TYPE(E2, TMC2660)
533
+  #if AXIS_DRIVER_TYPE_E2(TMC2660)
530 534
     TMC2660_DEFINE(E2);
531 535
   #endif
532
-  #if AXIS_DRIVER_TYPE(E3, TMC2660)
536
+  #if AXIS_DRIVER_TYPE_E3(TMC2660)
533 537
     TMC2660_DEFINE(E3);
534 538
   #endif
535
-  #if AXIS_DRIVER_TYPE(E4, TMC2660)
539
+  #if AXIS_DRIVER_TYPE_E4(TMC2660)
536 540
     TMC2660_DEFINE(E4);
537 541
   #endif
538
-  #if AXIS_DRIVER_TYPE(E5, TMC2660)
542
+  #if AXIS_DRIVER_TYPE_E5(TMC2660)
539 543
     TMC2660_DEFINE(E5);
540 544
   #endif
541 545
 
@@ -600,11 +604,13 @@ void restore_stepper_drivers() {
600 604
 }
601 605
 
602 606
 void reset_stepper_drivers() {
607
+
603 608
   #if HAS_DRIVER(TMC26X)
604 609
     tmc26x_init_to_defaults();
605 610
   #endif
606
-  #if ENABLED(HAVE_L6470DRIVER)
607
-    L6470_init_to_defaults();
611
+
612
+  #if HAS_DRIVER(L6470)
613
+    L6470.init_to_defaults();
608 614
   #endif
609 615
 
610 616
   #if HAS_TRINAMIC
@@ -703,7 +709,9 @@ void reset_stepper_drivers() {
703 709
     TMC_ADV()
704 710
   #endif
705 711
 
706
-  stepper.set_directions();
712
+  #if HAS_TRINAMIC
713
+    stepper.set_directions();
714
+  #endif
707 715
 }
708 716
 
709 717
 //
@@ -711,99 +719,114 @@ void reset_stepper_drivers() {
711 719
 //
712 720
 #if HAS_DRIVER(L6470)
713 721
 
714
-  #include <SPI.h>
715
-  #include <L6470.h>
722
+  // create stepper objects
716 723
 
717
-  #define _L6470_DEFINE(ST) L6470 stepper##ST(ST##_ENABLE_PIN)
724
+  #define _L6470_DEFINE(ST) L6470 stepper##ST((const int)L6470_CHAIN_SS_PIN)
718 725
 
719 726
   // L6470 Stepper objects
720
-  #if AXIS_DRIVER_TYPE(X, L6470)
727
+  #if AXIS_DRIVER_TYPE_X(L6470)
721 728
     _L6470_DEFINE(X);
722 729
   #endif
723
-  #if AXIS_DRIVER_TYPE(X2, L6470)
730
+  #if AXIS_DRIVER_TYPE_X2(L6470)
724 731
     _L6470_DEFINE(X2);
725 732
   #endif
726
-  #if AXIS_DRIVER_TYPE(Y, L6470)
733
+  #if AXIS_DRIVER_TYPE_Y(L6470)
727 734
     _L6470_DEFINE(Y);
728 735
   #endif
729
-  #if AXIS_DRIVER_TYPE(Y2, L6470)
736
+  #if AXIS_DRIVER_TYPE_Y2(L6470)
730 737
     _L6470_DEFINE(Y2);
731 738
   #endif
732
-  #if AXIS_DRIVER_TYPE(Z, L6470)
739
+  #if AXIS_DRIVER_TYPE_Z(L6470)
733 740
     _L6470_DEFINE(Z);
734 741
   #endif
735
-  #if AXIS_DRIVER_TYPE(Z2, L6470)
742
+  #if AXIS_DRIVER_TYPE_Z2(L6470)
736 743
     _L6470_DEFINE(Z2);
737 744
   #endif
738
-  #if AXIS_DRIVER_TYPE(Z3, L6470)
745
+  #if AXIS_DRIVER_TYPE_Z3(L6470)
739 746
     _L6470_DEFINE(Z3);
740 747
   #endif
741
-  #if AXIS_DRIVER_TYPE(E0, L6470)
748
+  #if AXIS_DRIVER_TYPE_E0(L6470)
742 749
     _L6470_DEFINE(E0);
743 750
   #endif
744
-  #if AXIS_DRIVER_TYPE(E1, L6470)
751
+  #if AXIS_DRIVER_TYPE_E1(L6470)
745 752
     _L6470_DEFINE(E1);
746 753
   #endif
747
-  #if AXIS_DRIVER_TYPE(E2, L6470)
754
+  #if AXIS_DRIVER_TYPE_E2(L6470)
748 755
     _L6470_DEFINE(E2);
749 756
   #endif
750
-  #if AXIS_DRIVER_TYPE(E3, L6470)
757
+  #if AXIS_DRIVER_TYPE_E3(L6470)
751 758
     _L6470_DEFINE(E3);
752 759
   #endif
753
-  #if AXIS_DRIVER_TYPE(E4, L6470)
760
+  #if AXIS_DRIVER_TYPE_E4(L6470)
754 761
     _L6470_DEFINE(E4);
755 762
   #endif
756
-  #if AXIS_DRIVER_TYPE(E5, L6470)
763
+  #if AXIS_DRIVER_TYPE_E5(L6470)
757 764
     _L6470_DEFINE(E5);
758 765
   #endif
759 766
 
760
-  #define _L6470_INIT(A) do{ \
761
-    stepper##A.init(); \
762
-    stepper##A.softFree(); \
763
-    stepper##A.setMicroSteps(A##_MICROSTEPS); \
764
-    stepper##A.setOverCurrent(A##_OVERCURRENT); \
765
-    stepper##A.setStallCurrent(A##_STALLCURRENT); \
767
+  // not using L6470 library's init command because it
768
+  // briefly sends power to the steppers
769
+
770
+  #define _L6470_INIT_CHIP(Q) do{                             \
771
+    stepper##Q.resetDev();                                    \
772
+    stepper##Q.softFree();                                    \
773
+    stepper##Q.SetParam(L6470_CONFIG, CONFIG_PWM_DIV_1        \
774
+                                    | CONFIG_PWM_MUL_2        \
775
+                                    | CONFIG_SR_290V_us       \
776
+                                    | CONFIG_OC_SD_DISABLE    \
777
+                                    | CONFIG_VS_COMP_DISABLE  \
778
+                                    | CONFIG_SW_HARD_STOP     \
779
+                                    | CONFIG_INT_16MHZ);      \
780
+    stepper##Q.SetParam(L6470_KVAL_RUN, 0xFF);                \
781
+    stepper##Q.SetParam(L6470_KVAL_ACC, 0xFF);                \
782
+    stepper##Q.SetParam(L6470_KVAL_DEC, 0xFF);                \
783
+    stepper##Q.setMicroSteps(Q##_MICROSTEPS);                 \
784
+    stepper##Q.setOverCurrent(Q##_OVERCURRENT);               \
785
+    stepper##Q.setStallCurrent(Q##_STALLCURRENT);             \
786
+    stepper##Q.SetParam(L6470_KVAL_HOLD, Q##_MAX_VOLTAGE);    \
787
+    stepper##Q.SetParam(L6470_ABS_POS, 0);                    \
788
+    stepper##Q.getStatus();                                   \
766 789
   }while(0)
767 790
 
768
-  void L6470_init_to_defaults() {
769
-    #if AXIS_DRIVER_TYPE(X, L6470)
770
-      _L6470_INIT(X);
791
+  void L6470_Marlin::init_to_defaults() {
792
+    #if AXIS_DRIVER_TYPE_X(L6470)
793
+      _L6470_INIT_CHIP(X);
771 794
     #endif
772
-    #if AXIS_DRIVER_TYPE(X2, L6470)
773
-      _L6470_INIT(X2);
795
+    #if AXIS_DRIVER_TYPE_X2(L6470)
796
+      _L6470_INIT_CHIP(X2);
774 797
     #endif
775
-    #if AXIS_DRIVER_TYPE(Y, L6470)
776
-      _L6470_INIT(Y);
798
+    #if AXIS_DRIVER_TYPE_Y(L6470)
799
+      _L6470_INIT_CHIP(Y);
777 800
     #endif
778
-    #if AXIS_DRIVER_TYPE(Y2, L6470)
779
-      _L6470_INIT(Y2);
801
+    #if AXIS_DRIVER_TYPE_Y2(L6470)
802
+      _L6470_INIT_CHIP(Y2);
780 803
     #endif
781
-    #if AXIS_DRIVER_TYPE(Z, L6470)
782
-      _L6470_INIT(Z);
804
+    #if AXIS_DRIVER_TYPE_Z(L6470)
805
+      _L6470_INIT_CHIP(Z);
783 806
     #endif
784
-    #if AXIS_DRIVER_TYPE(Z2, L6470)
785
-      _L6470_INIT(Z2);
807
+    #if AXIS_DRIVER_TYPE_Z2(L6470)
808
+      _L6470_INIT_CHIP(Z2);
786 809
     #endif
787
-    #if AXIS_DRIVER_TYPE(Z3, L6470)
788
-      _L6470_INIT(Z3);
810
+    #if AXIS_DRIVER_TYPE_Z3(L6470)
811
+      _L6470_INIT_CHIP(Z3);
789 812
     #endif
790
-    #if AXIS_DRIVER_TYPE(E0, L6470)
791
-      _L6470_INIT(E0);
813
+    #if AXIS_DRIVER_TYPE_E0(L6470)
814
+      _L6470_INIT_CHIP(E0);
792 815
     #endif
793
-    #if AXIS_DRIVER_TYPE(E1, L6470)
794
-      _L6470_INIT(E1);
816
+    #if AXIS_DRIVER_TYPE_E1(L6470)
817
+      _L6470_INIT_CHIP(E1);
795 818
     #endif
796
-    #if AXIS_DRIVER_TYPE(E2, L6470)
797
-      _L6470_INIT(E2);
819
+    #if AXIS_DRIVER_TYPE_E2(L6470)
820
+      _L6470_INIT_CHIP(E2);
798 821
     #endif
799
-    #if AXIS_DRIVER_TYPE(E3, L6470)
800
-      _L6470_INIT(E3);
822
+    #if AXIS_DRIVER_TYPE_E3(L6470)
823
+      _L6470_INIT_CHIP(E3);
801 824
     #endif
802
-    #if AXIS_DRIVER_TYPE(E4, L6470)
803
-      _L6470_INIT(E4);
825
+    #if AXIS_DRIVER_TYPE_E4(L6470)
826
+      _L6470_INIT_CHIP(E4);
804 827
     #endif
805
-    #if AXIS_DRIVER_TYPE(E5, L6470)
806
-      _L6470_INIT(E5);
828
+    #if AXIS_DRIVER_TYPE_E5(L6470)
829
+      _L6470_INIT_CHIP(E5);
807 830
     #endif
808 831
   }
809 832
 

+ 59
- 177
Marlin/src/module/stepper_indirection.h View File

@@ -83,28 +83,27 @@
83 83
 
84 84
 // L6470 has STEP on normal pins, but DIR/ENABLE via SPI
85 85
 #if HAS_DRIVER(L6470)
86
-  #include <SPI.h>
87
-  #include <L6470.h>
88
-  void L6470_init_to_defaults();
86
+  #include "L6470/L6470_Marlin.h"
87
+  #define L6470_WRITE_DIR_COMMAND(STATE,Q) do{ L6470_dir_commands[Q] = (STATE ?  dSPIN_STEP_CLOCK_REV : dSPIN_STEP_CLOCK_FWD); }while(0)
89 88
 #endif
90 89
 
91 90
 void restore_stepper_drivers();  // Called by PSU_ON
92 91
 void reset_stepper_drivers();    // Called by settings.load / settings.reset
93 92
 
94 93
 // X Stepper
95
-#if AXIS_DRIVER_TYPE(X, L6470)
94
+#if AXIS_DRIVER_TYPE_X(L6470)
96 95
   extern L6470 stepperX;
97 96
   #define X_ENABLE_INIT NOOP
98
-  #define X_ENABLE_WRITE(STATE) do{ if (STATE) stepperX.Step_Clock(stepperX.getStatus() & STATUS_HIZ); else stepperX.softFree(); }while(0)
97
+  #define X_ENABLE_WRITE(STATE) NOOP
99 98
   #define X_ENABLE_READ (stepperX.getStatus() & STATUS_HIZ)
100 99
   #define X_DIR_INIT NOOP
101
-  #define X_DIR_WRITE(STATE) stepperX.Step_Clock(STATE)
100
+  #define X_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,X)
102 101
   #define X_DIR_READ (stepperX.getStatus() & STATUS_DIR)
103 102
 #else
104 103
   #if AXIS_IS_TMC(X)
105 104
     extern TMC_CLASS(X) stepperX;
106 105
   #endif
107
-  #if AXIS_DRIVER_TYPE(X, TMC26X)
106
+  #if AXIS_DRIVER_TYPE_X(TMC26X)
108 107
     extern TMC26XStepper stepperX;
109 108
     #define X_ENABLE_INIT NOOP
110 109
     #define X_ENABLE_WRITE(STATE) stepperX.setEnabled(STATE)
@@ -127,19 +126,19 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
127 126
 #define X_STEP_READ READ(X_STEP_PIN)
128 127
 
129 128
 // Y Stepper
130
-#if AXIS_DRIVER_TYPE(Y, L6470)
129
+#if AXIS_DRIVER_TYPE_Y(L6470)
131 130
   extern L6470 stepperY;
132 131
   #define Y_ENABLE_INIT NOOP
133
-  #define Y_ENABLE_WRITE(STATE) do{ if (STATE) stepperY.Step_Clock(stepperY.getStatus() & STATUS_HIZ); else stepperY.softFree(); }while(0)
132
+  #define Y_ENABLE_WRITE(STATE) NOOP
134 133
   #define Y_ENABLE_READ (stepperY.getStatus() & STATUS_HIZ)
135 134
   #define Y_DIR_INIT NOOP
136
-  #define Y_DIR_WRITE(STATE) stepperY.Step_Clock(STATE)
135
+  #define Y_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,Y)
137 136
   #define Y_DIR_READ (stepperY.getStatus() & STATUS_DIR)
138 137
 #else
139 138
   #if AXIS_IS_TMC(Y)
140 139
     extern TMC_CLASS(Y) stepperY;
141 140
   #endif
142
-  #if AXIS_DRIVER_TYPE(Y, TMC26X)
141
+  #if AXIS_DRIVER_TYPE_Y(TMC26X)
143 142
     extern TMC26XStepper stepperY;
144 143
     #define Y_ENABLE_INIT NOOP
145 144
     #define Y_ENABLE_WRITE(STATE) stepperY.setEnabled(STATE)
@@ -162,19 +161,19 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
162 161
 #define Y_STEP_READ READ(Y_STEP_PIN)
163 162
 
164 163
 // Z Stepper
165
-#if AXIS_DRIVER_TYPE(Z, L6470)
164
+#if AXIS_DRIVER_TYPE_Z(L6470)
166 165
   extern L6470 stepperZ;
167 166
   #define Z_ENABLE_INIT NOOP
168
-  #define Z_ENABLE_WRITE(STATE) do{ if (STATE) stepperZ.Step_Clock(stepperZ.getStatus() & STATUS_HIZ); else stepperZ.softFree(); }while(0)
167
+  #define Z_ENABLE_WRITE(STATE) NOOP
169 168
   #define Z_ENABLE_READ (stepperZ.getStatus() & STATUS_HIZ)
170 169
   #define Z_DIR_INIT NOOP
171
-  #define Z_DIR_WRITE(STATE) stepperZ.Step_Clock(STATE)
170
+  #define Z_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,Z)
172 171
   #define Z_DIR_READ (stepperZ.getStatus() & STATUS_DIR)
173 172
 #else
174 173
   #if AXIS_IS_TMC(Z)
175 174
     extern TMC_CLASS(Z) stepperZ;
176 175
   #endif
177
-  #if AXIS_DRIVER_TYPE(Z, TMC26X)
176
+  #if AXIS_DRIVER_TYPE_Z(TMC26X)
178 177
     extern TMC26XStepper stepperZ;
179 178
     #define Z_ENABLE_INIT NOOP
180 179
     #define Z_ENABLE_WRITE(STATE) stepperZ.setEnabled(STATE)
@@ -198,19 +197,19 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
198 197
 
199 198
 // X2 Stepper
200 199
 #if HAS_X2_ENABLE
201
-  #if AXIS_DRIVER_TYPE(X2, L6470)
200
+  #if AXIS_DRIVER_TYPE_X2(L6470)
202 201
     extern L6470 stepperX2;
203 202
     #define X2_ENABLE_INIT NOOP
204
-    #define X2_ENABLE_WRITE(STATE) do{ if (STATE) stepperX2.Step_Clock(stepperX2.getStatus() & STATUS_HIZ); else stepperX2.softFree(); }while(0)
203
+    #define X2_ENABLE_WRITE(STATE) NOOP
205 204
     #define X2_ENABLE_READ (stepperX2.getStatus() & STATUS_HIZ)
206 205
     #define X2_DIR_INIT NOOP
207
-    #define X2_DIR_WRITE(STATE) stepperX2.Step_Clock(STATE)
206
+    #define X2_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,X2)
208 207
     #define X2_DIR_READ (stepperX2.getStatus() & STATUS_DIR)
209 208
   #else
210 209
     #if AXIS_IS_TMC(X2)
211 210
       extern TMC_CLASS(X2) stepperX2;
212 211
     #endif
213
-    #if AXIS_DRIVER_TYPE(X2, TMC26X)
212
+    #if AXIS_DRIVER_TYPE_X2(TMC26X)
214 213
       extern TMC26XStepper stepperX2;
215 214
       #define X2_ENABLE_INIT NOOP
216 215
       #define X2_ENABLE_WRITE(STATE) stepperX2.setEnabled(STATE)
@@ -235,19 +234,19 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
235 234
 
236 235
 // Y2 Stepper
237 236
 #if HAS_Y2_ENABLE
238
-  #if AXIS_DRIVER_TYPE(Y2, L6470)
237
+  #if AXIS_DRIVER_TYPE_Y2(L6470)
239 238
     extern L6470 stepperY2;
240 239
     #define Y2_ENABLE_INIT NOOP
241
-    #define Y2_ENABLE_WRITE(STATE) do{ if (STATE) stepperY2.Step_Clock(stepperY2.getStatus() & STATUS_HIZ); else stepperY2.softFree(); }while(0)
240
+    #define Y2_ENABLE_WRITE(STATE) NOOP
242 241
     #define Y2_ENABLE_READ (stepperY2.getStatus() & STATUS_HIZ)
243 242
     #define Y2_DIR_INIT NOOP
244
-    #define Y2_DIR_WRITE(STATE) stepperY2.Step_Clock(STATE)
243
+    #define Y2_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,Y2)
245 244
     #define Y2_DIR_READ (stepperY2.getStatus() & STATUS_DIR)
246 245
   #else
247 246
     #if AXIS_IS_TMC(Y2)
248 247
       extern TMC_CLASS(Y2) stepperY2;
249 248
     #endif
250
-    #if AXIS_DRIVER_TYPE(Y2, TMC26X)
249
+    #if AXIS_DRIVER_TYPE_Y2(TMC26X)
251 250
       extern TMC26XStepper stepperY2;
252 251
       #define Y2_ENABLE_INIT NOOP
253 252
       #define Y2_ENABLE_WRITE(STATE) stepperY2.setEnabled(STATE)
@@ -268,23 +267,25 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
268 267
   #define Y2_STEP_INIT SET_OUTPUT(Y2_STEP_PIN)
269 268
   #define Y2_STEP_WRITE(STATE) WRITE(Y2_STEP_PIN,STATE)
270 269
   #define Y2_STEP_READ READ(Y2_STEP_PIN)
270
+#else
271
+  #define Y2_DIR_WRITE(STATE) NOOP
271 272
 #endif
272 273
 
273 274
 // Z2 Stepper
274 275
 #if HAS_Z2_ENABLE
275
-  #if AXIS_DRIVER_TYPE(Z2, L6470)
276
+  #if AXIS_DRIVER_TYPE_Z2(L6470)
276 277
     extern L6470 stepperZ2;
277 278
     #define Z2_ENABLE_INIT NOOP
278
-    #define Z2_ENABLE_WRITE(STATE) do{ if (STATE) stepperZ2.Step_Clock(stepperZ2.getStatus() & STATUS_HIZ); else stepperZ2.softFree(); }while(0)
279
+    #define Z2_ENABLE_WRITE(STATE) NOOP
279 280
     #define Z2_ENABLE_READ (stepperZ2.getStatus() & STATUS_HIZ)
280 281
     #define Z2_DIR_INIT NOOP
281
-    #define Z2_DIR_WRITE(STATE) stepperZ2.Step_Clock(STATE)
282
+    #define Z2_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,Z2)
282 283
     #define Z2_DIR_READ (stepperZ2.getStatus() & STATUS_DIR)
283 284
   #else
284 285
     #if AXIS_IS_TMC(Z2)
285 286
       extern TMC_CLASS(Z2) stepperZ2;
286 287
     #endif
287
-    #if AXIS_DRIVER_TYPE(Z2, TMC26X)
288
+    #if AXIS_DRIVER_TYPE_Z2(TMC26X)
288 289
       extern TMC26XStepper stepperZ2;
289 290
       #define Z2_ENABLE_INIT NOOP
290 291
       #define Z2_ENABLE_WRITE(STATE) stepperZ2.setEnabled(STATE)
@@ -305,17 +306,19 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
305 306
   #define Z2_STEP_INIT SET_OUTPUT(Z2_STEP_PIN)
306 307
   #define Z2_STEP_WRITE(STATE) WRITE(Z2_STEP_PIN,STATE)
307 308
   #define Z2_STEP_READ READ(Z2_STEP_PIN)
309
+#else
310
+  #define Z2_DIR_WRITE(STATE) NOOP
308 311
 #endif
309 312
 
310 313
 // Z3 Stepper
311 314
 #if HAS_Z3_ENABLE
312
-  #if ENABLED(Z3_IS_L6470)
315
+  #if AXIS_DRIVER_TYPE_Z3(L6470)
313 316
     extern L6470 stepperZ3;
314 317
     #define Z3_ENABLE_INIT NOOP
315
-    #define Z3_ENABLE_WRITE(STATE) do{ if (STATE) stepperZ3.Step_Clock(stepperZ3.getStatus() & STATUS_HIZ); else stepperZ3.softFree(); }while(0)
318
+    #define Z3_ENABLE_WRITE(STATE) NOOP
316 319
     #define Z3_ENABLE_READ (stepperZ3.getStatus() & STATUS_HIZ)
317 320
     #define Z3_DIR_INIT NOOP
318
-    #define Z3_DIR_WRITE(STATE) stepperZ3.Step_Clock(STATE)
321
+    #define Z3_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,Z3)
319 322
     #define Z3_DIR_READ (stepperZ3.getStatus() & STATUS_DIR)
320 323
   #else
321 324
     #if AXIS_IS_TMC(Z3)
@@ -342,22 +345,24 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
342 345
   #define Z3_STEP_INIT SET_OUTPUT(Z3_STEP_PIN)
343 346
   #define Z3_STEP_WRITE(STATE) WRITE(Z3_STEP_PIN,STATE)
344 347
   #define Z3_STEP_READ READ(Z3_STEP_PIN)
348
+#else
349
+  #define Z3_DIR_WRITE(STATE) NOOP
345 350
 #endif
346 351
 
347 352
 // E0 Stepper
348
-#if AXIS_DRIVER_TYPE(E0, L6470)
353
+#if AXIS_DRIVER_TYPE_E0(L6470)
349 354
   extern L6470 stepperE0;
350 355
   #define E0_ENABLE_INIT NOOP
351
-  #define E0_ENABLE_WRITE(STATE) do{ if (STATE) stepperE0.Step_Clock(stepperE0.getStatus() & STATUS_HIZ); else stepperE0.softFree(); }while(0)
356
+  #define E0_ENABLE_WRITE(STATE) NOOP
352 357
   #define E0_ENABLE_READ (stepperE0.getStatus() & STATUS_HIZ)
353 358
   #define E0_DIR_INIT NOOP
354
-  #define E0_DIR_WRITE(STATE) stepperE0.Step_Clock(STATE)
359
+  #define E0_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,E0)
355 360
   #define E0_DIR_READ (stepperE0.getStatus() & STATUS_DIR)
356 361
 #else
357 362
   #if AXIS_IS_TMC(E0)
358 363
     extern TMC_CLASS(E0) stepperE0;
359 364
   #endif
360
-  #if AXIS_DRIVER_TYPE(E0, TMC26X)
365
+  #if AXIS_DRIVER_TYPE_E0(TMC26X)
361 366
     extern TMC26XStepper stepperE0;
362 367
     #define E0_ENABLE_INIT NOOP
363 368
     #define E0_ENABLE_WRITE(STATE) stepperE0.setEnabled(STATE)
@@ -380,19 +385,19 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
380 385
 #define E0_STEP_READ READ(E0_STEP_PIN)
381 386
 
382 387
 // E1 Stepper
383
-#if AXIS_DRIVER_TYPE(E1, L6470)
388
+#if AXIS_DRIVER_TYPE_E1(L6470)
384 389
   extern L6470 stepperE1;
385 390
   #define E1_ENABLE_INIT NOOP
386
-  #define E1_ENABLE_WRITE(STATE) do{ if (STATE) stepperE1.Step_Clock(stepperE1.getStatus() & STATUS_HIZ); else stepperE1.softFree(); }while(0)
391
+  #define E1_ENABLE_WRITE(STATE) NOOP
387 392
   #define E1_ENABLE_READ (stepperE1.getStatus() & STATUS_HIZ)
388 393
   #define E1_DIR_INIT NOOP
389
-  #define E1_DIR_WRITE(STATE) stepperE1.Step_Clock(STATE)
394
+  #define E1_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,E1)
390 395
   #define E1_DIR_READ (stepperE1.getStatus() & STATUS_DIR)
391 396
 #else
392 397
   #if AXIS_IS_TMC(E1)
393 398
     extern TMC_CLASS(E1) stepperE1;
394 399
   #endif
395
-  #if AXIS_DRIVER_TYPE(E1, TMC26X)
400
+  #if AXIS_DRIVER_TYPE_E1(TMC26X)
396 401
     extern TMC26XStepper stepperE1;
397 402
     #define E1_ENABLE_INIT NOOP
398 403
     #define E1_ENABLE_WRITE(STATE) stepperE1.setEnabled(STATE)
@@ -415,19 +420,19 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
415 420
 #define E1_STEP_READ READ(E1_STEP_PIN)
416 421
 
417 422
 // E2 Stepper
418
-#if AXIS_DRIVER_TYPE(E2, L6470)
423
+#if AXIS_DRIVER_TYPE_E2(L6470)
419 424
   extern L6470 stepperE2;
420 425
   #define E2_ENABLE_INIT NOOP
421
-  #define E2_ENABLE_WRITE(STATE) do{ if (STATE) stepperE2.Step_Clock(stepperE2.getStatus() & STATUS_HIZ); else stepperE2.softFree(); }while(0)
426
+  #define E2_ENABLE_WRITE(STATE) NOOP
422 427
   #define E2_ENABLE_READ (stepperE2.getStatus() & STATUS_HIZ)
423 428
   #define E2_DIR_INIT NOOP
424
-  #define E2_DIR_WRITE(STATE) stepperE2.Step_Clock(STATE)
429
+  #define E2_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,E2)
425 430
   #define E2_DIR_READ (stepperE2.getStatus() & STATUS_DIR)
426 431
 #else
427 432
   #if AXIS_IS_TMC(E2)
428 433
     extern TMC_CLASS(E2) stepperE2;
429 434
   #endif
430
-  #if AXIS_DRIVER_TYPE(E2, TMC26X)
435
+  #if AXIS_DRIVER_TYPE_E2(TMC26X)
431 436
     extern TMC26XStepper stepperE2;
432 437
     #define E2_ENABLE_INIT NOOP
433 438
     #define E2_ENABLE_WRITE(STATE) stepperE2.setEnabled(STATE)
@@ -450,19 +455,19 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
450 455
 #define E2_STEP_READ READ(E2_STEP_PIN)
451 456
 
452 457
 // E3 Stepper
453
-#if AXIS_DRIVER_TYPE(E3, L6470)
458
+#if AXIS_DRIVER_TYPE_E3(L6470)
454 459
   extern L6470 stepperE3;
455 460
   #define E3_ENABLE_INIT NOOP
456
-  #define E3_ENABLE_WRITE(STATE) do{ if (STATE) stepperE3.Step_Clock(stepperE3.getStatus() & STATUS_HIZ); else stepperE3.softFree(); }while(0)
461
+  #define E3_ENABLE_WRITE(STATE) NOOP
457 462
   #define E3_ENABLE_READ (stepperE3.getStatus() & STATUS_HIZ)
458 463
   #define E3_DIR_INIT NOOP
459
-  #define E3_DIR_WRITE(STATE) stepperE3.Step_Clock(STATE)
464
+  #define E3_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,E3)
460 465
   #define E3_DIR_READ (stepperE3.getStatus() & STATUS_DIR)
461 466
 #else
462 467
   #if AXIS_IS_TMC(E3)
463 468
     extern TMC_CLASS(E3) stepperE3;
464 469
   #endif
465
-  #if AXIS_DRIVER_TYPE(E3, TMC26X)
470
+  #if AXIS_DRIVER_TYPE_E3(TMC26X)
466 471
     extern TMC26XStepper stepperE3;
467 472
     #define E3_ENABLE_INIT NOOP
468 473
     #define E3_ENABLE_WRITE(STATE) stepperE3.setEnabled(STATE)
@@ -485,19 +490,19 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
485 490
 #define E3_STEP_READ READ(E3_STEP_PIN)
486 491
 
487 492
 // E4 Stepper
488
-#if AXIS_DRIVER_TYPE(E4, L6470)
493
+#if AXIS_DRIVER_TYPE_E4(L6470)
489 494
   extern L6470 stepperE4;
490 495
   #define E4_ENABLE_INIT NOOP
491
-  #define E4_ENABLE_WRITE(STATE) do{ if (STATE) stepperE4.Step_Clock(stepperE4.getStatus() & STATUS_HIZ); else stepperE4.softFree(); }while(0)
496
+  #define E4_ENABLE_WRITE(STATE) NOOP
492 497
   #define E4_ENABLE_READ (stepperE4.getStatus() & STATUS_HIZ)
493 498
   #define E4_DIR_INIT NOOP
494
-  #define E4_DIR_WRITE(STATE) stepperE4.Step_Clock(STATE)
499
+  #define E4_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,E4)
495 500
   #define E4_DIR_READ (stepperE4.getStatus() & STATUS_DIR)
496 501
 #else
497 502
   #if AXIS_IS_TMC(E4)
498 503
     extern TMC_CLASS(E4) stepperE4;
499 504
   #endif
500
-  #if AXIS_DRIVER_TYPE(E4, TMC26X)
505
+  #if AXIS_DRIVER_TYPE_E4(TMC26X)
501 506
     extern TMC26XStepper stepperE4;
502 507
     #define E4_ENABLE_INIT NOOP
503 508
     #define E4_ENABLE_WRITE(STATE) stepperE4.setEnabled(STATE)
@@ -520,19 +525,19 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
520 525
 #define E4_STEP_READ READ(E4_STEP_PIN)
521 526
 
522 527
 // E5 Stepper
523
-#if AXIS_DRIVER_TYPE(E5, L6470)
528
+#if AXIS_DRIVER_TYPE_E5(L6470)
524 529
   extern L6470 stepperE5;
525 530
   #define E5_ENABLE_INIT NOOP
526
-  #define E5_ENABLE_WRITE(STATE) do{ if (STATE) stepperE5.Step_Clock(stepperE5.getStatus() & STATUS_HIZ); else stepperE5.softFree(); }while(0)
531
+  #define E5_ENABLE_WRITE(STATE) NOOP
527 532
   #define E5_ENABLE_READ (stepperE5.getStatus() & STATUS_HIZ)
528 533
   #define E5_DIR_INIT NOOP
529
-  #define E5_DIR_WRITE(STATE) stepperE5.Step_Clock(STATE)
534
+  #define E5_DIR_WRITE(STATE) L6470_WRITE_DIR_COMMAND(STATE,E5)
530 535
   #define E5_DIR_READ (stepperE5.getStatus() & STATUS_DIR)
531 536
 #else
532 537
   #if AXIS_IS_TMC(E5)
533 538
     extern TMC_CLASS(E5) stepperE5;
534 539
   #endif
535
-  #if AXIS_DRIVER_TYPE(E5, TMC26X)
540
+  #if AXIS_DRIVER_TYPE_E5(TMC26X)
536 541
     extern TMC26XStepper stepperE5;
537 542
     #define E5_ENABLE_INIT NOOP
538 543
     #define E5_ENABLE_WRITE(STATE) stepperE5.setEnabled(STATE)
@@ -623,126 +628,3 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
623 628
   #define   NORM_E_DIR(E)   E0_DIR_WRITE(!INVERT_E0_DIR)
624 629
   #define    REV_E_DIR(E)   E0_DIR_WRITE( INVERT_E0_DIR)
625 630
 #endif
626
-
627
-//
628
-// Stepper enable / disable
629
-//
630
-#if HAS_X2_ENABLE
631
-  #define  enable_X() do{ X_ENABLE_WRITE( X_ENABLE_ON); X2_ENABLE_WRITE( X_ENABLE_ON); }while(0)
632
-  #define disable_X() do{ X_ENABLE_WRITE(!X_ENABLE_ON); X2_ENABLE_WRITE(!X_ENABLE_ON); CBI(axis_known_position, X_AXIS); }while(0)
633
-#elif HAS_X_ENABLE
634
-  #define  enable_X() X_ENABLE_WRITE( X_ENABLE_ON)
635
-  #define disable_X() do{ X_ENABLE_WRITE(!X_ENABLE_ON); CBI(axis_known_position, X_AXIS); }while(0)
636
-#else
637
-  #define  enable_X() NOOP
638
-  #define disable_X() NOOP
639
-#endif
640
-
641
-#if HAS_Y2_ENABLE
642
-  #define  enable_Y() do{ Y_ENABLE_WRITE( Y_ENABLE_ON); Y2_ENABLE_WRITE(Y_ENABLE_ON); }while(0)
643
-  #define disable_Y() do{ Y_ENABLE_WRITE(!Y_ENABLE_ON); Y2_ENABLE_WRITE(!Y_ENABLE_ON); CBI(axis_known_position, Y_AXIS); }while(0)
644
-#elif HAS_Y_ENABLE
645
-  #define  enable_Y() Y_ENABLE_WRITE( Y_ENABLE_ON)
646
-  #define disable_Y() do{ Y_ENABLE_WRITE(!Y_ENABLE_ON); CBI(axis_known_position, Y_AXIS); }while(0)
647
-#else
648
-  #define  enable_Y() NOOP
649
-  #define disable_Y() NOOP
650
-#endif
651
-
652
-#if HAS_Z3_ENABLE
653
-  #define  enable_Z() do{ Z_ENABLE_WRITE( Z_ENABLE_ON); Z2_ENABLE_WRITE(Z_ENABLE_ON); Z3_ENABLE_WRITE(Z_ENABLE_ON); }while(0)
654
-  #define disable_Z() do{ Z_ENABLE_WRITE(!Z_ENABLE_ON); Z2_ENABLE_WRITE(!Z_ENABLE_ON); Z3_ENABLE_WRITE(!Z_ENABLE_ON); CBI(axis_known_position, Z_AXIS); }while(0)
655
-#elif HAS_Z2_ENABLE
656
-  #define  enable_Z() do{ Z_ENABLE_WRITE( Z_ENABLE_ON); Z2_ENABLE_WRITE(Z_ENABLE_ON); }while(0)
657
-  #define disable_Z() do{ Z_ENABLE_WRITE(!Z_ENABLE_ON); Z2_ENABLE_WRITE(!Z_ENABLE_ON); CBI(axis_known_position, Z_AXIS); }while(0)
658
-#elif HAS_Z_ENABLE
659
-  #define  enable_Z() Z_ENABLE_WRITE( Z_ENABLE_ON)
660
-  #define disable_Z() do{ Z_ENABLE_WRITE(!Z_ENABLE_ON); CBI(axis_known_position, Z_AXIS); }while(0)
661
-#else
662
-  #define  enable_Z() NOOP
663
-  #define disable_Z() NOOP
664
-#endif
665
-
666
-#if ENABLED(MIXING_EXTRUDER)
667
-
668
-  /**
669
-   * Mixing steppers synchronize their enable (and direction) together
670
-   */
671
-  #if MIXING_STEPPERS > 5
672
-    #define  enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); E2_ENABLE_WRITE( E_ENABLE_ON); E3_ENABLE_WRITE( E_ENABLE_ON); E4_ENABLE_WRITE( E_ENABLE_ON); E5_ENABLE_WRITE( E_ENABLE_ON); }
673
-    #define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); E2_ENABLE_WRITE(!E_ENABLE_ON); E3_ENABLE_WRITE(!E_ENABLE_ON); E4_ENABLE_WRITE(!E_ENABLE_ON); E5_ENABLE_WRITE(!E_ENABLE_ON); }
674
-  #elif MIXING_STEPPERS > 4
675
-    #define  enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); E2_ENABLE_WRITE( E_ENABLE_ON); E3_ENABLE_WRITE( E_ENABLE_ON); E4_ENABLE_WRITE( E_ENABLE_ON); }
676
-    #define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); E2_ENABLE_WRITE(!E_ENABLE_ON); E3_ENABLE_WRITE(!E_ENABLE_ON); E4_ENABLE_WRITE(!E_ENABLE_ON); }
677
-  #elif MIXING_STEPPERS > 3
678
-    #define  enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); E2_ENABLE_WRITE( E_ENABLE_ON); E3_ENABLE_WRITE( E_ENABLE_ON); }
679
-    #define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); E2_ENABLE_WRITE(!E_ENABLE_ON); E3_ENABLE_WRITE(!E_ENABLE_ON); }
680
-  #elif MIXING_STEPPERS > 2
681
-    #define  enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); E2_ENABLE_WRITE( E_ENABLE_ON); }
682
-    #define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); E2_ENABLE_WRITE(!E_ENABLE_ON); }
683
-  #else
684
-    #define  enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); }
685
-    #define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); }
686
-  #endif
687
-  #define  enable_E1() NOOP
688
-  #define disable_E1() NOOP
689
-  #define  enable_E2() NOOP
690
-  #define disable_E2() NOOP
691
-  #define  enable_E3() NOOP
692
-  #define disable_E3() NOOP
693
-  #define  enable_E4() NOOP
694
-  #define disable_E4() NOOP
695
-  #define  enable_E5() NOOP
696
-  #define disable_E5() NOOP
697
-
698
-#else // !MIXING_EXTRUDER
699
-
700
-  #if HAS_E0_ENABLE
701
-    #define  enable_E0() E0_ENABLE_WRITE( E_ENABLE_ON)
702
-    #define disable_E0() E0_ENABLE_WRITE(!E_ENABLE_ON)
703
-  #else
704
-    #define  enable_E0() NOOP
705
-    #define disable_E0() NOOP
706
-  #endif
707
-
708
-  #if E_STEPPERS > 1 && HAS_E1_ENABLE
709
-    #define  enable_E1() E1_ENABLE_WRITE( E_ENABLE_ON)
710
-    #define disable_E1() E1_ENABLE_WRITE(!E_ENABLE_ON)
711
-  #else
712
-    #define  enable_E1() NOOP
713
-    #define disable_E1() NOOP
714
-  #endif
715
-
716
-  #if E_STEPPERS > 2 && HAS_E2_ENABLE
717
-    #define  enable_E2() E2_ENABLE_WRITE( E_ENABLE_ON)
718
-    #define disable_E2() E2_ENABLE_WRITE(!E_ENABLE_ON)
719
-  #else
720
-    #define  enable_E2() NOOP
721
-    #define disable_E2() NOOP
722
-  #endif
723
-
724
-  #if E_STEPPERS > 3 && HAS_E3_ENABLE
725
-    #define  enable_E3() E3_ENABLE_WRITE( E_ENABLE_ON)
726
-    #define disable_E3() E3_ENABLE_WRITE(!E_ENABLE_ON)
727
-  #else
728
-    #define  enable_E3() NOOP
729
-    #define disable_E3() NOOP
730
-  #endif
731
-
732
-  #if E_STEPPERS > 4 && HAS_E4_ENABLE
733
-    #define  enable_E4() E4_ENABLE_WRITE( E_ENABLE_ON)
734
-    #define disable_E4() E4_ENABLE_WRITE(!E_ENABLE_ON)
735
-  #else
736
-    #define  enable_E4() NOOP
737
-    #define disable_E4() NOOP
738
-  #endif
739
-
740
-  #if E_STEPPERS > 5 && HAS_E5_ENABLE
741
-    #define  enable_E5() E5_ENABLE_WRITE( E_ENABLE_ON)
742
-    #define disable_E5() E5_ENABLE_WRITE(!E_ENABLE_ON)
743
-  #else
744
-    #define  enable_E5() NOOP
745
-    #define disable_E5() NOOP
746
-  #endif
747
-
748
-#endif // !MIXING_EXTRUDER

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

@@ -1133,3 +1133,18 @@
1133 1133
 #if PIN_EXISTS(E5_SERIAL_RX)
1134 1134
   REPORT_NAME_DIGITAL(__LINE__, E5_SERIAL_RX_PIN)
1135 1135
 #endif
1136
+#if PIN_EXISTS(L6470_CHAIN_SCK)
1137
+  REPORT_NAME_DIGITAL(__LINE__, L6470_CHAIN_SCK_PIN)
1138
+#endif
1139
+#if PIN_EXISTS(L6470_CHAIN_MISO)
1140
+  REPORT_NAME_DIGITAL(__LINE__, L6470_CHAIN_MISO_PIN)
1141
+#endif
1142
+#if PIN_EXISTS(L6470_CHAIN_MOSI)
1143
+  REPORT_NAME_DIGITAL(__LINE__, L6470_CHAIN_MOSI_PIN)
1144
+#endif
1145
+#if PIN_EXISTS(L6470_CHAIN_SS)
1146
+  REPORT_NAME_DIGITAL(__LINE__, L6470_CHAIN_SS_PIN)
1147
+#endif
1148
+#if PIN_EXISTS(L6470_RESET_CHAIN)
1149
+  REPORT_NAME_DIGITAL(__LINE__, L6470_RESET_CHAIN_PIN)
1150
+#endif

+ 1
- 1
Marlin/src/pins/pins_EINSY_RAMBO.h View File

@@ -33,7 +33,7 @@
33 33
 //
34 34
 // TMC2130 Configuration_adv defaults for EinsyRambo
35 35
 //
36
-#if !AXIS_DRIVER_TYPE(X, TMC2130) || !AXIS_DRIVER_TYPE(Y, TMC2130) || !AXIS_DRIVER_TYPE(Z, TMC2130) || !AXIS_DRIVER_TYPE(E0, TMC2130)
36
+#if !AXIS_DRIVER_TYPE_X(TMC2130) || !AXIS_DRIVER_TYPE_Y(TMC2130) || !AXIS_DRIVER_TYPE_Z(TMC2130) || !AXIS_DRIVER_TYPE_E0(TMC2130)
37 37
   #error "You must set ([XYZ]|E0)_DRIVER_TYPE to TMC2130 in Configuration.h for EinsyRambo."
38 38
 #endif
39 39
 

+ 1
- 1
Marlin/src/pins/pins_EINSY_RETRO.h View File

@@ -33,7 +33,7 @@
33 33
 //
34 34
 // TMC2130 Configuration_adv defaults for EinsyRetro
35 35
 //
36
-#if !AXIS_DRIVER_TYPE(X, TMC2130) || !AXIS_DRIVER_TYPE(Y, TMC2130) || !AXIS_DRIVER_TYPE(Z, TMC2130) || !AXIS_DRIVER_TYPE(E0, TMC2130)
36
+#if !AXIS_DRIVER_TYPE_X(TMC2130) || !AXIS_DRIVER_TYPE_Y(TMC2130) || !AXIS_DRIVER_TYPE_Z(TMC2130) || !AXIS_DRIVER_TYPE_E0(TMC2130)
37 37
   #error "You must set ([XYZ]|E0)_DRIVER_TYPE to TMC2130 in Configuration.h for EinsyRetro."
38 38
 #endif
39 39
 

+ 1
- 0
buildroot/share/tests/LPC1768_tests View File

@@ -70,6 +70,7 @@ opt_disable Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN
70 70
 opt_set X_DRIVER_TYPE TMC2130
71 71
 opt_set Y_DRIVER_TYPE TMC2130
72 72
 opt_set Z_DRIVER_TYPE TMC2130
73
+opt_set E0_DRIVER_TYPE L6470
73 74
 opt_enable TMC_USE_SW_SPI MONITOR_DRIVER_STATUS STEALTHCHOP HYBRID_THRESHOLD TMC_DEBUG \
74 75
            SENSORLESS_PROBING X_STALL_SENSITIVITY Y_STALL_SENSITIVITY Z_STALL_SENSITIVITY
75 76
 exec_test $1 $2 "Delta Config (generic) + BOARD_COHESION3D_REMIX + UBL + EEPROM_SETTINGS + SENSORLESS_PROBING"

+ 1
- 1
platformio.ini View File

@@ -34,7 +34,7 @@ lib_deps =
34 34
   TMCStepper@<1.0.0
35 35
   Adafruit NeoPixel@1.1.3
36 36
   https://github.com/lincomatic/LiquidTWI2/archive/30aa480.zip
37
-  https://github.com/ameyer/Arduino-L6470/archive/master.zip
37
+  https://github.com/ameyer/Arduino-L6470/archive/dev.zip
38 38
   https://github.com/trinamic/TMC26XStepper/archive/c1921b4.zip
39 39
   https://github.com/mikeshub/SailfishLCD.git
40 40
   https://github.com/mikeshub/SailfishRGB_LED.git

Loading…
Cancel
Save