Prusa MINI Firmware overview
pins_RAMPS_LINUX.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  * Arduino Mega with RAMPS v1.4 (or v1.3) pin assignments
26  *
27  * Applies to the following boards:
28  *
29  * RAMPS_14_EFB (Hotend, Fan, Bed)
30  * RAMPS_14_EEB (Hotend0, Hotend1, Bed)
31  * RAMPS_14_EFF (Hotend, Fan0, Fan1)
32  * RAMPS_14_EEF (Hotend0, Hotend1, Fan)
33  * RAMPS_14_SF (Spindle, Controller Fan)
34  *
35  * RAMPS_13_EFB (Hotend, Fan, Bed)
36  * RAMPS_13_EEB (Hotend0, Hotend1, Bed)
37  * RAMPS_13_EFF (Hotend, Fan0, Fan1)
38  * RAMPS_13_EEF (Hotend0, Hotend1, Fan)
39  * RAMPS_13_SF (Spindle, Controller Fan)
40  *
41  * Other pins_MYBOARD.h files may override these defaults
42  *
43  * Differences between
44  * RAMPS_13 | RAMPS_14
45  * 7 | 11
46  */
47 
48 #ifndef BOARD_INFO_NAME
49  #define BOARD_INFO_NAME "RAMPS 1.4"
50 #endif
51 
52 #define E2END 0xFFF // 4KB
53 
54 #define IS_RAMPS_EFB
55 
56 //
57 // Servos
58 //
59 #ifdef IS_RAMPS_13
60  #define SERVO0_PIN 7 // RAMPS_13 // Will conflict with BTN_EN2 on LCD_I2C_VIKI
61 #else
62  #define SERVO0_PIN 11
63 #endif
64 #define SERVO1_PIN 6
65 #define SERVO2_PIN 5
66 #ifndef SERVO3_PIN
67  #define SERVO3_PIN 4
68 #endif
69 
70 //
71 // Limit Switches
72 //
73 #define X_MIN_PIN 3
74 #ifndef X_MAX_PIN
75  #define X_MAX_PIN 2
76 #endif
77 #define Y_MIN_PIN 14
78 #define Y_MAX_PIN 15
79 #define Z_MIN_PIN 18
80 #define Z_MAX_PIN 19
81 
82 //
83 // Z Probe (when not Z_MIN_PIN)
84 //
85 #ifndef Z_MIN_PROBE_PIN
86  #define Z_MIN_PROBE_PIN 32
87 #endif
88 
89 //
90 // Steppers
91 //
92 #define X_STEP_PIN 54
93 #define X_DIR_PIN 55
94 #define X_ENABLE_PIN 38
95 #ifndef X_CS_PIN
96  #define X_CS_PIN 53
97 #endif
98 
99 #define Y_STEP_PIN 60
100 #define Y_DIR_PIN 61
101 #define Y_ENABLE_PIN 56
102 #ifndef Y_CS_PIN
103  #define Y_CS_PIN 49
104 #endif
105 
106 #define Z_STEP_PIN 46
107 #define Z_DIR_PIN 48
108 #define Z_ENABLE_PIN 62
109 #ifndef Z_CS_PIN
110  #define Z_CS_PIN 40
111 #endif
112 
113 #define E0_STEP_PIN 26
114 #define E0_DIR_PIN 28
115 #define E0_ENABLE_PIN 24
116 #ifndef E0_CS_PIN
117  #define E0_CS_PIN 42
118 #endif
119 
120 #define E1_STEP_PIN 36
121 #define E1_DIR_PIN 34
122 #define E1_ENABLE_PIN 30
123 #ifndef E1_CS_PIN
124  #define E1_CS_PIN 44
125 #endif
126 
127 //
128 // Temperature Sensors
129 //
130 #define TEMP_0_PIN 0 // Analog Input
131 #define TEMP_1_PIN 1 // Analog Input
132 #define TEMP_BED_PIN 2 // Analog Input
133 
134 // SPI for Max6675 or Max31855 Thermocouple
135 #if DISABLED(SDSUPPORT)
136  #define MAX6675_SS_PIN 66 // Don't use 53 if there is even the remote possibility of using Display/SD card
137 #else
138  #define MAX6675_SS_PIN 66 // Don't use 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present
139 #endif
140 
141 //
142 // Augmentation for auto-assigning RAMPS plugs
143 //
144 #if NONE(IS_RAMPS_EEB, IS_RAMPS_EEF, IS_RAMPS_EFB, IS_RAMPS_EFF, IS_RAMPS_SF) && !PIN_EXISTS(MOSFET_D)
145  #if HOTENDS > 1
146  #if TEMP_SENSOR_BED
147  #define IS_RAMPS_EEB
148  #else
149  #define IS_RAMPS_EEF
150  #endif
151  #elif TEMP_SENSOR_BED
152  #define IS_RAMPS_EFB
153  #else
154  #define IS_RAMPS_EFF
155  #endif
156 #endif
157 
158 //
159 // Heaters / Fans
160 //
161 #ifndef MOSFET_D_PIN
162  #define MOSFET_D_PIN -1
163 #endif
164 #ifndef RAMPS_D8_PIN
165  #define RAMPS_D8_PIN 8
166 #endif
167 #ifndef RAMPS_D9_PIN
168  #define RAMPS_D9_PIN 9
169 #endif
170 #ifndef RAMPS_D10_PIN
171  #define RAMPS_D10_PIN 10
172 #endif
173 
174 #define HEATER_0_PIN RAMPS_D10_PIN
175 
176 #if ENABLED(IS_RAMPS_EFB) // Hotend, Fan, Bed
177  #define FAN_PIN RAMPS_D9_PIN
178  #define HEATER_BED_PIN RAMPS_D8_PIN
179 #elif ENABLED(IS_RAMPS_EEF) // Hotend, Hotend, Fan
180  #define HEATER_1_PIN RAMPS_D9_PIN
181  #define FAN_PIN RAMPS_D8_PIN
182 #elif ENABLED(IS_RAMPS_EEB) // Hotend, Hotend, Bed
183  #define HEATER_1_PIN RAMPS_D9_PIN
184  #define HEATER_BED_PIN RAMPS_D8_PIN
185 #elif ENABLED(IS_RAMPS_EFF) // Hotend, Fan, Fan
186  #define FAN_PIN RAMPS_D9_PIN
187  #define FAN1_PIN RAMPS_D8_PIN
188 #elif ENABLED(IS_RAMPS_SF) // Spindle, Fan
189  #define FAN_PIN RAMPS_D8_PIN
190 #else // Non-specific are "EFB" (i.e., "EFBF" or "EFBE")
191  #define FAN_PIN RAMPS_D9_PIN
192  #define HEATER_BED_PIN RAMPS_D8_PIN
193  #if HOTENDS == 1
194  #define FAN1_PIN MOSFET_D_PIN
195  #else
196  #define HEATER_1_PIN MOSFET_D_PIN
197  #endif
198 #endif
199 
200 #ifndef FAN_PIN
201  #define FAN_PIN 4 // IO pin. Buffer needed
202 #endif
203 
204 //
205 // Misc. Functions
206 //
207 #define SDSS 53
208 #define LED_PIN 13
209 
210 #ifndef FILWIDTH_PIN
211  #define FILWIDTH_PIN 5 // Analog Input on AUX2
212 #endif
213 
214 // define digital pin 4 for the filament runout sensor. Use the RAMPS 1.4 digital input 4 on the servos connector
215 #ifndef FIL_RUNOUT_PIN
216  #define FIL_RUNOUT_PIN 4
217 #endif
218 
219 #ifndef PS_ON_PIN
220  #define PS_ON_PIN 12
221 #endif
222 
223 #if ENABLED(CASE_LIGHT_ENABLE) && !defined(CASE_LIGHT_PIN) && !defined(SPINDLE_LASER_ENA_PIN)
224  #if NUM_SERVOS <= 1 // Prefer the servo connector
225  #define CASE_LIGHT_PIN 6 // Hardware PWM
226  #elif HAS_FREE_AUX2_PINS // try to use AUX 2
227  #define CASE_LIGHT_PIN 44 // Hardware PWM
228  #endif
229 #endif
230 
231 //
232 // M3/M4/M5 - Spindle/Laser Control
233 //
234 #if HAS_CUTTER && !PIN_EXISTS(SPINDLE_LASER_ENA)
235  #if !defined(NUM_SERVOS) || NUM_SERVOS == 0 // Prefer the servo connector
236  #define SPINDLE_LASER_ENA_PIN 4 // Pullup or pulldown!
237  #define SPINDLE_LASER_PWM_PIN 6 // Hardware PWM
238  #define SPINDLE_DIR_PIN 5
239  #elif HAS_FREE_AUX2_PINS // try to use AUX 2
240  #define SPINDLE_LASER_ENA_PIN 40 // Pullup or pulldown!
241  #define SPINDLE_LASER_PWM_PIN 44 // Hardware PWM
242  #define SPINDLE_DIR_PIN 65
243  #endif
244 #endif
245 
246 //
247 // Průša i3 MK2 Multiplexer Support
248 //
249 #ifndef E_MUX0_PIN
250  #define E_MUX0_PIN 40 // Z_CS_PIN
251 #endif
252 #ifndef E_MUX1_PIN
253  #define E_MUX1_PIN 42 // E0_CS_PIN
254 #endif
255 #ifndef E_MUX2_PIN
256  #define E_MUX2_PIN 44 // E1_CS_PIN
257 #endif
258 
259 /**
260  * Default pins for TMC software SPI
261  */
262 #if ENABLED(TMC_USE_SW_SPI)
263  #ifndef TMC_SW_MOSI
264  #define TMC_SW_MOSI 66
265  #endif
266  #ifndef TMC_SW_MISO
267  #define TMC_SW_MISO 44
268  #endif
269  #ifndef TMC_SW_SCK
270  #define TMC_SW_SCK 64
271  #endif
272 #endif
273 
274 #if HAS_TMC220x
275  /**
276  * TMC2208/TMC2209 stepper drivers
277  *
278  * Hardware serial communication ports.
279  * If undefined software serial is used according to the pins below
280  */
281  //#define X_HARDWARE_SERIAL Serial1
282  //#define X2_HARDWARE_SERIAL Serial1
283  //#define Y_HARDWARE_SERIAL Serial1
284  //#define Y2_HARDWARE_SERIAL Serial1
285  //#define Z_HARDWARE_SERIAL Serial1
286  //#define Z2_HARDWARE_SERIAL Serial1
287  //#define E0_HARDWARE_SERIAL Serial1
288  //#define E1_HARDWARE_SERIAL Serial1
289  //#define E2_HARDWARE_SERIAL Serial1
290  //#define E3_HARDWARE_SERIAL Serial1
291  //#define E4_HARDWARE_SERIAL Serial1
292 
293  /**
294  * Software serial
295  */
296 
297  #ifndef X_SERIAL_TX_PIN
298  #define X_SERIAL_TX_PIN 40
299  #endif
300  #ifndef X_SERIAL_RX_PIN
301  #define X_SERIAL_RX_PIN 63
302  #endif
303  #ifndef X2_SERIAL_TX_PIN
304  #define X2_SERIAL_TX_PIN -1
305  #endif
306  #ifndef X2_SERIAL_RX_PIN
307  #define X2_SERIAL_RX_PIN -1
308  #endif
309 
310  #ifndef Y_SERIAL_TX_PIN
311  #define Y_SERIAL_TX_PIN 59
312  #endif
313  #ifndef Y_SERIAL_RX_PIN
314  #define Y_SERIAL_RX_PIN 64
315  #endif
316  #ifndef Y2_SERIAL_TX_PIN
317  #define Y2_SERIAL_TX_PIN -1
318  #endif
319  #ifndef Y2_SERIAL_RX_PIN
320  #define Y2_SERIAL_RX_PIN -1
321  #endif
322 
323  #ifndef Z_SERIAL_TX_PIN
324  #define Z_SERIAL_TX_PIN 42
325  #endif
326  #ifndef Z_SERIAL_RX_PIN
327  #define Z_SERIAL_RX_PIN 65
328  #endif
329  #ifndef Z2_SERIAL_TX_PIN
330  #define Z2_SERIAL_TX_PIN -1
331  #endif
332  #ifndef Z2_SERIAL_RX_PIN
333  #define Z2_SERIAL_RX_PIN -1
334  #endif
335 
336  #ifndef E0_SERIAL_TX_PIN
337  #define E0_SERIAL_TX_PIN 44
338  #endif
339  #ifndef E0_SERIAL_RX_PIN
340  #define E0_SERIAL_RX_PIN 66
341  #endif
342  #ifndef E1_SERIAL_TX_PIN
343  #define E1_SERIAL_TX_PIN -1
344  #endif
345  #ifndef E1_SERIAL_RX_PIN
346  #define E1_SERIAL_RX_PIN -1
347  #endif
348  #ifndef E2_SERIAL_TX_PIN
349  #define E2_SERIAL_TX_PIN -1
350  #endif
351  #ifndef E2_SERIAL_RX_PIN
352  #define E2_SERIAL_RX_PIN -1
353  #endif
354  #ifndef E3_SERIAL_TX_PIN
355  #define E3_SERIAL_TX_PIN -1
356  #endif
357  #ifndef E3_SERIAL_RX_PIN
358  #define E3_SERIAL_RX_PIN -1
359  #endif
360  #ifndef E4_SERIAL_TX_PIN
361  #define E4_SERIAL_TX_PIN -1
362  #endif
363  #ifndef E4_SERIAL_RX_PIN
364  #define E4_SERIAL_RX_PIN -1
365  #endif
366 #endif
367 
368 //////////////////////////
369 // LCDs and Controllers //
370 //////////////////////////
371 
372 #if HAS_SPI_LCD
373 
374  //
375  // LCD Display output pins
376  //
377  #if ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
378 
379  #define LCD_PINS_RS 49 // CS chip select /SS chip slave select
380  #define LCD_PINS_ENABLE 51 // SID (MOSI)
381  #define LCD_PINS_D4 52 // SCK (CLK) clock
382 
383  #elif BOTH(NEWPANEL, PANEL_ONE)
384 
385  #define LCD_PINS_RS 40
386  #define LCD_PINS_ENABLE 42
387  #define LCD_PINS_D4 65
388  #define LCD_PINS_D5 66
389  #define LCD_PINS_D6 44
390  #define LCD_PINS_D7 64
391 
392  #else
393 
394  #if ENABLED(CR10_STOCKDISPLAY)
395 
396  #define LCD_PINS_RS 27
397  #define LCD_PINS_ENABLE 29
398  #define LCD_PINS_D4 25
399 
400  #if DISABLED(NEWPANEL)
401  #define BEEPER_PIN 37
402  #endif
403 
404  #elif ENABLED(ZONESTAR_LCD)
405 
406  #define LCD_PINS_RS 64
407  #define LCD_PINS_ENABLE 44
408  #define LCD_PINS_D4 63
409  #define LCD_PINS_D5 40
410  #define LCD_PINS_D6 42
411  #define LCD_PINS_D7 65
412 
413  #else
414 
415  #if EITHER(MKS_12864OLED, MKS_12864OLED_SSD1306)
416  #define LCD_PINS_DC 25 // Set as output on init
417  #define LCD_PINS_RS 27 // Pull low for 1s to init
418  // DOGM SPI LCD Support
419  #define DOGLCD_CS 16
420  #define DOGLCD_MOSI 17
421  #define DOGLCD_SCK 23
422  #define DOGLCD_A0 LCD_PINS_DC
423  #else
424  #define LCD_PINS_RS 16
425  #define LCD_PINS_ENABLE 17
426  #define LCD_PINS_D4 23
427  #define LCD_PINS_D5 25
428  #define LCD_PINS_D6 27
429  #endif
430 
431  #define LCD_PINS_D7 29
432 
433  #if DISABLED(NEWPANEL)
434  #define BEEPER_PIN 33
435  #endif
436 
437  #endif
438 
439  #if DISABLED(NEWPANEL)
440  // Buttons attached to a shift register
441  // Not wired yet
442  //#define SHIFT_CLK 38
443  //#define SHIFT_LD 42
444  //#define SHIFT_OUT 40
445  //#define SHIFT_EN 17
446  #endif
447 
448  #endif
449 
450  //
451  // LCD Display input pins
452  //
453  #if ENABLED(NEWPANEL)
454 
455  #if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER)
456 
457  #define BEEPER_PIN 37
458 
459  #if ENABLED(CR10_STOCKDISPLAY)
460  #define BTN_EN1 17
461  #define BTN_EN2 23
462  #else
463  #define BTN_EN1 31
464  #define BTN_EN2 33
465  #endif
466 
467  #define BTN_ENC 35
468  #define SD_DETECT_PIN 49
469  #define KILL_PIN 41
470 
471  #if ENABLED(BQ_LCD_SMART_CONTROLLER)
472  #define LCD_BACKLIGHT_PIN 39
473  #endif
474 
475  #elif ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
476 
477  #define BTN_EN1 64
478  #define BTN_EN2 59
479  #define BTN_ENC 63
480  #define SD_DETECT_PIN 42
481 
482  #elif ENABLED(LCD_I2C_PANELOLU2)
483 
484  #define BTN_EN1 47
485  #define BTN_EN2 43
486  #define BTN_ENC 32
487  #define LCD_SDSS SDSS
488  #define KILL_PIN 41
489 
490  #elif ENABLED(LCD_I2C_VIKI)
491 
492  #define BTN_EN1 22 // http://files.panucatt.com/datasheets/viki_wiring_diagram.pdf explains 40/42.
493  #define BTN_EN2 7 // 22/7 are unused on RAMPS_14. 22 is unused and 7 the SERVO0_PIN on RAMPS_13.
494  #define BTN_ENC -1
495 
496  #define LCD_SDSS SDSS
497  #define SD_DETECT_PIN 49
498 
499  #elif ANY(VIKI2, miniVIKI)
500 
501  #define DOGLCD_CS 45
502  #define DOGLCD_A0 44
503  #define LCD_SCREEN_ROT_180
504 
505  #define BEEPER_PIN 33
506  #define STAT_LED_RED_PIN 32
507  #define STAT_LED_BLUE_PIN 35
508 
509  #define BTN_EN1 22
510  #define BTN_EN2 7
511  #define BTN_ENC 39
512 
513  #define SD_DETECT_PIN -1 // Pin 49 for display sd interface, 72 for easy adapter board
514  #define KILL_PIN 31
515 
516  #elif ENABLED(ELB_FULL_GRAPHIC_CONTROLLER)
517 
518  #define DOGLCD_CS 29
519  #define DOGLCD_A0 27
520 
521  #define BEEPER_PIN 23
522  #define LCD_BACKLIGHT_PIN 33
523 
524  #define BTN_EN1 35
525  #define BTN_EN2 37
526  #define BTN_ENC 31
527 
528  #define LCD_SDSS SDSS
529  #define SD_DETECT_PIN 49
530  #define KILL_PIN 41
531 
532  #elif ENABLED(MKS_MINI_12864) // Added in Marlin 1.1.6
533 
534  #define DOGLCD_A0 27
535  #define DOGLCD_CS 25
536 
537  // GLCD features
538  // Uncomment screen orientation
539  //#define LCD_SCREEN_ROT_90
540  //#define LCD_SCREEN_ROT_180
541  //#define LCD_SCREEN_ROT_270
542 
543  #define BEEPER_PIN 37
544  // not connected to a pin
545  #define LCD_BACKLIGHT_PIN 65 // backlight LED on A11/D65
546 
547  #define BTN_EN1 31
548  #define BTN_EN2 33
549  #define BTN_ENC 35
550 
551  #define SD_DETECT_PIN 49
552  #define KILL_PIN 64
553 
554  #elif ENABLED(MINIPANEL)
555 
556  #define BEEPER_PIN 42
557  // not connected to a pin
558  #define LCD_BACKLIGHT_PIN 65 // backlight LED on A11/D65
559 
560  #define DOGLCD_A0 44
561  #define DOGLCD_CS 66
562 
563  // GLCD features
564  // Uncomment screen orientation
565  //#define LCD_SCREEN_ROT_90
566  //#define LCD_SCREEN_ROT_180
567  //#define LCD_SCREEN_ROT_270
568 
569  #define BTN_EN1 40
570  #define BTN_EN2 63
571  #define BTN_ENC 59
572 
573  #define SD_DETECT_PIN 49
574  #define KILL_PIN 64
575 
576  #elif ENABLED(ZONESTAR_LCD)
577 
578  #define ADC_KEYPAD_PIN 12
579 
580  #elif ENABLED(AZSMZ_12864)
581 
582  // Pins only defined for RAMPS_SMART currently
583 
584  #else
585 
586  // Beeper on AUX-4
587  #define BEEPER_PIN 33
588 
589  // Buttons are directly attached to AUX-2
590  #if ENABLED(REPRAPWORLD_KEYPAD)
591  #define SHIFT_OUT 40
592  #define SHIFT_CLK 44
593  #define SHIFT_LD 42
594  #define BTN_EN1 64
595  #define BTN_EN2 59
596  #define BTN_ENC 63
597  #elif ENABLED(PANEL_ONE)
598  #define BTN_EN1 59 // AUX2 PIN 3
599  #define BTN_EN2 63 // AUX2 PIN 4
600  #define BTN_ENC 49 // AUX3 PIN 7
601  #else
602  #define BTN_EN1 37
603  #define BTN_EN2 35
604  #define BTN_ENC 31
605  #endif
606 
607  #if ENABLED(G3D_PANEL)
608  #define SD_DETECT_PIN 49
609  #define KILL_PIN 41
610  #endif
611 
612  #endif
613  #endif // NEWPANEL
614 
615 #endif // HAS_SPI_LCD