Prusa MINI Firmware overview
pins_SANGUINOLOLU_11.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  * Sanguinololu board pin assignments
26  */
27 
28 /**
29  * Rev B 26 DEC 2016
30  *
31  * 1) added pointer to a current Arduino IDE extension
32  * 2) added support for M3, M4 & M5 spindle control commands
33  * 3) added case light pin definition
34  *
35  */
36 
37 /**
38  * A useable Arduino IDE extension (board manager) can be found at
39  * https://github.com/Lauszus/Sanguino
40  *
41  * This extension has been tested on Arduino 1.6.12 & 1.8.0
42  *
43  * Here's the JSON path:
44  * https://raw.githubusercontent.com/Lauszus/Sanguino/master/package_lauszus_sanguino_index.json
45  *
46  * When installing select 1.0.2
47  *
48  * Installation instructions can be found at https://learn.sparkfun.com/pages/CustomBoardsArduino
49  * Just use the above JSON URL instead of Sparkfun's JSON.
50  *
51  * Once installed select the Sanguino board and then select the CPU.
52  *
53  */
54 
55 #if !defined(__AVR_ATmega644P__) && !defined(__AVR_ATmega1284P__)
56  #error "Oops! Select 'Sanguino' in 'Tools > Boards' and 'ATmega644P' or 'ATmega1284P' in 'Tools > Processor.'"
57 #endif
58 
59 #ifndef BOARD_INFO_NAME
60  #define BOARD_INFO_NAME "Sanguinololu <1.2"
61 #endif
62 
63 //
64 // Limit Switches
65 //
66 #define X_STOP_PIN 18
67 #define Y_STOP_PIN 19
68 #define Z_STOP_PIN 20
69 
70 //
71 // Steppers
72 //
73 #define X_STEP_PIN 15
74 #define X_DIR_PIN 21
75 
76 #define Y_STEP_PIN 22
77 #define Y_DIR_PIN 23
78 
79 #define Z_STEP_PIN 3
80 #define Z_DIR_PIN 2
81 
82 #define E0_STEP_PIN 1
83 #define E0_DIR_PIN 0
84 
85 //
86 // Temperature Sensors
87 //
88 #define TEMP_0_PIN 7 // Analog Input (pin 33 extruder)
89 #define TEMP_BED_PIN 6 // Analog Input (pin 34 bed)
90 
91 //
92 // Heaters / Fans
93 //
94 #define HEATER_0_PIN 13 // (extruder)
95 
96 #if ENABLED(SANGUINOLOLU_V_1_2)
97 
98  #define HEATER_BED_PIN 12 // (bed)
99  #define X_ENABLE_PIN 14
100  #define Y_ENABLE_PIN 14
101  #define Z_ENABLE_PIN 26
102  #define E0_ENABLE_PIN 14
103 
104  #if !defined(FAN_PIN) && ENABLED(LCD_I2C_PANELOLU2)
105  #define FAN_PIN 4 // Uses Transistor1 (PWM) on Panelolu2's Sanguino Adapter Board to drive the fan
106  #endif
107 
108 #else
109 
110  #define HEATER_BED_PIN 14 // (bed)
111  #define X_ENABLE_PIN -1
112  #define Y_ENABLE_PIN -1
113  #define Z_ENABLE_PIN -1
114  #define E0_ENABLE_PIN -1
115 
116 #endif
117 
118 #if !defined(FAN_PIN) && (MB(AZTEEG_X1, STB_11) || IS_MELZI)
119  #define FAN_PIN 4 // Works for Panelolu2 too
120 #endif
121 
122 //
123 // Misc. Functions
124 //
125 
126 /**
127  * In some versions of the Sanguino libraries the pin
128  * definitions are wrong, with SDSS = 24 and LED_PIN = 28 (Melzi).
129  * If you encounter issues with these pins, upgrade your
130  * Sanguino libraries! See #368.
131  */
132 //#define SDSS 24
133 #define SDSS 31
134 
135 #if IS_MELZI
136  #define LED_PIN 27
137 #elif MB(STB_11)
138  #define LCD_BACKLIGHT_PIN 17 // LCD backlight LED
139 #endif
140 
141 #if NONE(SPINDLE_FEATURE, LASER_FEATURE) && ENABLED(SANGUINOLOLU_V_1_2) && !BOTH(ULTRA_LCD, NEWPANEL) // try to use IO Header
142  #define CASE_LIGHT_PIN 4 // Hardware PWM - see if IO Header is available
143 #endif
144 
145 /**
146  * Sanguinololu 1.4 AUX pins:
147  *
148  * PWM TX1 RX1 SDA SCL
149  * 12V 5V D12 D11 D10 D17 D16
150  * GND GND D31 D30 D29 D28 D27
151  * A4 A3 A2 A1 A0
152  */
153 
154 //
155 // LCD / Controller
156 //
157 #if HAS_SPI_LCD
158 
159  #if HAS_GRAPHICAL_LCD
160 
161  #if ENABLED(U8GLIB_ST7920) // SPI GLCD 12864 ST7920 ( like [www.digole.com] ) For Melzi V2.0
162 
163  #if IS_MELZI
164  #define LCD_PINS_RS 30 // CS chip select /SS chip slave select
165  #define LCD_PINS_ENABLE 29 // SID (MOSI)
166  #define LCD_PINS_D4 17 // SCK (CLK) clock
167  // Pin 27 is taken by LED_PIN, but Melzi LED does nothing with
168  // Marlin so this can be used for BEEPER_PIN. You can use this pin
169  // with M42 instead of BEEPER_PIN.
170  #define BEEPER_PIN 27
171  #else // Sanguinololu >=1.3
172  #define LCD_PINS_RS 4
173  #define LCD_PINS_ENABLE 17
174  #define LCD_PINS_D4 30
175  #define LCD_PINS_D5 29
176  #define LCD_PINS_D6 28
177  #define LCD_PINS_D7 27
178  #endif
179 
180  #else // DOGM SPI LCD Support
181 
182  #define DOGLCD_A0 30
183 
184  #if ENABLED(MAKRPANEL)
185 
186  #define BEEPER_PIN 29
187  #define DOGLCD_CS 17
188  #define LCD_BACKLIGHT_PIN 28 // PA3
189 
190  #elif IS_MELZI
191 
192  #define BEEPER_PIN 27
193  #define DOGLCD_CS 28
194 
195  #else // !MAKRPANEL
196 
197  #define DOGLCD_CS 29
198 
199  #endif
200 
201  #endif
202 
203  // Uncomment screen orientation
204  #define LCD_SCREEN_ROT_0
205  //#define LCD_SCREEN_ROT_90
206  //#define LCD_SCREEN_ROT_180
207  //#define LCD_SCREEN_ROT_270
208 
209  #else // !HAS_GRAPHICAL_LCD
210 
211  #define LCD_PINS_RS 4
212  #define LCD_PINS_ENABLE 17
213  #define LCD_PINS_D4 30
214  #define LCD_PINS_D5 29
215  #define LCD_PINS_D6 28
216  #define LCD_PINS_D7 27
217 
218  #endif // !HAS_GRAPHICAL_LCD
219 
220  #if ENABLED(LCD_I2C_PANELOLU2)
221 
222  #if IS_MELZI
223  #define BTN_ENC 29
224  #define LCD_SDSS 30 // Panelolu2 SD card reader rather than the Melzi
225  #else
226  #define BTN_ENC 30
227  #endif
228 
229  #elif ENABLED(LCD_FOR_MELZI)
230 
231  #define LCD_PINS_RS 17
232  #define LCD_PINS_ENABLE 16
233  #define LCD_PINS_D4 11
234  #define BTN_ENC 28
235  #define BTN_EN1 29
236  #define BTN_EN2 30
237 
238  #ifndef ST7920_DELAY_1
239  #define ST7920_DELAY_1 DELAY_NS(0)
240  #endif
241  #ifndef ST7920_DELAY_2
242  #define ST7920_DELAY_2 DELAY_NS(188)
243  #endif
244  #ifndef ST7920_DELAY_3
245  #define ST7920_DELAY_3 DELAY_NS(0)
246  #endif
247 
248  #elif ENABLED(ZONESTAR_LCD) // For the Tronxy Melzi boards
249 
250  #define LCD_PINS_RS 28
251  #define LCD_PINS_ENABLE 29
252  #define LCD_PINS_D4 10
253  #define LCD_PINS_D5 11
254  #define LCD_PINS_D6 16
255  #define LCD_PINS_D7 17
256  #define ADC_KEYPAD_PIN 1
257 
258  #define BTN_EN1 -1
259  #define BTN_EN2 -1
260 
261  #else // !LCD_I2C_PANELOLU2 && !LCD_FOR_MELZI && !ZONESTAR_LCD
262 
263  #define BTN_ENC 16
264  #define LCD_SDSS 28 // Smart Controller SD card reader rather than the Melzi
265 
266  #endif
267 
268  #if ENABLED(NEWPANEL) && !defined(BTN_EN1)
269  #define BTN_EN1 11
270  #define BTN_EN2 10
271  #endif
272 
273  #define SD_DETECT_PIN -1
274 
275 #endif // HAS_SPI_LCD
276 
277 //
278 // M3/M4/M5 - Spindle/Laser Control
279 //
280 #if HAS_CUTTER
281  #if !MB(AZTEEG_X1) && ENABLED(SANGUINOLOLU_V_1_2) && !BOTH(ULTRA_LCD, NEWPANEL) // try to use IO Header
282 
283  #define SPINDLE_LASER_ENA_PIN 10 // Pullup or pulldown!
284  #define SPINDLE_LASER_PWM_PIN 4 // Hardware PWM
285  #define SPINDLE_DIR_PIN 11
286 
287  #elif !MB(MELZI) // use X stepper motor socket
288 
289  /**
290  * To control the spindle speed and have an LCD you must sacrifice
291  * the Extruder and pull some signals off the X stepper driver socket.
292  *
293  * The following assumes:
294  * - The X stepper driver socket is empty
295  * - The extruder driver socket has a driver board plugged into it
296  * - The X stepper wires are attached the the extruder connector
297  */
298 
299  /**
300  * Where to get the spindle signals
301  *
302  * spindle signal socket name socket name
303  * -------
304  * /ENABLE O| |O VMOT
305  * MS1 O| |O GND
306  * MS2 O| |O 2B
307  * MS3 O| |O 2A
308  * /RESET O| |O 1A
309  * /SLEEP O| |O 1B
310  * SPINDLE_LASER_PWM_PIN STEP O| |O VDD
311  * SPINDLE_LASER_ENA_PIN DIR O| |O GND
312  * -------
313  *
314  * Note: Socket names vary from vendor to vendor.
315  */
316  #undef X_DIR_PIN
317  #undef X_ENABLE_PIN
318  #undef X_STEP_PIN
319  #define X_DIR_PIN 0
320  #define X_ENABLE_PIN 14
321  #define X_STEP_PIN 1
322  #define SPINDLE_LASER_PWM_PIN 15 // Hardware PWM
323  #define SPINDLE_LASER_ENA_PIN 21 // Pullup!
324  #define SPINDLE_DIR_PIN -1 // No pin available on the socket for the direction pin
325  #endif
326 #endif