Prusa MINI Firmware overview
pins_MKS_SGEN_L.h
Go to the documentation of this file.
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 #pragma once
23 
24 /**
25  * MKS SGEN-L pin assignments
26  */
27 
28 #ifndef TARGET_LPC1768
29  #error "Oops! Make sure you have the LPC1768 environment selected in your IDE."
30 #endif
31 
32 #define BOARD_INFO_NAME "MKS SGen-L"
33 #define BOARD_WEBSITE_URL "github.com/makerbase-mks/MKS-SGEN_L"
34 
35 //
36 // Servos
37 //
38 #define SERVO0_PIN P1_23 // SERVO P1.23
39 #define SERVO1_PIN P2_00 // SERVO P2.0
40 
41 //
42 // Limit Switches
43 //
44 #define X_MIN_PIN P1_29
45 #define X_MAX_PIN P1_28
46 #define Y_MIN_PIN P1_27
47 #define Y_MAX_PIN P1_26
48 #define Z_MIN_PIN P1_25
49 #define Z_MAX_PIN P1_24
50 
51 //
52 // Z Probe (when not Z_MIN_PIN)
53 //
54 #ifndef Z_MIN_PROBE_PIN
55  #define Z_MIN_PROBE_PIN P1_24
56 #endif
57 
58 //
59 // Steppers
60 //
61 #define X_STEP_PIN P2_02
62 #define X_DIR_PIN P2_03
63 #define X_ENABLE_PIN P2_01
64 #ifndef X_CS_PIN
65  #define X_CS_PIN P1_01
66 #endif
67 
68 #define Y_STEP_PIN P0_19
69 #define Y_DIR_PIN P0_20
70 #define Y_ENABLE_PIN P2_08
71 #ifndef Y_CS_PIN
72  #define Y_CS_PIN P1_08
73 #endif
74 
75 #define Z_STEP_PIN P0_22
76 #define Z_DIR_PIN P2_11
77 #define Z_ENABLE_PIN P0_21
78 #ifndef Z_CS_PIN
79  #define Z_CS_PIN P1_10
80 #endif
81 
82 #define E0_STEP_PIN P2_13
83 #define E0_DIR_PIN P0_11
84 #define E0_ENABLE_PIN P2_12
85 #ifndef E0_CS_PIN
86  #define E0_CS_PIN P1_15
87 #endif
88 
89 #define E1_STEP_PIN P0_01
90 #define E1_DIR_PIN P0_00
91 #define E1_ENABLE_PIN P0_10
92 #ifndef E1_CS_PIN
93  #define E1_CS_PIN P1_17
94 #endif
95 
96 //
97 // Software SPI pins for TMC2130 stepper drivers
98 //
99 #if ENABLED(TMC_USE_SW_SPI)
100  #ifndef TMC_SW_MOSI
101  #define TMC_SW_MOSI P4_28
102  #endif
103  #ifndef TMC_SW_MISO
104  #define TMC_SW_MISO P0_05
105  #endif
106  #ifndef TMC_SW_SCK
107  #define TMC_SW_SCK P0_04
108  #endif
109 #endif
110 
111 #if HAS_TMC220x
112  /**
113  * TMC2208/TMC2209 stepper drivers
114  *
115  * Hardware serial communication ports.
116  * If undefined software serial is used according to the pins below
117  */
118  //#define X_HARDWARE_SERIAL Serial
119  //#define X2_HARDWARE_SERIAL Serial1
120  //#define Y_HARDWARE_SERIAL Serial1
121  //#define Y2_HARDWARE_SERIAL Serial1
122  //#define Z_HARDWARE_SERIAL Serial1
123  //#define Z2_HARDWARE_SERIAL Serial1
124  //#define E0_HARDWARE_SERIAL Serial1
125  //#define E1_HARDWARE_SERIAL Serial1
126  //#define E2_HARDWARE_SERIAL Serial1
127  //#define E3_HARDWARE_SERIAL Serial1
128  //#define E4_HARDWARE_SERIAL Serial1
129 
130  //
131  // Software serial
132  //
133 
134  #define X_SERIAL_TX_PIN P1_04
135  #define X_SERIAL_RX_PIN P1_01
136 
137  #define Y_SERIAL_TX_PIN P1_09
138  #define Y_SERIAL_RX_PIN P1_08
139 
140  #define Z_SERIAL_TX_PIN P1_14
141  #define Z_SERIAL_RX_PIN P1_10
142 
143  #define E0_SERIAL_TX_PIN P1_16
144  #define E0_SERIAL_RX_PIN P1_15
145 
146  #define E1_SERIAL_TX_PIN P4_29
147  #define E1_SERIAL_RX_PIN P1_17
148 
149  #define Z2_SERIAL_TX_PIN P4_29
150  #define Z2_SERIAL_RX_PIN P1_17
151 
152 #endif // TMC2208 || TMC2209
153 
154 //
155 // Temperature Sensors
156 // 3.3V max when defined as an analog input
157 //
158 #define TEMP_0_PIN 0 // Analog Input A0 (TH1)
159 #define TEMP_BED_PIN 1 // Analog Input A1 (TB)
160 #define TEMP_1_PIN 2 // Analog Input A2 (TH2)
161 
162 //
163 // Heaters / Fans
164 //
165 #define HEATER_BED_PIN P2_05
166 #define HEATER_0_PIN P2_07
167 #define HEATER_1_PIN P2_06
168 #ifndef FAN_PIN
169  #define FAN_PIN P2_04
170 #endif
171 
172 //
173 // Misc. Functions
174 //
175 #define LED_PIN P1_18 // Used as a status indicator
176 #define LED2_PIN P1_19
177 #define LED3_PIN P1_20
178 #define LED4_PIN P1_21
179 
180 /**
181  * _____ _____
182  * (BEEPER) 1.31 | · · | 1.30 (BTN_ENC) (MISO) 0.8 | · · | 0.7 (SD_SCK)
183  * (LCD_EN) 0.18 | · · | 0.16 (LCD_RS) (BTN_EN1) 3.25 | · · | 0.28 (SD_CS2)
184  * (LCD_D4) 0.15 | · · | 0.17 (LCD_D5) (BTN_EN2) 3.26 | · · | 1.20 (SD_MOSI)
185  * (LCD_D6) 1.0 | · · | 1.22 (LCD_D7) (SD_DETECT) 0.27 | · · | RST
186  * GND | · · | 5V GND | · · | NC
187  * ----- -----
188  * EXP1 EXP2
189  */
190 #if HAS_SPI_LCD
191  #define BEEPER_PIN P1_31
192  #define BTN_ENC P1_30
193 
194  #if ENABLED(CR10_STOCKDISPLAY)
195  #define LCD_PINS_RS P1_00
196 
197  #define BTN_EN1 P0_18
198  #define BTN_EN2 P0_15
199 
200  #define LCD_PINS_ENABLE P1_22
201  #define LCD_PINS_D4 P0_17
202 
203  #else
204  #define LCD_PINS_RS P0_16
205 
206  #define BTN_EN1 P3_25
207  #define BTN_EN2 P3_26
208 
209  #define LCD_PINS_ENABLE P0_18
210  #define LCD_PINS_D4 P0_15
211 
212  #define LCD_SDSS P0_28
213  #define SD_DETECT_PIN P0_27
214 
215  #if ENABLED(FYSETC_MINI_12864)
216  #define DOGLCD_CS P0_18
217  #define DOGLCD_A0 P0_16
218  #define DOGLCD_SCK P0_07
219  #define DOGLCD_MOSI P1_20
220 
221  #define LCD_BACKLIGHT_PIN -1
222 
223  #define FORCE_SOFT_SPI // Use this if default of hardware SPI causes display problems
224  // results in LCD soft SPI mode 3, SD soft SPI mode 0
225 
226  #define LCD_RESET_PIN P0_15 // Must be high or open for LCD to operate normally.
227 
228  #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0)
229  #ifndef RGB_LED_R_PIN
230  #define RGB_LED_R_PIN P0_17
231  #endif
232  #ifndef RGB_LED_G_PIN
233  #define RGB_LED_G_PIN P1_00
234  #endif
235  #ifndef RGB_LED_B_PIN
236  #define RGB_LED_B_PIN P1_22
237  #endif
238  #elif ENABLED(FYSETC_MINI_12864_2_1)
239  #define NEOPIXEL_PIN P0_17
240  #endif
241 
242  #else // !FYSETC_MINI_12864
243 
244  #if ENABLED(MKS_MINI_12864)
245  #define DOGLCD_CS P0_17
246  #define DOGLCD_A0 P1_00
247  #endif
248 
249  #if ENABLED(ULTIPANEL)
250  #define LCD_PINS_D5 P0_17
251  #define LCD_PINS_D6 P1_00
252  #define LCD_PINS_D7 P1_22
253  #endif
254 
255  #endif // !FYSETC_MINI_12864
256 
257  #endif
258 
259 #endif // HAS_SPI_LCD
260 
261 #ifndef SDCARD_CONNECTION
262  #define SDCARD_CONNECTION ONBOARD
263 #endif
264 
265 #define ONBOARD_SD_CS_PIN P0_06 // Chip select for "System" SD card
266 
267 #if SD_CONNECTION_IS(LCD)
268  #define SCK_PIN P0_07
269  #define MISO_PIN P0_08
270  #define MOSI_PIN P0_09
271  #define SS_PIN P0_28
272 #elif SD_CONNECTION_IS(ONBOARD)
273  #define SD_DETECT_PIN P0_27
274  #define SCK_PIN P0_07
275  #define MISO_PIN P0_08
276  #define MOSI_PIN P0_09
277  #define SS_PIN ONBOARD_SD_CS_PIN
278 #elif SD_CONNECTION_IS(CUSTOM_CABLE)
279  #error "No custom SD drive cable defined for this board."
280 #endif
281 
282 //
283 // Other Pins
284 //
285 //#define PIN_P0_02 P0_02 // AUX1 (Interrupt Capable/ADC/Serial Port 0)
286 //#define PIN_P0_03 P0_03 // AUX1 (Interrupt Capable/ADC/Serial Port 0)
287 //#define PS_ON_PIN P1_23 // SERVO P1.23