|
@@ -0,0 +1,356 @@
|
|
1
|
+/**
|
|
2
|
+ * Marlin 3D Printer Firmware
|
|
3
|
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
|
4
|
+ *
|
|
5
|
+ * Based on Sprinter and grbl.
|
|
6
|
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
|
7
|
+ *
|
|
8
|
+ * This program is free software: you can redistribute it and/or modify
|
|
9
|
+ * it under the terms of the GNU General Public License as published by
|
|
10
|
+ * the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+ * (at your option) any later version.
|
|
12
|
+ *
|
|
13
|
+ * This program is distributed in the hope that it will be useful,
|
|
14
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+ * GNU General Public License for more details.
|
|
17
|
+ *
|
|
18
|
+ * You should have received a copy of the GNU General Public License
|
|
19
|
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+ *
|
|
21
|
+ */
|
|
22
|
+#pragma once
|
|
23
|
+
|
|
24
|
+#ifndef TARGET_STM32F4
|
|
25
|
+ #error "Oops! Select an STM32F4 board in 'Tools > Board.'"
|
|
26
|
+#endif
|
|
27
|
+
|
|
28
|
+// Use one of these or SDCard-based Emulation will be used
|
|
29
|
+#if NO_EEPROM_SELECTED
|
|
30
|
+ //#define SRAM_EEPROM_EMULATION // Use BackSRAM-based EEPROM emulation
|
|
31
|
+ #define FLASH_EEPROM_EMULATION // Use Flash-based EEPROM emulation
|
|
32
|
+#endif
|
|
33
|
+
|
|
34
|
+#if ENABLED(FLASH_EEPROM_EMULATION)
|
|
35
|
+ // Decrease delays and flash wear by spreading writes across the
|
|
36
|
+ // 128 kB sector allocated for EEPROM emulation.
|
|
37
|
+ #define FLASH_EEPROM_LEVELING
|
|
38
|
+#endif
|
|
39
|
+
|
|
40
|
+//
|
|
41
|
+// Servos
|
|
42
|
+//
|
|
43
|
+#define SERVO0_PIN PA1
|
|
44
|
+
|
|
45
|
+//
|
|
46
|
+// Trinamic Stallguard pins
|
|
47
|
+//
|
|
48
|
+#define X_DIAG_PIN PB10 // X-
|
|
49
|
+#define Y_DIAG_PIN PE12 // Y-
|
|
50
|
+#define Z_DIAG_PIN PG8 // Z-
|
|
51
|
+#define E0_DIAG_PIN PE15 // E0
|
|
52
|
+#define E1_DIAG_PIN PE10 // E1
|
|
53
|
+#define E2_DIAG_PIN PG5 // E2
|
|
54
|
+
|
|
55
|
+//
|
|
56
|
+// Limit Switches
|
|
57
|
+//
|
|
58
|
+#ifdef X_STALL_SENSITIVITY
|
|
59
|
+ #define X_STOP_PIN X_DIAG_PIN
|
|
60
|
+ #if X_HOME_DIR < 0
|
|
61
|
+ #define X_MAX_PIN PE15 // E0
|
|
62
|
+ #else
|
|
63
|
+ #define X_MIN_PIN PE15 // E0
|
|
64
|
+ #endif
|
|
65
|
+#else
|
|
66
|
+ #define X_MIN_PIN PB10 // X-
|
|
67
|
+ #define X_MAX_PIN PE15 // E0
|
|
68
|
+#endif
|
|
69
|
+
|
|
70
|
+#ifdef Y_STALL_SENSITIVITY
|
|
71
|
+ #define Y_STOP_PIN Y_DIAG_PIN
|
|
72
|
+ #if Y_HOME_DIR < 0
|
|
73
|
+ #define Y_MAX_PIN PE10 // E1
|
|
74
|
+ #else
|
|
75
|
+ #define Y_MIN_PIN PE10 // E1
|
|
76
|
+ #endif
|
|
77
|
+#else
|
|
78
|
+ #define Y_MIN_PIN PE12 // Y-
|
|
79
|
+ #define Y_MAX_PIN PE10 // E1
|
|
80
|
+#endif
|
|
81
|
+
|
|
82
|
+#ifdef Z_STALL_SENSITIVITY
|
|
83
|
+ #define Z_STOP_PIN Z_DIAG_PIN
|
|
84
|
+ #if Z_HOME_DIR < 0
|
|
85
|
+ #define Z_MAX_PIN PG5 // E2
|
|
86
|
+ #else
|
|
87
|
+ #define Z_MIN_PIN PG5 // E2
|
|
88
|
+ #endif
|
|
89
|
+#else
|
|
90
|
+ #define Z_MIN_PIN PG8 // Z-
|
|
91
|
+ #define Z_MAX_PIN PG5 // E2
|
|
92
|
+#endif
|
|
93
|
+
|
|
94
|
+//
|
|
95
|
+// Z Probe must be this pin
|
|
96
|
+//
|
|
97
|
+#ifndef Z_MIN_PROBE_PIN
|
|
98
|
+ #define Z_MIN_PROBE_PIN PA2
|
|
99
|
+#endif
|
|
100
|
+
|
|
101
|
+//
|
|
102
|
+// Steppers
|
|
103
|
+//
|
|
104
|
+#define X_STEP_PIN PE9
|
|
105
|
+#define X_DIR_PIN PF1
|
|
106
|
+#define X_ENABLE_PIN PF2
|
|
107
|
+#ifndef X_CS_PIN
|
|
108
|
+ #define X_CS_PIN PA15
|
|
109
|
+#endif
|
|
110
|
+
|
|
111
|
+#define Y_STEP_PIN PE11
|
|
112
|
+#define Y_DIR_PIN PE8
|
|
113
|
+#define Y_ENABLE_PIN PD7
|
|
114
|
+ #ifndef Y_CS_PIN
|
|
115
|
+ #define Y_CS_PIN PB8
|
|
116
|
+#endif
|
|
117
|
+
|
|
118
|
+#define Z_STEP_PIN PE13
|
|
119
|
+#define Z_DIR_PIN PC2
|
|
120
|
+#define Z_ENABLE_PIN PC0
|
|
121
|
+#ifndef Z_CS_PIN
|
|
122
|
+ #define Z_CS_PIN PB9
|
|
123
|
+#endif
|
|
124
|
+
|
|
125
|
+#define E0_STEP_PIN PE14
|
|
126
|
+#define E0_DIR_PIN PA0
|
|
127
|
+#define E0_ENABLE_PIN PC3
|
|
128
|
+#ifndef E0_CS_PIN
|
|
129
|
+ #define E0_CS_PIN PB3
|
|
130
|
+#endif
|
|
131
|
+
|
|
132
|
+#define E1_STEP_PIN PD15
|
|
133
|
+#define E1_DIR_PIN PE7
|
|
134
|
+#define E1_ENABLE_PIN PA3
|
|
135
|
+#ifndef E1_CS_PIN
|
|
136
|
+ #define E1_CS_PIN PG15
|
|
137
|
+#endif
|
|
138
|
+
|
|
139
|
+#define E2_STEP_PIN PD13
|
|
140
|
+#define E2_DIR_PIN PG9
|
|
141
|
+#define E2_ENABLE_PIN PF0
|
|
142
|
+#ifndef E2_CS_PIN
|
|
143
|
+ #define E2_CS_PIN PG12
|
|
144
|
+#endif
|
|
145
|
+
|
|
146
|
+//
|
|
147
|
+// Software SPI pins for TMC2130 stepper drivers
|
|
148
|
+//
|
|
149
|
+#if ENABLED(TMC_USE_SW_SPI)
|
|
150
|
+ #ifndef TMC_SW_MOSI
|
|
151
|
+ #define TMC_SW_MOSI PC12
|
|
152
|
+ #endif
|
|
153
|
+ #ifndef TMC_SW_MISO
|
|
154
|
+ #define TMC_SW_MISO PC11
|
|
155
|
+ #endif
|
|
156
|
+ #ifndef TMC_SW_SCK
|
|
157
|
+ #define TMC_SW_SCK PC10
|
|
158
|
+ #endif
|
|
159
|
+#endif
|
|
160
|
+
|
|
161
|
+#if HAS_TMC_UART
|
|
162
|
+ /**
|
|
163
|
+ * TMC2208/TMC2209 stepper drivers
|
|
164
|
+ *
|
|
165
|
+ * Hardware serial communication ports.
|
|
166
|
+ * If undefined software serial is used according to the pins below
|
|
167
|
+ */
|
|
168
|
+ //#define X_HARDWARE_SERIAL Serial
|
|
169
|
+ //#define X2_HARDWARE_SERIAL Serial1
|
|
170
|
+ //#define Y_HARDWARE_SERIAL Serial1
|
|
171
|
+ //#define Y2_HARDWARE_SERIAL Serial1
|
|
172
|
+ //#define Z_HARDWARE_SERIAL Serial1
|
|
173
|
+ //#define Z2_HARDWARE_SERIAL Serial1
|
|
174
|
+ //#define E0_HARDWARE_SERIAL Serial1
|
|
175
|
+ //#define E1_HARDWARE_SERIAL Serial1
|
|
176
|
+ //#define E2_HARDWARE_SERIAL Serial1
|
|
177
|
+ //#define E3_HARDWARE_SERIAL Serial1
|
|
178
|
+ //#define E4_HARDWARE_SERIAL Serial1
|
|
179
|
+
|
|
180
|
+ //
|
|
181
|
+ // Software serial
|
|
182
|
+ //
|
|
183
|
+ #define X_SERIAL_TX_PIN PC13
|
|
184
|
+ #define X_SERIAL_RX_PIN PC13
|
|
185
|
+
|
|
186
|
+ #define Y_SERIAL_TX_PIN PE3
|
|
187
|
+ #define Y_SERIAL_RX_PIN PE3
|
|
188
|
+
|
|
189
|
+ #define Z_SERIAL_TX_PIN PE1
|
|
190
|
+ #define Z_SERIAL_RX_PIN PE1
|
|
191
|
+
|
|
192
|
+ #define E0_SERIAL_TX_PIN PD4
|
|
193
|
+ #define E0_SERIAL_RX_PIN PD4
|
|
194
|
+
|
|
195
|
+ #define E1_SERIAL_TX_PIN PD1
|
|
196
|
+ #define E1_SERIAL_RX_PIN PD1
|
|
197
|
+
|
|
198
|
+ #define E2_SERIAL_TX_PIN PD6
|
|
199
|
+ #define E2_SERIAL_RX_PIN PD6
|
|
200
|
+
|
|
201
|
+ // Reduce baud rate to improve software serial reliability
|
|
202
|
+ #define TMC_BAUD_RATE 19200
|
|
203
|
+#endif
|
|
204
|
+
|
|
205
|
+//
|
|
206
|
+// Temperature Sensors
|
|
207
|
+//
|
|
208
|
+#define TEMP_0_PIN PF4 // T1 <-> E0
|
|
209
|
+#define TEMP_1_PIN PF5 // T2 <-> E1
|
|
210
|
+#define TEMP_2_PIN PF6 // T3 <-> E2
|
|
211
|
+#define TEMP_BED_PIN PF3 // T0 <-> Bed
|
|
212
|
+
|
|
213
|
+//
|
|
214
|
+// Heaters / Fans
|
|
215
|
+//
|
|
216
|
+#define HEATER_0_PIN PB1 // Heater0
|
|
217
|
+#define HEATER_1_PIN PD14 // Heater1
|
|
218
|
+#define HEATER_2_PIN PB0 // Heater1
|
|
219
|
+#define HEATER_BED_PIN PD12 // Hotbed
|
|
220
|
+#define FAN_PIN PC8 // Fan0
|
|
221
|
+#define FAN1_PIN PE5 // Fan1
|
|
222
|
+#define FAN2_PIN PE6
|
|
223
|
+
|
|
224
|
+#ifndef E0_AUTO_FAN_PIN
|
|
225
|
+ #define E0_AUTO_FAN_PIN FAN1_PIN
|
|
226
|
+#endif
|
|
227
|
+
|
|
228
|
+//
|
|
229
|
+// Misc. Functions
|
|
230
|
+//
|
|
231
|
+
|
|
232
|
+#ifndef SDCARD_CONNECTION
|
|
233
|
+ #define SDCARD_CONNECTION LCD
|
|
234
|
+#endif
|
|
235
|
+
|
|
236
|
+//
|
|
237
|
+// Onboard SD card
|
|
238
|
+// Must use soft SPI because Marlin's default hardware SPI is tied to LCD's EXP2
|
|
239
|
+//
|
|
240
|
+#if SD_CONNECTION_IS(ONBOARD)
|
|
241
|
+ #define SOFTWARE_SPI // Use soft SPI for onboard SD
|
|
242
|
+ #define SDSS PA4
|
|
243
|
+ #define SCK_PIN PA5
|
|
244
|
+ #define MISO_PIN PA6
|
|
245
|
+ #define MOSI_PIN PB5
|
|
246
|
+#endif
|
|
247
|
+
|
|
248
|
+/**
|
|
249
|
+ * _____ _____
|
|
250
|
+ * NC | · · | GND 5V | · · | GND
|
|
251
|
+ * RESET | · · | PF12(SD_DETECT) (LCD_D7) PG7 | · · | PG6 (LCD_D6)
|
|
252
|
+ * (MOSI)PB15 | · · | PF11(BTN_EN2) (LCD_D5) PG3 | · · | PG2 (LCD_D4)
|
|
253
|
+ * (SD_SS)PB12 | · · | PG10(BTN_EN1) (LCD_RS) PD10 | · · | PD11 (LCD_EN)
|
|
254
|
+ * (SCK)PB13 | · · | PB14(MISO) (BTN_ENC) PA8 | · · | PG4 (BEEPER)
|
|
255
|
+ *  ̄ ̄  ̄ ̄
|
|
256
|
+ * EXP2 EXP1
|
|
257
|
+ */
|
|
258
|
+
|
|
259
|
+//
|
|
260
|
+// LCDs and Controllers
|
|
261
|
+//
|
|
262
|
+#if HAS_SPI_LCD
|
|
263
|
+ #define BEEPER_PIN PG4
|
|
264
|
+ #define BTN_ENC PA8
|
|
265
|
+ #if SD_CONNECTION_IS(LCD)
|
|
266
|
+ #define SDSS PB12 // Uses default hardware SPI for LCD's SD
|
|
267
|
+ #endif
|
|
268
|
+
|
|
269
|
+ #if ENABLED(CR10_STOCKDISPLAY)
|
|
270
|
+ #define LCD_PINS_RS PG6
|
|
271
|
+
|
|
272
|
+ #define BTN_EN1 PD11
|
|
273
|
+ #define BTN_EN2 PG2
|
|
274
|
+
|
|
275
|
+ #define LCD_PINS_ENABLE PG7
|
|
276
|
+ #define LCD_PINS_D4 PG3
|
|
277
|
+
|
|
278
|
+ // CR10_Stock Display needs a different delay setting on SKR PRO v1.1, so undef it here.
|
|
279
|
+ // It will be defined again at the #HAS_GRAPHICAL_LCD section below.
|
|
280
|
+ #undef ST7920_DELAY_1
|
|
281
|
+ #undef ST7920_DELAY_2
|
|
282
|
+ #undef ST7920_DELAY_3
|
|
283
|
+
|
|
284
|
+ #elif ENABLED(MKS_MINI_12864)
|
|
285
|
+ #define DOGLCD_A0 PG6
|
|
286
|
+ #define DOGLCD_CS PG3
|
|
287
|
+
|
|
288
|
+ #else
|
|
289
|
+
|
|
290
|
+ #define LCD_PINS_RS PD10
|
|
291
|
+
|
|
292
|
+ #define BTN_EN1 PG10
|
|
293
|
+ #define BTN_EN2 PF11
|
|
294
|
+ #define SD_DETECT_PIN PF12
|
|
295
|
+
|
|
296
|
+ #define LCD_SDSS PB12
|
|
297
|
+
|
|
298
|
+ #define LCD_PINS_ENABLE PD11
|
|
299
|
+ #define LCD_PINS_D4 PG2
|
|
300
|
+
|
|
301
|
+ #if ENABLED(FYSETC_MINI_12864)
|
|
302
|
+ #define DOGLCD_CS PD11
|
|
303
|
+ #define DOGLCD_A0 PD10
|
|
304
|
+ //#define LCD_BACKLIGHT_PIN -1
|
|
305
|
+ #define LCD_RESET_PIN PG2 // Must be high or open for LCD to operate normally.
|
|
306
|
+ #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0)
|
|
307
|
+ #ifndef RGB_LED_R_PIN
|
|
308
|
+ #define RGB_LED_R_PIN PG3
|
|
309
|
+ #endif
|
|
310
|
+ #ifndef RGB_LED_G_PIN
|
|
311
|
+ #define RGB_LED_G_PIN PG6
|
|
312
|
+ #endif
|
|
313
|
+ #ifndef RGB_LED_B_PIN
|
|
314
|
+ #define RGB_LED_B_PIN PG7
|
|
315
|
+ #endif
|
|
316
|
+ #elif ENABLED(FYSETC_MINI_12864_2_1)
|
|
317
|
+ #define NEOPIXEL_PIN PG3
|
|
318
|
+ #endif
|
|
319
|
+ #endif // !FYSETC_MINI_12864
|
|
320
|
+
|
|
321
|
+ #if ENABLED(ULTIPANEL)
|
|
322
|
+ #define LCD_PINS_D5 PG3
|
|
323
|
+ #define LCD_PINS_D6 PG6
|
|
324
|
+ #define LCD_PINS_D7 PG7
|
|
325
|
+ #endif
|
|
326
|
+
|
|
327
|
+ #endif
|
|
328
|
+
|
|
329
|
+ // Alter timing for graphical display
|
|
330
|
+ #if HAS_GRAPHICAL_LCD
|
|
331
|
+ #define BOARD_ST7920_DELAY_1 DELAY_NS(96)
|
|
332
|
+ #define BOARD_ST7920_DELAY_2 DELAY_NS(48)
|
|
333
|
+ #define BOARD_ST7920_DELAY_3 DELAY_NS(600)
|
|
334
|
+ #endif
|
|
335
|
+
|
|
336
|
+#endif // HAS_SPI_LCD
|
|
337
|
+
|
|
338
|
+//
|
|
339
|
+// WIFI
|
|
340
|
+//
|
|
341
|
+
|
|
342
|
+/**
|
|
343
|
+ * _____
|
|
344
|
+ * TX | 1 2 | GND Enable PG1 // Must be high for module to run
|
|
345
|
+ * Enable | 3 4 | GPIO2 Reset PG0 // active low, probably OK to leave floating
|
|
346
|
+ * Reset | 5 6 | GPIO0 GPIO2 PF15 // must be high (ESP3D software configures this with a pullup so OK to leave as floating)
|
|
347
|
+ * 3.3V| 7 8 | RX GPIO0 PF14 // Leave as unused (ESP3D software configures this with a pullup so OK to leave as floating)
|
|
348
|
+ *  ̄ ̄
|
|
349
|
+ * W1
|
|
350
|
+ */
|
|
351
|
+#define ESP_WIFI_MODULE_COM 6 // Must also set either SERIAL_PORT or SERIAL_PORT_2 to this
|
|
352
|
+#define ESP_WIFI_MODULE_BAUDRATE BAUDRATE // Must use same BAUDRATE as SERIAL_PORT & SERIAL_PORT_2
|
|
353
|
+#define ESP_WIFI_MODULE_RESET_PIN PG0
|
|
354
|
+#define ESP_WIFI_MODULE_ENABLE_PIN PG1
|
|
355
|
+#define ESP_WIFI_MODULE_GPIO0_PIN PF14
|
|
356
|
+#define ESP_WIFI_MODULE_GPIO2_PIN PF15
|