Prusa MINI Firmware overview
pins_RAMPS_RE_ARM.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  * Re-ARM with RAMPS v1.4 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  */
36 
37 // Numbers in parentheses () are the corresponding mega2560 pin numbers
38 
39 #ifndef TARGET_LPC1768
40  #error "Oops! Make sure you have the LPC1768 environment selected in your IDE."
41 #endif
42 
43 #define BOARD_INFO_NAME "Re-ARM RAMPS 1.4"
44 
45 //
46 // Servos
47 //
48 #define SERVO0_PIN P1_20 // (11)
49 #define SERVO1_PIN P1_21 // ( 6) also on J5-1
50 #define SERVO2_PIN P1_19 // ( 5)
51 #define SERVO3_PIN P1_18 // ( 4) 5V output
52 
53 //
54 // Limit Switches
55 //
56 #define X_MIN_PIN P1_24 // ( 3) 10k pullup to 3.3V, 1K series
57 #define X_MAX_PIN P1_25 // ( 2) 10k pullup to 3.3V, 1K series
58 #define Y_MIN_PIN P1_26 // (14) 10k pullup to 3.3V, 1K series
59 #define Y_MAX_PIN P1_27 // (15) 10k pullup to 3.3V, 1K series
60 #define Z_MIN_PIN P1_29 // (18) 10k pullup to 3.3V, 1K series
61 #define Z_MAX_PIN P1_28 // (19) 10k pullup to 3.3V, 1K series
62 
63 //
64 // Steppers
65 //
66 #define X_STEP_PIN P2_01 // (54)
67 #define X_DIR_PIN P0_11 // (55)
68 #define X_ENABLE_PIN P0_10 // (38)
69 #ifndef X_CS_PIN
70  #define X_CS_PIN P1_01 // ETH
71 #endif
72 
73 #define Y_STEP_PIN P2_02 // (60)
74 #define Y_DIR_PIN P0_20 // (61)
75 #define Y_ENABLE_PIN P0_19 // (56)
76 #ifndef Y_CS_PIN
77  #define Y_CS_PIN P1_04 // ETH
78 #endif
79 
80 #define Z_STEP_PIN P2_03 // (46)
81 #define Z_DIR_PIN P0_22 // (48)
82 #define Z_ENABLE_PIN P0_21 // (62)
83 #ifndef Z_CS_PIN
84  #define Z_CS_PIN P1_10 // ETH
85 #endif
86 
87 #define E0_STEP_PIN P2_00 // (26)
88 #define E0_DIR_PIN P0_05 // (28)
89 #define E0_ENABLE_PIN P0_04 // (24)
90 #ifndef E0_CS_PIN
91  #define E0_CS_PIN P1_14 // ETH
92 #endif
93 
94 #define E1_STEP_PIN P2_08 // (36)
95 #define E1_DIR_PIN P2_13 // (34)
96 #define E1_ENABLE_PIN P4_29 // (30)
97 #ifndef E1_CS_PIN
98  #define E1_CS_PIN -1
99 #endif
100 
101 //
102 // Software SPI pins for TMC2130 stepper drivers
103 //
104 #if ENABLED(TMC_USE_SW_SPI)
105  #ifndef TMC_SW_MOSI
106  #define TMC_SW_MOSI P1_00 // ETH
107  #endif
108  #ifndef TMC_SW_MISO
109  #define TMC_SW_MISO P1_08 // ETH
110  #endif
111  #ifndef TMC_SW_SCK
112  #define TMC_SW_SCK P1_09 // ETH
113  #endif
114 #endif
115 
116 #if HAS_TMC220x
117  /**
118  * TMC2208/TMC2209 stepper drivers
119  *
120  * Hardware serial communication ports.
121  * If undefined software serial is used according to the pins below
122  */
123 
124  //
125  // Software serial
126  //
127 
128  // P2_08 E1-Step
129  // P2_13 E1-Dir
130 
131  #ifndef X_SERIAL_TX_PIN
132  #define X_SERIAL_TX_PIN P0_01
133  #endif
134  #ifndef X_SERIAL_RX_PIN
135  #define X_SERIAL_RX_PIN P0_01
136  #endif
137 
138  #ifndef Y_SERIAL_TX_PIN
139  #define Y_SERIAL_TX_PIN P0_00
140  #endif
141  #ifndef Y_SERIAL_RX_PIN
142  #define Y_SERIAL_RX_PIN P0_00
143  #endif
144 
145  #ifndef Z_SERIAL_TX_PIN
146  #define Z_SERIAL_TX_PIN P2_13
147  #endif
148  #ifndef Z_SERIAL_RX_PIN
149  #define Z_SERIAL_RX_PIN P2_13
150  #endif
151 
152  #ifndef E0_SERIAL_TX_PIN
153  #define E0_SERIAL_TX_PIN P2_08
154  #endif
155  #ifndef E0_SESIAL_RX_PIN
156  #define E0_SERIAL_RX_PIN P2_08
157  #endif
158 
159 #endif
160 
161 //
162 // Temperature Sensors
163 // 3.3V max when defined as an analog input
164 //
165 #define TEMP_0_PIN 0 // A0 (T0) - (67) - TEMP_0_PIN
166 #define TEMP_BED_PIN 1 // A1 (T1) - (68) - TEMP_BED_PIN
167 #define TEMP_1_PIN 2 // A2 (T2) - (69) - TEMP_1_PIN
168 #define TEMP_2_PIN 3 // A3 - (63) - J5-3 & AUX-2
169 #define TEMP_3_PIN 4 // A4 - (37) - BUZZER_PIN
170 //#define TEMP_4_PIN 5 // A5 - (49) - SD_DETECT_PIN
171 //#define ?? 6 // A6 - ( 0) - RXD0 - J4-4 & AUX-1
172 #define FILWIDTH_PIN 7 // A7 - ( 1) - TXD0 - J4-5 & AUX-1
173 
174 //
175 // Augmentation for auto-assigning RAMPS plugs
176 //
177 #if NONE(IS_RAMPS_EEB, IS_RAMPS_EEF, IS_RAMPS_EFB, IS_RAMPS_EFF, IS_RAMPS_SF) && !PIN_EXISTS(MOSFET_D)
178  #if HOTENDS > 1
179  #if TEMP_SENSOR_BED
180  #define IS_RAMPS_EEB
181  #else
182  #define IS_RAMPS_EEF
183  #endif
184  #elif TEMP_SENSOR_BED
185  #define IS_RAMPS_EFB
186  #else
187  #define IS_RAMPS_EFF
188  #endif
189 #endif
190 
191 //
192 // Heaters / Fans
193 //
194 #ifndef MOSFET_D_PIN
195  #define MOSFET_D_PIN -1
196 #endif
197 #ifndef RAMPS_D8_PIN
198  #define RAMPS_D8_PIN P2_07 // (8)
199 #endif
200 #ifndef RAMPS_D9_PIN
201  #define RAMPS_D9_PIN P2_04 // (9)
202 #endif
203 #ifndef RAMPS_D10_PIN
204  #define RAMPS_D10_PIN P2_05 // (10)
205 #endif
206 
207 #define HEATER_0_PIN RAMPS_D10_PIN
208 
209 #if ENABLED(IS_RAMPS_EFB) // Hotend, Fan, Bed
210  #define HEATER_BED_PIN RAMPS_D8_PIN
211 #elif ENABLED(IS_RAMPS_EEF) // Hotend, Hotend, Fan
212  #define HEATER_1_PIN RAMPS_D9_PIN
213 #elif ENABLED(IS_RAMPS_EEB) // Hotend, Hotend, Bed
214  #define HEATER_1_PIN RAMPS_D9_PIN
215  #define HEATER_BED_PIN RAMPS_D8_PIN
216 #elif ENABLED(IS_RAMPS_EFF) // Hotend, Fan, Fan
217  #define FAN1_PIN RAMPS_D8_PIN
218 #elif DISABLED(IS_RAMPS_SF) // Not Spindle, Fan (i.e., "EFBF" or "EFBE")
219  #define HEATER_BED_PIN RAMPS_D8_PIN
220  #if HOTENDS == 1
221  #define FAN1_PIN MOSFET_D_PIN
222  #else
223  #define HEATER_1_PIN MOSFET_D_PIN
224  #endif
225 #endif
226 
227 #ifndef FAN_PIN
228  #if EITHER(IS_RAMPS_EFB, IS_RAMPS_EFF) // Hotend, Fan, Bed or Hotend, Fan, Fan
229  #define FAN_PIN RAMPS_D9_PIN
230  #elif EITHER(IS_RAMPS_EEF, IS_RAMPS_SF) // Hotend, Hotend, Fan or Spindle, Fan
231  #define FAN_PIN RAMPS_D8_PIN
232  #elif ENABLED(IS_RAMPS_EEB) // Hotend, Hotend, Bed
233  #define FAN_PIN P1_18 // (4) IO pin. Buffer needed
234  #else // Non-specific are "EFB" (i.e., "EFBF" or "EFBE")
235  #define FAN_PIN RAMPS_D9_PIN
236  #endif
237 #endif
238 
239 //
240 // Misc. Functions
241 //
242 #define LED_PIN P4_28 // (13)
243 
244 // define digital pin 5 for the filament runout sensor. Use the RAMPS 1.4 digital input 5 on the servos connector
245 #ifndef FIL_RUNOUT_PIN
246  #define FIL_RUNOUT_PIN P1_19 // (5)
247 #endif
248 
249 #define PS_ON_PIN P2_12 // (12)
250 
251 #if !defined(MAX6675_SS_PIN) && DISABLED(USE_ZMAX_PLUG)
252  #define MAX6675_SS_PIN P1_28
253 #endif
254 
255 #if ENABLED(CASE_LIGHT_ENABLE) && !PIN_EXISTS(CASE_LIGHT) && !defined(SPINDLE_LASER_ENA_PIN)
256  #if !defined(NUM_SERVOS) || NUM_SERVOS < 4 // Try to use servo connector
257  #define CASE_LIGHT_PIN P1_18 // (4) MUST BE HARDWARE PWM
258  #endif
259 #endif
260 
261 //
262 // M3/M4/M5 - Spindle/Laser Control
263 // Use servo pins, if available
264 //
265 #if HAS_CUTTER && !PIN_EXISTS(SPINDLE_LASER_ENA)
266  #if NUM_SERVOS > 1
267  #if ENABLED(SPINDLE_FEATURE)
268  #error "SPINDLE_FEATURE requires 3 free servo pins."
269  #else
270  #error "LASER_FEATURE requires 3 free servo pins."
271  #endif
272  #endif
273  #define SPINDLE_LASER_ENA_PIN SERVO1_PIN // (6) Pin should have a pullup/pulldown!
274  #define SPINDLE_LASER_PWM_PIN SERVO3_PIN // (4) MUST BE HARDWARE PWM
275  #define SPINDLE_DIR_PIN SERVO2_PIN // (5)
276 #endif
277 
278 //
279 // Průša i3 MK2 Multiplexer Support
280 //
281 #if SERIAL_PORT != 0 && SERIAL_PORT_2 != 0
282  #define E_MUX0_PIN P0_03 // ( 0) Z_CS_PIN
283  #define E_MUX1_PIN P0_02 // ( 1) E0_CS_PIN
284 #endif
285 #define E_MUX2_PIN P0_26 // (63) E1_CS_PIN
286 
287 /**
288  * LCD / Controller
289  *
290  * All controllers can use J3 and J5 on the Re-ARM board. Custom cabling will be required.
291  *
292  * - https://github.com/wolfmanjm/universal-panel-adapter
293  * - http://panucattdevices.freshdesk.com/support/solutions/articles/1000243195-lcd-display-installation
294  */
295 
296 /**
297  * Smart LCD adapter
298  *
299  * The Smart LCD adapter can be used for the two 10 pin LCD controllers such as
300  * REPRAP_DISCOUNT_SMART_CONTROLLER. It can't be used for controllers that use
301  * DOGLCD_A0, DOGLCD_CS, LCD_PINS_D5, LCD_PINS_D6 or LCD_PINS_D7. A custom cable
302  * is needed to pick up 5V for the EXP1 connection.
303  *
304  * SD card on the LCD uses the same SPI signals as the LCD. This results in garbage/lines
305  * on the LCD display during accesses of the SD card. The menus/code has been arranged so
306  * that the garbage/lines are erased immediately after the SD card accesses are completed.
307  */
308 
309 #if ENABLED(CR10_STOCKDISPLAY)
310 
311  // Re-Arm can support Creality stock display without SD card reader and single cable on EXP3.
312  // Re-Arm J3 pins 1 (p1.31) & 2 (P3.26) are not used. Stock cable will need to have one
313  // 10-pin IDC connector trimmed or replaced with a 12-pin IDC connector to fit J3.
314  // Requires REVERSE_ENCODER_DIRECTION in Configuration.h
315 
316  #define BEEPER_PIN P2_11 // J3-3 & AUX-4
317 
318  #define BTN_EN1 P0_16 // J3-7 & AUX-4
319  #define BTN_EN2 P1_23 // J3-5 & AUX-4
320  #define BTN_ENC P3_25 // J3-4 & AUX-4
321 
322  #define LCD_PINS_RS P0_15 // J3-9 & AUX-4 (CS)
323  #define LCD_PINS_ENABLE P0_18 // J3-10 & AUX-3 (SID, MOSI)
324  #define LCD_PINS_D4 P2_06 // J3-8 & AUX-3 (SCK, CLK)
325 
326 #elif HAS_SPI_LCD
327 
328  //#define SCK_PIN P0_15 // (52) system defined J3-9 & AUX-3
329  //#define MISO_PIN P0_17 // (50) system defined J3-10 & AUX-3
330  //#define MOSI_PIN P0_18 // (51) system defined J3-10 & AUX-3
331  //#define SS_PIN P1_23 // (53) system defined J3-5 & AUX-3 (Sometimes called SDSS)
332 
333  #if ENABLED(FYSETC_MINI_12864)
334  #define BEEPER_PIN P1_01
335  #define BTN_ENC P1_04
336  #else
337  #define BEEPER_PIN P1_30 // (37) not 5V tolerant
338  #define BTN_ENC P2_11 // (35) J3-3 & AUX-4
339  #endif
340 
341  #define BTN_EN1 P3_26 // (31) J3-2 & AUX-4
342  #define BTN_EN2 P3_25 // (33) J3-4 & AUX-4
343 
344  #define SD_DETECT_PIN P1_31 // (49) J3-1 & AUX-3 (NOT 5V tolerant)
345  #define KILL_PIN P1_22 // (41) J5-4 & AUX-4
346  #define LCD_PINS_RS P0_16 // (16) J3-7 & AUX-4
347  #define LCD_SDSS P0_16 // (16) J3-7 & AUX-4
348 
349  #if ENABLED(NEWPANEL)
350  #if ENABLED(REPRAPWORLD_KEYPAD)
351  #define SHIFT_OUT P0_18 // (51) (MOSI) J3-10 & AUX-3
352  #define SHIFT_CLK P0_15 // (52) (SCK) J3-9 & AUX-3
353  #define SHIFT_LD P1_31 // (49) J3-1 & AUX-3 (NOT 5V tolerant)
354  #endif
355  #else
356  //#define SHIFT_CLK P3_26 // (31) J3-2 & AUX-4
357  //#define SHIFT_LD P3_25 // (33) J3-4 & AUX-4
358  //#define SHIFT_OUT P2_11 // (35) J3-3 & AUX-4
359  //#define SHIFT_EN P1_22 // (41) J5-4 & AUX-4
360  #endif
361 
362  #if ANY(VIKI2, miniVIKI)
363  // #define LCD_SCREEN_ROT_180
364 
365  #define DOGLCD_CS P0_16 // (16)
366  #define DOGLCD_A0 P2_06 // (59) J3-8 & AUX-2
367  #define DOGLCD_SCK SCK_PIN
368  #define DOGLCD_MOSI MOSI_PIN
369 
370  #define STAT_LED_BLUE_PIN P0_26 //(63) may change if cable changes
371  #define STAT_LED_RED_PIN P1_21 // ( 6) may change if cable changes
372  #else
373 
374  #if ENABLED(FYSETC_MINI_12864)
375  #define DOGLCD_SCK P0_15
376  #define DOGLCD_MOSI P0_18
377 
378  // EXP1 on LCD adapter is not usable - using Ethernet connector instead
379  #define DOGLCD_CS P1_09
380  #define DOGLCD_A0 P1_14
381  //#define FORCE_SOFT_SPI // Use this if default of hardware SPI causes display problems
382  // results in LCD soft SPI mode 3, SD soft SPI mode 0
383 
384  #define LCD_RESET_PIN P0_16 // Must be high or open for LCD to operate normally.
385 
386  #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0)
387  #ifndef RGB_LED_R_PIN
388  #define RGB_LED_R_PIN P1_00
389  #endif
390  #ifndef RGB_LED_G_PIN
391  #define RGB_LED_G_PIN P1_01
392  #endif
393  #ifndef RGB_LED_B_PIN
394  #define RGB_LED_B_PIN P1_08
395  #endif
396  #elif ENABLED(FYSETC_MINI_12864_2_1)
397  #define NEOPIXEL_PIN P1_00
398  #endif
399  #else
400  #define DOGLCD_CS P0_26 // (63) J5-3 & AUX-2
401  #define DOGLCD_A0 P2_06 // (59) J3-8 & AUX-2
402  #endif
403 
404  #define LCD_BACKLIGHT_PIN P0_16 //(16) J3-7 & AUX-4 - only used on DOGLCD controllers
405  #define LCD_PINS_ENABLE P0_18 // (51) (MOSI) J3-10 & AUX-3
406  #define LCD_PINS_D4 P0_15 // (52) (SCK) J3-9 & AUX-3
407  #if ENABLED(ULTIPANEL)
408  #define LCD_PINS_D5 P1_17 // (71) ENET_MDIO
409  #define LCD_PINS_D6 P1_14 // (73) ENET_RX_ER
410  #define LCD_PINS_D7 P1_10 // (75) ENET_RXD1
411  #endif
412  #endif
413 
414  #if ENABLED(MINIPANEL)
415  // GLCD features
416  // Uncomment screen orientation
417  //#define LCD_SCREEN_ROT_90
418  //#define LCD_SCREEN_ROT_180
419  //#define LCD_SCREEN_ROT_270
420  #endif
421 
422 #endif // HAS_SPI_LCD
423 
424 //
425 // Ethernet pins
426 //
427 #if DISABLED(ULTIPANEL)
428  #define ENET_MDIO P1_17 // (71) J12-4
429  #define ENET_RX_ER P1_14 // (73) J12-6
430  #define ENET_RXD1 P1_10 // (75) J12-8
431 #endif
432 #define ENET_MOC P1_16 // (70) J12-3
433 #define REF_CLK P1_15 // (72) J12-5
434 #define ENET_RXD0 P1_09 // (74) J12-7
435 #define ENET_CRS P1_08 // (76) J12-9
436 #define ENET_TX_EN P1_04 // (77) J12-10
437 #define ENET_TXD0 P1_00 // (78) J12-11
438 #define ENET_TXD1 P1_01 // (79) J12-12
439 
440 //
441 // SD Support
442 //
443 #ifndef SDCARD_CONNECTION
444  #define SDCARD_CONNECTION ONBOARD
445 #endif
446 
447 #define ONBOARD_SD_CS_PIN P0_06 // Chip select for "System" SD card
448 
449 #if SD_CONNECTION_IS(LCD)
450  #define SCK_PIN P0_15 // (52) system defined J3-9 & AUX-3
451  #define MISO_PIN P0_17 // (50) system defined J3-10 & AUX-3
452  #define MOSI_PIN P0_18 // (51) system defined J3-10 & AUX-3
453  #define SS_PIN P1_23 // (53) system defined J3-5 & AUX-3 (Sometimes called SDSS) - CS used by Marlin
454 #elif SD_CONNECTION_IS(ONBOARD)
455  #undef SD_DETECT_PIN
456  #define SCK_PIN P0_07
457  #define MISO_PIN P0_08
458  #define MOSI_PIN P0_09
459  #define SS_PIN ONBOARD_SD_CS_PIN
460 #elif SD_CONNECTION_IS(CUSTOM_CABLE)
461  #error "No custom SD drive cable defined for this board."
462 #endif
463 
464 /**
465  * Fast PWMs
466  *
467  * The LPC1768's hardware PWM controller has 6 channels. Each channel
468  * can be setup to either control a dedicated pin directly or to generate
469  * an interrupt. The direct method's duty cycle is accurate to within a
470  * a microsecond. The interrupt method's average duty cycle has the
471  * the same accuracy but the individual cycles can vary because of higher
472  * priority interrupts.
473  *
474  * All Fast PWMs have a 50Hz rate.
475  *
476  * The following pins/signals use the direct method. All other pins use the
477  * the interrupt method. Note that SERVO2_PIN and RAMPS_D8_PIN use the
478  * interrupt method.
479  *
480  * P1_20 (11) SERVO0_PIN
481  * P1_21 ( 6) SERVO1_PIN J5-1
482  * P0_18 ( 4) SERVO3_PIN 5V output
483  * *P2_04 ( 9) RAMPS_D9_PIN
484  * *P2_05 (10) RAMPS_D10_PIN
485  *
486  * * - If used as a heater driver then a Fast PWM is NOT assigned. If used as
487  * a fan driver then enabling FAST_PWM_FAN assigns a Fast PWM to it.
488  */
489 
490  /**
491  * Special pins
492  * P1_30 (37) (NOT 5V tolerant)
493  * P1_31 (49) (NOT 5V tolerant)
494  * P0_27 (57) (Open collector)
495  * P0_28 (58) (Open collector)
496  */
497 
498 /**
499  * The following mega2560 pins are NOT available in a Re-ARM system:
500  *
501  * 7, 17, 22, 23, 25, 27, 29, 32, 39, 40, 42, 43, 44, 45, 47, 64, 65, 66
502  */