Skip to content

Commit a7b1bd1

Browse files
makerbase-mksvgadreau
authored andcommitted
MKS SGEN L V2 (MarlinFirmware#18822)
1 parent e4d8f69 commit a7b1bd1

File tree

3 files changed

+360
-0
lines changed

3 files changed

+360
-0
lines changed

Marlin/src/core/boards.h

+1
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@
235235
#define BOARD_SMOOTHIEBOARD 2506 // Smoothieboard
236236
#define BOARD_TH3D_EZBOARD 2507 // TH3D EZBoard v1.0
237237
#define BOARD_BTT_SKR_V1_4_TURBO 2508 // BigTreeTech SKR v1.4 TURBO (Power outputs: Hotend0, Hotend1, Fan, Bed)
238+
#define BOARD_MKS_SGEN_L_V2 2509 // MKS SGEN_L V2 (Power outputs: Hotend0, Hotend1, Bed, Fan)
238239

239240
//
240241
// SAM3X8E ARM Cortex M3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,357 @@
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 <https://www.gnu.org/licenses/>.
20+
*
21+
*/
22+
#pragma once
23+
24+
/**
25+
* MKS SGen pin assignments
26+
*/
27+
28+
#ifndef MCU_LPC1769
29+
#error "Oops! Make sure you have the LPC1769 environment selected in your IDE."
30+
#endif
31+
32+
#define BOARD_INFO_NAME "MKS SGEN_L V2"
33+
#define BOARD_WEBSITE_URL "github.com/makerbase-mks"
34+
35+
//
36+
// EEPROM, MKS SGEN_L V2.0 hardware has 4K EEPROM on the board
37+
//
38+
#if NO_EEPROM_SELECTED
39+
//#define SDCARD_EEPROM_EMULATION
40+
//#define I2C_EEPROM // AT24C32
41+
#define FLASH_EEPROM_EMULATION
42+
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
43+
#endif
44+
45+
//
46+
// Servos
47+
//
48+
#define SERVO0_PIN P1_23 // SERVO P1.23
49+
#define SERVO1_PIN P2_00 // SERVO P2.0
50+
51+
//
52+
// Trinamic Stallguard pins, can connect or disconnect by jumpers cap on the board
53+
//
54+
#define X_DIAG_PIN P1_29 // X-
55+
#define Y_DIAG_PIN P1_27 // Y-
56+
#define Z_DIAG_PIN P1_25 // Z-
57+
#define E0_DIAG_PIN P1_28 // X+
58+
#define E1_DIAG_PIN P1_26 // Y+
59+
60+
//
61+
// Limit Switches
62+
//
63+
#if X_STALL_SENSITIVITY
64+
#define X_STOP_PIN X_DIAG_PIN
65+
#if X_HOME_DIR < 0
66+
#define X_MAX_PIN P1_28 // X+
67+
#else
68+
#define X_MIN_PIN P1_28 // X+
69+
#endif
70+
#else
71+
#define X_MIN_PIN P1_29 // X-
72+
#define X_MAX_PIN P1_28 // X+
73+
#endif
74+
75+
#if Y_STALL_SENSITIVITY
76+
#define Y_STOP_PIN Y_DIAG_PIN
77+
#if Y_HOME_DIR < 0
78+
#define Y_MAX_PIN P1_26 // Y+
79+
#else
80+
#define Y_MIN_PIN P1_26 // Y+
81+
#endif
82+
#else
83+
#define Y_MIN_PIN P1_27 // Y-
84+
#define Y_MAX_PIN P1_26 // Y+
85+
#endif
86+
87+
#if Z_STALL_SENSITIVITY
88+
#define Z_STOP_PIN Z_DIAG_PIN
89+
#if Z_HOME_DIR < 0
90+
#define Z_MAX_PIN P1_24 // Z+
91+
#else
92+
#define Z_MIN_PIN P1_24 // Z+
93+
#endif
94+
#else
95+
#define Z_MIN_PIN P1_25 // Z-
96+
#define Z_MAX_PIN P1_24 // Z+
97+
#endif
98+
99+
//
100+
// Z Probe (when not Z_MIN_PIN)
101+
//
102+
#ifndef Z_MIN_PROBE_PIN
103+
#define Z_MIN_PROBE_PIN P1_24
104+
#endif
105+
106+
//
107+
// Steppers
108+
//
109+
#define X_STEP_PIN P2_02
110+
#define X_DIR_PIN P2_03
111+
#define X_ENABLE_PIN P2_01
112+
#ifndef X_CS_PIN
113+
#define X_CS_PIN P1_01
114+
#endif
115+
116+
#define Y_STEP_PIN P0_19
117+
#define Y_DIR_PIN P0_20
118+
#define Y_ENABLE_PIN P2_08
119+
#ifndef Y_CS_PIN
120+
#define Y_CS_PIN P1_08
121+
#endif
122+
123+
#define Z_STEP_PIN P0_22
124+
#define Z_DIR_PIN P2_11
125+
#define Z_ENABLE_PIN P0_21
126+
#ifndef Z_CS_PIN
127+
#define Z_CS_PIN P1_10
128+
#endif
129+
130+
#define E0_STEP_PIN P2_13
131+
#define E0_DIR_PIN P0_11
132+
#define E0_ENABLE_PIN P2_12
133+
#ifndef E0_CS_PIN
134+
#define E0_CS_PIN P1_15
135+
#endif
136+
137+
#define E1_STEP_PIN P1_09
138+
#define E1_DIR_PIN P1_14
139+
#define E1_ENABLE_PIN P0_10
140+
#ifndef E1_CS_PIN
141+
#define E1_CS_PIN P1_17
142+
#endif
143+
144+
//
145+
// Software SPI pins for TMC2130 stepper drivers
146+
//
147+
#if ENABLED(TMC_USE_SW_SPI)
148+
#ifndef TMC_SW_MOSI
149+
#define TMC_SW_MOSI P1_16
150+
#endif
151+
#ifndef TMC_SW_MISO
152+
#define TMC_SW_MISO P0_05
153+
#endif
154+
#ifndef TMC_SW_SCK
155+
#define TMC_SW_SCK P0_04
156+
#endif
157+
#endif
158+
159+
#if HAS_TMC_UART
160+
/**
161+
* TMC2208/TMC2209 stepper drivers
162+
*
163+
* Hardware serial communication ports.
164+
* If undefined software serial is used according to the pins below
165+
*/
166+
//#define X_HARDWARE_SERIAL Serial
167+
//#define X2_HARDWARE_SERIAL Serial1
168+
//#define Y_HARDWARE_SERIAL Serial1
169+
//#define Y2_HARDWARE_SERIAL Serial1
170+
//#define Z_HARDWARE_SERIAL Serial1
171+
//#define Z2_HARDWARE_SERIAL Serial1
172+
//#define E0_HARDWARE_SERIAL Serial1
173+
//#define E1_HARDWARE_SERIAL Serial1
174+
//#define E2_HARDWARE_SERIAL Serial1
175+
//#define E3_HARDWARE_SERIAL Serial1
176+
//#define E4_HARDWARE_SERIAL Serial1
177+
178+
//
179+
// Software serial
180+
//
181+
#define X_SERIAL_TX_PIN P1_01
182+
#define X_SERIAL_RX_PIN P1_01
183+
#define Y_SERIAL_TX_PIN P1_08
184+
#define Y_SERIAL_RX_PIN P1_08
185+
#define Z_SERIAL_TX_PIN P1_10
186+
#define Z_SERIAL_RX_PIN P1_10
187+
#define E0_SERIAL_TX_PIN P1_15
188+
#define E0_SERIAL_RX_PIN P1_15
189+
#define E1_SERIAL_TX_PIN P1_17
190+
#define E1_SERIAL_RX_PIN P1_17
191+
192+
// Reduce baud rate to improve software serial reliability
193+
#define TMC_BAUD_RATE 19200
194+
#endif // HAS_TMC_UART
195+
196+
//
197+
// Temperature Sensors
198+
// 3.3V max when defined as an analog input
199+
//
200+
#define TEMP_0_PIN P0_23_A0 // Analog Input A0 (TH1)
201+
#define TEMP_BED_PIN P0_24_A1 // Analog Input A1 (TB)
202+
#define TEMP_1_PIN P0_25_A2 // Analog Input A2 (TH2)
203+
#define TEMP_2_PIN P0_26_A3 // Analog Input A3 (P0.26, No pull up)
204+
205+
//
206+
// Heaters / Fans
207+
//
208+
#define HEATER_BED_PIN P2_05
209+
#define HEATER_0_PIN P2_07
210+
#if HOTENDS == 1
211+
#ifndef FAN1_PIN
212+
#define FAN1_PIN P2_06
213+
#endif
214+
#else
215+
#ifndef HEATER_1_PIN
216+
#define HEATER_1_PIN P2_06
217+
#endif
218+
#endif
219+
#ifndef FAN_PIN
220+
#define FAN_PIN P2_04
221+
#endif
222+
#ifndef FAN2_PIN
223+
#define FAN2_PIN P1_04
224+
#endif
225+
226+
//
227+
// Misc. Functions
228+
//
229+
#define LED_PIN P1_18 // Used as a status indicator
230+
#define LED2_PIN P1_19
231+
#define LED3_PIN P1_20
232+
#define LED4_PIN P1_21
233+
234+
/**
235+
* _____ _____
236+
* (BEEPER) 1.31 | · · | 1.30 (BTN_ENC) (MISO) 0.8 | · · | 0.7 (SD_SCK)
237+
* (LCD_EN) 0.18 | · · | 0.16 (LCD_RS) (BTN_EN1) 3.25 | · · | 0.28 (SD_CS2)
238+
* (LCD_D4) 0.15 | · ·| 0.17 (LCD_D5) (BTN_EN2) 3.26 | · ·| 0.9 (SD_MOSI)
239+
* (LCD_D6) 1.0 | · · | 1.22 (LCD_D7) (SD_DETECT) 0.27 | · · | RST
240+
* GND | · · | 5V GND | · · | NC
241+
* ----- -----
242+
* EXP1 EXP2
243+
*/
244+
#if HAS_SPI_LCD
245+
#define BEEPER_PIN P1_31
246+
#define BTN_ENC P1_30
247+
248+
#if ENABLED(CR10_STOCKDISPLAY)
249+
#define LCD_PINS_RS P1_00
250+
251+
#define BTN_EN1 P0_18
252+
#define BTN_EN2 P0_15
253+
254+
#define LCD_PINS_ENABLE P1_22
255+
#define LCD_PINS_D4 P0_17
256+
257+
#else
258+
259+
#define BTN_EN1 P3_25
260+
#define BTN_EN2 P3_26
261+
262+
#define LCD_SDSS P0_28
263+
264+
#if ENABLED(MKS_12864OLED_SSD1306)
265+
266+
#define LCD_PINS_DC P0_17
267+
#define DOGLCD_CS P0_16
268+
#define DOGLCD_A0 LCD_PINS_DC
269+
#define DOGLCD_SCK P0_15
270+
#define DOGLCD_MOSI P0_18
271+
272+
#define LCD_PINS_RS P1_00
273+
#define LCD_PINS_D7 P1_22
274+
#define KILL_PIN -1 // NC
275+
276+
#else // !MKS_12864OLED_SSD1306
277+
278+
#define LCD_PINS_RS P0_16
279+
280+
#define LCD_PINS_ENABLE P0_18
281+
#define LCD_PINS_D4 P0_15
282+
283+
#if ENABLED(FYSETC_MINI_12864)
284+
285+
#define DOGLCD_CS P0_18
286+
#define DOGLCD_A0 P0_16
287+
#define DOGLCD_SCK P0_07
288+
#define DOGLCD_MOSI P1_20
289+
290+
#define LCD_BACKLIGHT_PIN -1
291+
292+
#define FORCE_SOFT_SPI // Use this if default of hardware SPI causes display problems
293+
// results in LCD soft SPI mode 3, SD soft SPI mode 0
294+
295+
#define LCD_RESET_PIN P0_15 // Must be high or open for LCD to operate normally.
296+
297+
#if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0)
298+
#ifndef RGB_LED_R_PIN
299+
#define RGB_LED_R_PIN P0_17
300+
#endif
301+
#ifndef RGB_LED_G_PIN
302+
#define RGB_LED_G_PIN P1_00
303+
#endif
304+
#ifndef RGB_LED_B_PIN
305+
#define RGB_LED_B_PIN P1_22
306+
#endif
307+
#elif ENABLED(FYSETC_MINI_12864_2_1)
308+
#define NEOPIXEL_PIN P0_17
309+
#endif
310+
311+
#else // !FYSETC_MINI_12864
312+
313+
#if ENABLED(MKS_MINI_12864)
314+
#define DOGLCD_CS P0_17
315+
#define DOGLCD_A0 P1_00
316+
#endif
317+
318+
#if ENABLED(ULTIPANEL)
319+
#define LCD_PINS_D5 P0_17
320+
#define LCD_PINS_D6 P1_00
321+
#define LCD_PINS_D7 P1_22
322+
#endif
323+
324+
#endif // !FYSETC_MINI_12864
325+
326+
#endif // !MKS_12864OLED_SSD1306
327+
328+
#endif // !CR10_STOCKDISPLAY
329+
330+
#endif // HAS_SPI_LCD
331+
332+
#ifndef SDCARD_CONNECTION
333+
#define SDCARD_CONNECTION ONBOARD
334+
#endif
335+
336+
#define ONBOARD_SD_CS_PIN P0_06 // Chip select for "System" SD card
337+
338+
#if SD_CONNECTION_IS(LCD) || SD_CONNECTION_IS(ONBOARD)
339+
#define SD_DETECT_PIN P0_27
340+
#define SCK_PIN P0_07
341+
#define MISO_PIN P0_08
342+
#define MOSI_PIN P0_09
343+
#if SD_CONNECTION_IS(ONBOARD)
344+
#define SS_PIN ONBOARD_SD_CS_PIN
345+
#else
346+
#define SS_PIN P0_28
347+
#endif
348+
#elif SD_CONNECTION_IS(CUSTOM_CABLE)
349+
#error "No custom SD drive cable defined for this board."
350+
#endif
351+
352+
//
353+
// Other Pins
354+
//
355+
//#define PIN_P0_02 P0_02 // AUX1 (Interrupt Capable/ADC/Serial Port 0)
356+
//#define PIN_P0_03 P0_03 // AUX1 (Interrupt Capable/ADC/Serial Port 0)
357+
//#define PS_ON_PIN P1_23 // SERVO P1.23

Marlin/src/pins/pins.h

+2
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,8 @@
410410
#include "lpc1769/pins_TH3D_EZBOARD.h" // LPC1769 env:LPC1769
411411
#elif MB(BTT_SKR_V1_4_TURBO)
412412
#include "lpc1769/pins_BTT_SKR_V1_4_TURBO.h" // LPC1769 env:LPC1769
413+
#elif MB(MKS_SGEN_L_V2)
414+
#include "lpc1769/pins_MKS_SGEN_L_V2.h" // LPC1769 env:LPC1769
413415

414416
//
415417
// Due (ATSAM) boards

0 commit comments

Comments
 (0)