|
@@ -0,0 +1,372 @@
|
|
1
|
+/**
|
|
2
|
+ * Marlin 3D Printer Firmware
|
|
3
|
+ * Copyright (c) 2021 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 <https://www.gnu.org/licenses/>.
|
|
20
|
+ *
|
|
21
|
+ */
|
|
22
|
+#pragma once
|
|
23
|
+
|
|
24
|
+#define ALLOW_STM32DUINO
|
|
25
|
+#include "env_validate.h"
|
|
26
|
+
|
|
27
|
+#if HOTENDS > 3 || E_STEPPERS > 5
|
|
28
|
+ #error "MKS Monster supports up to 3 hotends and 5 E-steppers."
|
|
29
|
+#elif HAS_FSMC_TFT
|
|
30
|
+ #error "MKS Monster doesn't support FSMC-based TFT displays."
|
|
31
|
+#endif
|
|
32
|
+
|
|
33
|
+#define BOARD_INFO_NAME "MKS Monster8 V1.x"
|
|
34
|
+
|
|
35
|
+// USB Flash Drive support
|
|
36
|
+#define HAS_OTG_USB_HOST_SUPPORT
|
|
37
|
+
|
|
38
|
+//#define DISABLE_DEBUG
|
|
39
|
+
|
|
40
|
+// Avoid conflict with TIMER_TONE
|
|
41
|
+#define STEP_TIMER 10
|
|
42
|
+
|
|
43
|
+// Use one of these or SDCard-based Emulation will be used
|
|
44
|
+//#define SRAM_EEPROM_EMULATION // Use BackSRAM-based EEPROM emulation
|
|
45
|
+//#define FLASH_EEPROM_EMULATION // Use Flash-based EEPROM emulation
|
|
46
|
+#define I2C_EEPROM // Need use jumpers set i2c for EEPROM
|
|
47
|
+#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
|
|
48
|
+#define I2C_SCL_PIN PB8 // I2C_SCL and CAN_RX
|
|
49
|
+#define I2C_SDA_PIN PB9 // I2C_SDA and CAN_TX
|
|
50
|
+
|
|
51
|
+//
|
|
52
|
+// Servos
|
|
53
|
+//
|
|
54
|
+#define SERVO0_PIN PA8 // Enable BLTOUCH
|
|
55
|
+
|
|
56
|
+//
|
|
57
|
+// Limit Switches for diag signal
|
|
58
|
+//
|
|
59
|
+#define X_DIAG_PIN PA14 // Driver0 diag signal is connect to X-
|
|
60
|
+#define Y_DIAG_PIN PA15 // Driver1 diag signal is connect to Y-
|
|
61
|
+#define Z_DIAG_PIN PB13 // Driver2 diag signal is connect to Z-
|
|
62
|
+#define E0_DIAG_PIN PA13 // Driver3 diag signal is connect to X+
|
|
63
|
+#define E1_DIAG_PIN PC5 // Driver4 diag signal is connect to Y+
|
|
64
|
+#define E2_DIAG_PIN PB12 // Driver5 diag signal is connect to Z+
|
|
65
|
+#define E3_DIAG_PIN -1 // Driver6 diag signal is not connect
|
|
66
|
+#define E4_DIAG_PIN -1 // Driver7 diag signal is not connect
|
|
67
|
+
|
|
68
|
+// Limit Switches for endstop
|
|
69
|
+#define X_MIN_PIN PA14
|
|
70
|
+#define X_MAX_PIN PA13
|
|
71
|
+#define Y_MIN_PIN PA15
|
|
72
|
+#define Y_MAX_PIN PC5
|
|
73
|
+#define Z_MIN_PIN PB13
|
|
74
|
+#define Z_MAX_PIN PB12
|
|
75
|
+
|
|
76
|
+//
|
|
77
|
+// Steppers
|
|
78
|
+// Driver 0 1 2 3 4 5 6 7
|
|
79
|
+// For X Y Z E0 E1 E2 E3 E4(default pin settings)
|
|
80
|
+//
|
|
81
|
+//Driver0
|
|
82
|
+#define X_ENABLE_PIN PC15
|
|
83
|
+#define X_STEP_PIN PC14
|
|
84
|
+#define X_DIR_PIN PC13
|
|
85
|
+#ifndef X_CS_PIN
|
|
86
|
+ #define X_CS_PIN PE6
|
|
87
|
+#endif
|
|
88
|
+//Driver1
|
|
89
|
+#define Y_ENABLE_PIN PC15
|
|
90
|
+#define Y_STEP_PIN PE5
|
|
91
|
+#define Y_DIR_PIN PE4
|
|
92
|
+#ifndef Y_CS_PIN
|
|
93
|
+ #define Y_CS_PIN PE3
|
|
94
|
+#endif
|
|
95
|
+//Driver2
|
|
96
|
+#define Z_ENABLE_PIN PE2
|
|
97
|
+#define Z_STEP_PIN PE1
|
|
98
|
+#define Z_DIR_PIN PE0
|
|
99
|
+#ifndef Z_CS_PIN
|
|
100
|
+ #define Z_CS_PIN PB7
|
|
101
|
+#endif
|
|
102
|
+//Driver3
|
|
103
|
+#define E0_ENABLE_PIN PB6
|
|
104
|
+#define E0_STEP_PIN PB5
|
|
105
|
+#define E0_DIR_PIN PB4
|
|
106
|
+#ifndef E0_CS_PIN
|
|
107
|
+ #define E0_CS_PIN PB3
|
|
108
|
+#endif
|
|
109
|
+//Driver4
|
|
110
|
+#define E1_ENABLE_PIN PD7
|
|
111
|
+#define E1_STEP_PIN PD6
|
|
112
|
+#define E1_DIR_PIN PD5
|
|
113
|
+#ifndef E1_CS_PIN
|
|
114
|
+ #define E1_CS_PIN PD4
|
|
115
|
+#endif
|
|
116
|
+//Driver5
|
|
117
|
+#define E2_ENABLE_PIN PD3
|
|
118
|
+#define E2_STEP_PIN PD2
|
|
119
|
+#define E2_DIR_PIN PD1
|
|
120
|
+#ifndef E2_CS_PIN
|
|
121
|
+ #define E2_CS_PIN PD0
|
|
122
|
+#endif
|
|
123
|
+//Driver6
|
|
124
|
+#define E3_ENABLE_PIN PC8
|
|
125
|
+#define E3_STEP_PIN PC7
|
|
126
|
+#define E3_DIR_PIN PC6
|
|
127
|
+#ifndef E3_CS_PIN
|
|
128
|
+ #define E3_CS_PIN PD15
|
|
129
|
+#endif
|
|
130
|
+//Driver7
|
|
131
|
+#define E4_ENABLE_PIN PD14
|
|
132
|
+#define E4_STEP_PIN PD13
|
|
133
|
+#define E4_DIR_PIN PD12
|
|
134
|
+#ifndef E4_CS_PIN
|
|
135
|
+ #define E4_CS_PIN PD11
|
|
136
|
+#endif
|
|
137
|
+
|
|
138
|
+//
|
|
139
|
+// Software SPI pins for TMC2130 stepper drivers
|
|
140
|
+// This board only supports SW SPI for stepper drivers
|
|
141
|
+//
|
|
142
|
+#if HAS_TMC_SPI
|
|
143
|
+ #define TMC_USE_SW_SPI
|
|
144
|
+#endif
|
|
145
|
+#if ENABLED(TMC_USE_SW_SPI)
|
|
146
|
+ #if !defined(TMC_SW_MOSI) || TMC_SW_MOSI == -1
|
|
147
|
+ #define TMC_SW_MOSI PE14
|
|
148
|
+ #endif
|
|
149
|
+ #if !defined(TMC_SW_MISO) || TMC_SW_MISO == -1
|
|
150
|
+ #define TMC_SW_MISO PE13
|
|
151
|
+ #endif
|
|
152
|
+ #if !defined(TMC_SW_SCK) || TMC_SW_SCK == -1
|
|
153
|
+ #define TMC_SW_SCK PE12
|
|
154
|
+ #endif
|
|
155
|
+#endif
|
|
156
|
+
|
|
157
|
+#if HAS_TMC_UART
|
|
158
|
+ //
|
|
159
|
+ // Software serial
|
|
160
|
+ // No Hardware serial for steppers
|
|
161
|
+ //
|
|
162
|
+ #define X_SERIAL_TX_PIN PE6
|
|
163
|
+ #define X_SERIAL_RX_PIN PE6
|
|
164
|
+
|
|
165
|
+ #define Y_SERIAL_TX_PIN PE3
|
|
166
|
+ #define Y_SERIAL_RX_PIN PE3
|
|
167
|
+
|
|
168
|
+ #define Z_SERIAL_TX_PIN PB7
|
|
169
|
+ #define Z_SERIAL_RX_PIN PB7
|
|
170
|
+
|
|
171
|
+ #define E0_SERIAL_TX_PIN PB3
|
|
172
|
+ #define E0_SERIAL_RX_PIN PB3
|
|
173
|
+
|
|
174
|
+ #define E1_SERIAL_TX_PIN PD4
|
|
175
|
+ #define E1_SERIAL_RX_PIN PD4
|
|
176
|
+
|
|
177
|
+ #define E2_SERIAL_TX_PIN PD0
|
|
178
|
+ #define E2_SERIAL_RX_PIN PD0
|
|
179
|
+
|
|
180
|
+ #define E3_SERIAL_TX_PIN PD15
|
|
181
|
+ #define E3_SERIAL_RX_PIN PD15
|
|
182
|
+
|
|
183
|
+ #define E4_SERIAL_TX_PIN PD11
|
|
184
|
+ #define E4_SERIAL_RX_PIN PD11
|
|
185
|
+
|
|
186
|
+ // Reduce baud rate to improve software serial reliability
|
|
187
|
+ #define TMC_BAUD_RATE 19200
|
|
188
|
+#endif
|
|
189
|
+
|
|
190
|
+//
|
|
191
|
+// Temperature Sensors
|
|
192
|
+//
|
|
193
|
+#define TEMP_0_PIN PC1 // TH0
|
|
194
|
+#define TEMP_1_PIN PC2 // TH1
|
|
195
|
+#define TEMP_2_PIN PC3 // TH2
|
|
196
|
+#define TEMP_BED_PIN PC0 // TB
|
|
197
|
+
|
|
198
|
+//
|
|
199
|
+// Heaters / Fans
|
|
200
|
+//
|
|
201
|
+#define HEATER_0_PIN PB1 // HE0
|
|
202
|
+#define HEATER_1_PIN PB0 // HE1
|
|
203
|
+#define HEATER_2_PIN PA3 // HE2
|
|
204
|
+#define HEATER_BED_PIN PB10 // H-BED
|
|
205
|
+
|
|
206
|
+#define FAN_PIN PA2 // FAN0
|
|
207
|
+#define FAN1_PIN PA1 // FAN1
|
|
208
|
+#define FAN2_PIN PA0 // FAN2
|
|
209
|
+
|
|
210
|
+//
|
|
211
|
+// Misc. Functions
|
|
212
|
+//
|
|
213
|
+#define MT_DET_1 Y_MAX_PIN
|
|
214
|
+#define MT_DET_2 Z_MAX_PIN
|
|
215
|
+#define PW_DET Y_MAX_PIN
|
|
216
|
+#define PW_OFF Z_MAX_PIN
|
|
217
|
+
|
|
218
|
+#ifndef FIL_RUNOUT_PIN
|
|
219
|
+ #define FIL_RUNOUT_PIN MT_DET_1
|
|
220
|
+#endif
|
|
221
|
+#ifndef FIL_RUNOUT2_PIN
|
|
222
|
+ #define FIL_RUNOUT2_PIN MT_DET_2
|
|
223
|
+#endif
|
|
224
|
+
|
|
225
|
+#define POWER_LOSS_PIN PW_DET
|
|
226
|
+#define PS_ON_PIN PW_OFF
|
|
227
|
+
|
|
228
|
+// Random Info
|
|
229
|
+#define USB_SERIAL -1 // USB Serial
|
|
230
|
+
|
|
231
|
+#ifndef SDCARD_CONNECTION
|
|
232
|
+ #define SDCARD_CONNECTION ONBOARD
|
|
233
|
+#endif
|
|
234
|
+
|
|
235
|
+//
|
|
236
|
+// Onboard SD card
|
|
237
|
+//
|
|
238
|
+// detect pin dont work when ONBOARD and NO_SD_HOST_DRIVE disabled
|
|
239
|
+#if SD_CONNECTION_IS(ONBOARD)
|
|
240
|
+ #define ENABLE_SPI3
|
|
241
|
+ #define SD_SS_PIN -1
|
|
242
|
+ #define SDSS PC9
|
|
243
|
+ #define SD_SCK_PIN PC10
|
|
244
|
+ #define SD_MISO_PIN PC11
|
|
245
|
+ #define SD_MOSI_PIN PC12
|
|
246
|
+ #define SD_DETECT_PIN PC4
|
|
247
|
+//
|
|
248
|
+// LCD SD
|
|
249
|
+//
|
|
250
|
+#elif SD_CONNECTION_IS(LCD)
|
|
251
|
+ #define ENABLE_SPI1
|
|
252
|
+ #define SDSS PA4
|
|
253
|
+ #define SD_SCK_PIN PA5
|
|
254
|
+ #define SD_MISO_PIN PA6
|
|
255
|
+ #define SD_MOSI_PIN PA7
|
|
256
|
+ #define SD_DETECT_PIN PB11
|
|
257
|
+#endif
|
|
258
|
+
|
|
259
|
+/**
|
|
260
|
+ * _____ _____
|
|
261
|
+ * (BEEPER)PB2 | · · | PE10(BTN_ENC) (SPI1 MISO) PA6 | · · | PA5 (SPI1 SCK)
|
|
262
|
+ * (LCD_EN)PE11 | · · | PD10(LCD_RS) (BTN_EN1) PE9 | · · | PA4 (SPI1 CS)
|
|
263
|
+ * (LCD_D4)PD9 | · · PD8(LCD_D5) (BTN_EN2) PE8 | · · PA7 (SPI1 MOSI)
|
|
264
|
+ * (LCD_D6)PE15 | · · | PE7(LCD_D7) (SPI1_RS) PB11 | · · | RESET
|
|
265
|
+ * GND | · · | 5V GND | · · | 3.3V
|
|
266
|
+ *  ̄ ̄ ̄  ̄ ̄ ̄
|
|
267
|
+ * EXP1 EXP2
|
|
268
|
+ */
|
|
269
|
+
|
|
270
|
+#if ANY(TFT_COLOR_UI, TFT_CLASSIC_UI)
|
|
271
|
+ #ifndef TOUCH_CALIBRATION_X
|
|
272
|
+ #define TOUCH_CALIBRATION_X -17253
|
|
273
|
+ #endif
|
|
274
|
+ #ifndef TOUCH_CALIBRATION_Y
|
|
275
|
+ #define TOUCH_CALIBRATION_Y 11579
|
|
276
|
+ #endif
|
|
277
|
+ #ifndef TOUCH_OFFSET_X
|
|
278
|
+ #define TOUCH_OFFSET_X 514
|
|
279
|
+ #endif
|
|
280
|
+ #ifndef TOUCH_OFFSET_Y
|
|
281
|
+ #define TOUCH_OFFSET_Y -24
|
|
282
|
+ #endif
|
|
283
|
+ #ifndef TOUCH_ORIENTATION
|
|
284
|
+ #define TOUCH_ORIENTATION TOUCH_LANDSCAPE
|
|
285
|
+ #endif
|
|
286
|
+
|
|
287
|
+ #define TFT_CS_PIN PE15
|
|
288
|
+ #define TFT_SCK_PIN PA5
|
|
289
|
+ #define TFT_MISO_PIN PA6
|
|
290
|
+ #define TFT_MOSI_PIN PA7
|
|
291
|
+ #define TFT_DC_PIN PE7
|
|
292
|
+ #define TFT_RST_PIN PD10
|
|
293
|
+ #define TFT_A0_PIN TFT_DC_PIN
|
|
294
|
+
|
|
295
|
+ #define TFT_RESET_PIN PD10
|
|
296
|
+ #define TFT_BACKLIGHT_PIN PE11
|
|
297
|
+
|
|
298
|
+ #define TOUCH_BUTTONS_HW_SPI
|
|
299
|
+ #define TOUCH_BUTTONS_HW_SPI_DEVICE 1
|
|
300
|
+
|
|
301
|
+ #define LCD_BACKLIGHT_PIN PE11
|
|
302
|
+ #ifndef TFT_WIDTH
|
|
303
|
+ #define TFT_WIDTH 480
|
|
304
|
+ #endif
|
|
305
|
+ #ifndef TFT_HEIGHT
|
|
306
|
+ #define TFT_HEIGHT 320
|
|
307
|
+ #endif
|
|
308
|
+
|
|
309
|
+ #define TOUCH_CS_PIN PD9 // SPI1_NSS
|
|
310
|
+ #define TOUCH_SCK_PIN PA5 // SPI1_SCK
|
|
311
|
+ #define TOUCH_MISO_PIN PA6 // SPI1_MISO
|
|
312
|
+ #define TOUCH_MOSI_PIN PA7 // SPI1_MOSI
|
|
313
|
+
|
|
314
|
+ #define BTN_EN1 PE9
|
|
315
|
+ #define BTN_EN2 PE8
|
|
316
|
+ #define BEEPER_PIN PB2
|
|
317
|
+ #define BTN_ENC PE10
|
|
318
|
+
|
|
319
|
+ #define LCD_READ_ID 0xD3
|
|
320
|
+ #define LCD_USE_DMA_SPI
|
|
321
|
+
|
|
322
|
+ #define TFT_BUFFER_SIZE 14400
|
|
323
|
+
|
|
324
|
+#elif HAS_WIRED_LCD
|
|
325
|
+
|
|
326
|
+ #define BEEPER_PIN PB2
|
|
327
|
+ #define BTN_ENC PE10
|
|
328
|
+ #define LCD_PINS_ENABLE PE11
|
|
329
|
+ #define LCD_PINS_RS PD10
|
|
330
|
+ #define BTN_EN1 PE9
|
|
331
|
+ #define BTN_EN2 PE8
|
|
332
|
+ #define LCD_BACKLIGHT_PIN -1
|
|
333
|
+
|
|
334
|
+ // MKS MINI12864 and MKS LCD12864B; If using MKS LCD12864A (Need to remove RPK2 resistor)
|
|
335
|
+ #if ENABLED(MKS_MINI_12864)
|
|
336
|
+ //#define LCD_BACKLIGHT_PIN -1
|
|
337
|
+ //#define LCD_RESET_PIN -1
|
|
338
|
+ #define DOGLCD_A0 PD11
|
|
339
|
+ #define DOGLCD_CS PE15
|
|
340
|
+ //#define DOGLCD_SCK PA5
|
|
341
|
+ //#define DOGLCD_MOSI PA7
|
|
342
|
+
|
|
343
|
+ #elif ENABLED(MKS_MINI_12864_V3)
|
|
344
|
+ #define DOGLCD_CS PE11
|
|
345
|
+ #define DOGLCD_A0 PD10
|
|
346
|
+ #define LCD_PINS_DC DOGLCD_A0
|
|
347
|
+ #define LCD_BACKLIGHT_PIN -1
|
|
348
|
+ #define LCD_RESET_PIN PD9
|
|
349
|
+ #define NEOPIXEL_PIN PD8
|
|
350
|
+ #define DOGLCD_MOSI PA7
|
|
351
|
+ #define DOGLCD_SCK PA5
|
|
352
|
+ #if SD_CONNECTION_IS(ONBOARD)
|
|
353
|
+ #define FORCE_SOFT_SPI
|
|
354
|
+ #endif
|
|
355
|
+ //#define LCD_SCREEN_ROT_180
|
|
356
|
+
|
|
357
|
+ #else
|
|
358
|
+
|
|
359
|
+ #define LCD_PINS_D4 PD9
|
|
360
|
+ #if ENABLED(ULTIPANEL)
|
|
361
|
+ #define LCD_PINS_D5 PD8
|
|
362
|
+ #define LCD_PINS_D6 PE15
|
|
363
|
+ #define LCD_PINS_D7 PE7
|
|
364
|
+ #endif
|
|
365
|
+
|
|
366
|
+ #define BOARD_ST7920_DELAY_1 DELAY_NS(96)
|
|
367
|
+ #define BOARD_ST7920_DELAY_2 DELAY_NS(48)
|
|
368
|
+ #define BOARD_ST7920_DELAY_3 DELAY_NS(600)
|
|
369
|
+
|
|
370
|
+ #endif // !MKS_MINI_12864
|
|
371
|
+
|
|
372
|
+#endif // HAS_WIRED_LCD
|