1 |
ron |
1 |
/**
|
|
|
2 |
* Marlin 3D Printer Firmware
|
|
|
3 |
* Copyright (C) 2016 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 |
|
|
|
23 |
/**
|
|
|
24 |
* Mightyboard Rev.E pin assignments
|
|
|
25 |
*/
|
|
|
26 |
|
|
|
27 |
/**
|
|
|
28 |
*
|
|
|
29 |
* This is a starting-point to support the Makerbot Replicator series of 3D printers.
|
|
|
30 |
* It's not functional because Marlin has limited support for some features.
|
|
|
31 |
* Marlin will need the following augmentations before it will be supportable:
|
|
|
32 |
*
|
|
|
33 |
* - Support for two or more MAX6675 thermocouples
|
|
|
34 |
* - Support for multiple i2c buses to control the MCP4018 digital pots
|
|
|
35 |
* - Support for one additional unidirectional SPI bus, to read the thermocouples
|
|
|
36 |
* - Support for an RGB LED that may work differently from BLINKM
|
|
|
37 |
*
|
|
|
38 |
* The MCP4018 requires separate I2C buses because it has a fixed address (0x2F << 1 = 0x5E)
|
|
|
39 |
* The thermocouples share the same SCK and DO pins, with their own CS pins.
|
|
|
40 |
* The controller interface port connects to a 3-wire shift-register display controller
|
|
|
41 |
*
|
|
|
42 |
*/
|
|
|
43 |
|
|
|
44 |
/**
|
|
|
45 |
* Rev B 2 JAN 2017
|
|
|
46 |
*
|
|
|
47 |
* Added pin definitions for:
|
|
|
48 |
* M3, M4 & M5 spindle control commands
|
|
|
49 |
* case light
|
|
|
50 |
*
|
|
|
51 |
* Corrected pin assignment for MOSFET_B_PIN pin. Changed it from 9 to 11. The port
|
|
|
52 |
* number (B5) agrees with the schematic but B5 is assigned to logical pin 11.
|
|
|
53 |
*/
|
|
|
54 |
|
|
|
55 |
#if !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega2560__)
|
|
|
56 |
#error "Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu."
|
|
|
57 |
#endif
|
|
|
58 |
|
|
|
59 |
#define DEFAULT_MACHINE_NAME "MB Replicator"
|
|
|
60 |
#define BOARD_NAME "Mightyboard"
|
|
|
61 |
|
|
|
62 |
//
|
|
|
63 |
// Servos
|
|
|
64 |
//
|
|
|
65 |
#define SERVO0_PIN 36 // C1 (1280-EX1)
|
|
|
66 |
#define SERVO1_PIN 37 // C0 (1280-EX2)
|
|
|
67 |
#define SERVO2_PIN 40 // G1 (1280-EX3)
|
|
|
68 |
#define SERVO3_PIN 41 // G0 (1280-EX4)
|
|
|
69 |
|
|
|
70 |
//
|
|
|
71 |
// Limit Switches
|
|
|
72 |
//
|
|
|
73 |
#define X_MIN_PIN 49 // L0
|
|
|
74 |
#define X_MAX_PIN 48 // L1
|
|
|
75 |
#define Y_MIN_PIN 47 // L2
|
|
|
76 |
#define Y_MAX_PIN 46 // L3
|
|
|
77 |
#define Z_MIN_PIN 43 // L6
|
|
|
78 |
#define Z_MAX_PIN 42 // L7
|
|
|
79 |
|
|
|
80 |
//
|
|
|
81 |
// Z Probe (when not Z_MIN_PIN)
|
|
|
82 |
//
|
|
|
83 |
#ifndef Z_MIN_PROBE_PIN
|
|
|
84 |
#define Z_MIN_PROBE_PIN 42
|
|
|
85 |
#endif
|
|
|
86 |
|
|
|
87 |
//
|
|
|
88 |
// Steppers
|
|
|
89 |
//
|
|
|
90 |
#define X_STEP_PIN 55 // F1
|
|
|
91 |
#define X_DIR_PIN 54 // F0
|
|
|
92 |
#define X_ENABLE_PIN 56 // F2
|
|
|
93 |
|
|
|
94 |
#define Y_STEP_PIN 59 // F5
|
|
|
95 |
#define Y_DIR_PIN 58 // F4
|
|
|
96 |
#define Y_ENABLE_PIN 60 // F6
|
|
|
97 |
|
|
|
98 |
#define Z_STEP_PIN 63 // K1
|
|
|
99 |
#define Z_DIR_PIN 62 // K0
|
|
|
100 |
#define Z_ENABLE_PIN 64 // K2
|
|
|
101 |
|
|
|
102 |
#define E0_STEP_PIN 25 // A3
|
|
|
103 |
#define E0_DIR_PIN 24 // A2
|
|
|
104 |
#define E0_ENABLE_PIN 26 // A4
|
|
|
105 |
|
|
|
106 |
#define E1_STEP_PIN 29 // A7
|
|
|
107 |
#define E1_DIR_PIN 28 // A6
|
|
|
108 |
#define E1_ENABLE_PIN 39 // G2
|
|
|
109 |
|
|
|
110 |
//
|
|
|
111 |
// I2C Digipots - MCP4018
|
|
|
112 |
// Address 5E (2F << 1)
|
|
|
113 |
// Set from 0 - 127 with stop bit.
|
|
|
114 |
// (Ex. 3F << 1 | 1)
|
|
|
115 |
//
|
|
|
116 |
#define DIGIPOTS_I2C_SCL 76 // J5
|
|
|
117 |
#define DIGIPOTS_I2C_SDA_X 57 // F3
|
|
|
118 |
#define DIGIPOTS_I2C_SDA_Y 61 // F7
|
|
|
119 |
#define DIGIPOTS_I2C_SDA_Z 65 // K3
|
|
|
120 |
#define DIGIPOTS_I2C_SDA_E0 27 // A5
|
|
|
121 |
#define DIGIPOTS_I2C_SDA_E1 77 // J6
|
|
|
122 |
#define DIGIPOT_I2C_ADDRESS_A 0x2F // unshifted slave address (5E <- 2F << 1)
|
|
|
123 |
|
|
|
124 |
//
|
|
|
125 |
// Temperature Sensors
|
|
|
126 |
//
|
|
|
127 |
#define TEMP_BED_PIN 15 // K7 - 69 / ADC15 - 15
|
|
|
128 |
|
|
|
129 |
// SPI for Max6675 or Max31855 Thermocouple
|
|
|
130 |
// Uses a separate SPI bus
|
|
|
131 |
//
|
|
|
132 |
// 3 E5 DO (SO)
|
|
|
133 |
// 5 E3 CS1
|
|
|
134 |
// 2 E4 CS2
|
|
|
135 |
// 78 E2 SCK
|
|
|
136 |
//
|
|
|
137 |
#define THERMO_SCK_PIN 78 // E2
|
|
|
138 |
#define THERMO_DO_PIN 3 // E5
|
|
|
139 |
#define THERMO_CS1 5 // E3
|
|
|
140 |
#define THERMO_CS2 2 // E4
|
|
|
141 |
|
|
|
142 |
#define MAX6675_SS THERMO_CS1
|
|
|
143 |
#define MAX6675_SCK_PIN THERMO_SCK_PIN
|
|
|
144 |
#define MAX6675_DO_PIN THERMO_DO_PIN
|
|
|
145 |
//
|
|
|
146 |
// Augmentation for auto-assigning plugs
|
|
|
147 |
//
|
|
|
148 |
// Two thermocouple connectors allows for either
|
|
|
149 |
// 2 extruders or 1 extruder and a heated bed.
|
|
|
150 |
// With no heated bed, an additional 24V fan is possible.
|
|
|
151 |
//
|
|
|
152 |
#define MOSFET_A_PIN 6 // H3
|
|
|
153 |
#define MOSFET_B_PIN 11 // B5 - Rev A of this file had this pin assigned to 9
|
|
|
154 |
#define MOSFET_C_PIN 45 // L4
|
|
|
155 |
#define MOSFET_D_PIN 44 // L5
|
|
|
156 |
|
|
|
157 |
#if HOTENDS > 1
|
|
|
158 |
#if TEMP_SENSOR_BED
|
|
|
159 |
#define IS_EEB
|
|
|
160 |
#else
|
|
|
161 |
#define IS_EEF
|
|
|
162 |
#endif
|
|
|
163 |
#elif TEMP_SENSOR_BED
|
|
|
164 |
#define IS_EFB
|
|
|
165 |
#else
|
|
|
166 |
#define IS_EFF
|
|
|
167 |
#endif
|
|
|
168 |
|
|
|
169 |
//
|
|
|
170 |
// Heaters / Fans (24V)
|
|
|
171 |
//
|
|
|
172 |
#define HEATER_0_PIN MOSFET_A_PIN
|
|
|
173 |
|
|
|
174 |
#if ENABLED(IS_EFB) // Hotend, Fan, Bed
|
|
|
175 |
#define HEATER_BED_PIN MOSFET_C_PIN
|
|
|
176 |
#elif ENABLED(IS_EEF) // Hotend, Hotend, Fan
|
|
|
177 |
#define HEATER_1_PIN MOSFET_B_PIN
|
|
|
178 |
#elif ENABLED(IS_EEB) // Hotend, Hotend, Bed
|
|
|
179 |
#define HEATER_1_PIN MOSFET_B_PIN
|
|
|
180 |
#define HEATER_BED_PIN MOSFET_C_PIN
|
|
|
181 |
#elif ENABLED(IS_EFF) // Hotend, Fan, Fan
|
|
|
182 |
#define FAN1_PIN MOSFET_C_PIN
|
|
|
183 |
#endif
|
|
|
184 |
|
|
|
185 |
#ifndef FAN_PIN
|
|
|
186 |
#if ENABLED(IS_EFB) || ENABLED(IS_EFF) // Hotend, Fan, Bed or Hotend, Fan, Fan
|
|
|
187 |
#define FAN_PIN MOSFET_B_PIN
|
|
|
188 |
#elif ENABLED(IS_EEF) || ENABLED(IS_SF) // Hotend, Hotend, Fan or Spindle, Fan
|
|
|
189 |
#define FAN_PIN MOSFET_C_PIN
|
|
|
190 |
#else
|
|
|
191 |
#define FAN_PIN MOSFET_D_PIN
|
|
|
192 |
#endif
|
|
|
193 |
#endif
|
|
|
194 |
|
|
|
195 |
//
|
|
|
196 |
// Extruder Auto Fan Pins
|
|
|
197 |
//
|
|
|
198 |
#define ORIG_E0_AUTO_FAN_PIN 7 // H4
|
|
|
199 |
#define ORIG_E1_AUTO_FAN_PIN 12 // B6
|
|
|
200 |
|
|
|
201 |
//
|
|
|
202 |
// Misc. Functions
|
|
|
203 |
//
|
|
|
204 |
#define LED_PIN 13 // B7
|
|
|
205 |
#define CUTOFF_RESET_PIN 16 // H1
|
|
|
206 |
#define CUTOFF_TEST_PIN 17 // H0
|
|
|
207 |
#define CASE_LIGHT_PIN 44 // L5 MUST BE HARDWARE PWM
|
|
|
208 |
|
|
|
209 |
//
|
|
|
210 |
// LCD / Controller
|
|
|
211 |
//
|
|
|
212 |
#ifdef REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
|
|
|
213 |
|
|
|
214 |
#define LCD_PINS_RS 33 // C4: LCD-STROBE
|
|
|
215 |
#define LCD_PINS_ENABLE 72 // J2: LEFT
|
|
|
216 |
#define LCD_PINS_D4 35 // C2: LCD-CLK
|
|
|
217 |
#define LCD_PINS_D5 32 // C5: RLED
|
|
|
218 |
#define LCD_PINS_D6 34 // C3: LCD-DATA
|
|
|
219 |
#define LCD_PINS_D7 31 // C6: GLED
|
|
|
220 |
|
|
|
221 |
#define BTN_EN2 75 // J4, UP
|
|
|
222 |
#define BTN_EN1 73 // J3, DOWN
|
|
|
223 |
//STOP button connected as KILL_PIN
|
|
|
224 |
#define KILL_PIN 14 // J1, RIGHT
|
|
|
225 |
//KILL - not connected
|
|
|
226 |
|
|
|
227 |
#define BEEPER_PIN 8 // H5, SD_WP
|
|
|
228 |
|
|
|
229 |
#define BTN_CENTER 15 // J0
|
|
|
230 |
#define BTN_ENC BTN_CENTER
|
|
|
231 |
|
|
|
232 |
//on board leds
|
|
|
233 |
#define STAT_LED_RED_LED SERVO0_PIN // C1 (1280-EX1, DEBUG2)
|
|
|
234 |
#define STAT_LED_BLUE_PIN SERVO1_PIN // C0 (1280-EX2, DEBUG3)
|
|
|
235 |
|
|
|
236 |
#else
|
|
|
237 |
// Replicator uses a 3-wire SR controller with HD44780
|
|
|
238 |
// For now, pretend it's the SAV
|
|
|
239 |
//
|
|
|
240 |
|
|
|
241 |
#define SAV_3DLCD
|
|
|
242 |
#define SR_DATA_PIN 34 // C3
|
|
|
243 |
#define SR_CLK_PIN 35 // C2
|
|
|
244 |
#define SR_STROBE_PIN 33 // C4
|
|
|
245 |
|
|
|
246 |
#define BTN_UP 75 // J4
|
|
|
247 |
#define BTN_DOWN 73 // J3
|
|
|
248 |
#define BTN_LEFT 72 // J2
|
|
|
249 |
#define BTN_RIGHT 14 // J1
|
|
|
250 |
#define BTN_CENTER 15 // J0
|
|
|
251 |
#define BTN_ENC BTN_CENTER
|
|
|
252 |
|
|
|
253 |
#define BEEPER_PIN 4 // G5
|
|
|
254 |
|
|
|
255 |
#define STAT_LED_RED_PIN 32 // C5
|
|
|
256 |
#define STAT_LED_BLUE_PIN 31 // C6 (Actually green)
|
|
|
257 |
|
|
|
258 |
#endif
|
|
|
259 |
|
|
|
260 |
//
|
|
|
261 |
// SD Card
|
|
|
262 |
//
|
|
|
263 |
#define SDSS 53 // B0
|
|
|
264 |
#define SD_DETECT_PIN 9 // H6
|
|
|
265 |
|
|
|
266 |
#define MAX_PIN THERMO_SCK_PIN
|
|
|
267 |
|
|
|
268 |
//
|
|
|
269 |
// M3/M4/M5 - Spindle/Laser Control
|
|
|
270 |
//
|
|
|
271 |
#define SPINDLE_LASER_ENABLE_PIN 66 // K4 Pin should have a pullup!
|
|
|
272 |
#define SPINDLE_LASER_PWM_PIN 8 // H5 MUST BE HARDWARE PWM
|
|
|
273 |
#define SPINDLE_DIR_PIN 67 // K5
|
|
|
274 |
|
|
|
275 |
|
|
|
276 |
// Check if all pins are defined in mega/pins_arduino.h
|
|
|
277 |
#include <Arduino.h>
|
|
|
278 |
static_assert(NUM_DIGITAL_PINS > MAX_PIN, "add missing pins to [arduino dir]/hardware/arduino/avr/variants/mega/pins_arduino.h based on fastio.h"
|
|
|
279 |
"to digital_pin_to_port_PGM, digital_pin_to_bit_mask_PGM, digital_pin_to_timer_PGM, NUM_DIGITAL_PINS, see below");
|
|
|
280 |
|
|
|
281 |
/* in [arduino dir]/hardware/arduino/avr/variants/mega/pins_arduino.h
|
|
|
282 |
change:
|
|
|
283 |
#define NUM_DIGITAL_PINS 70
|
|
|
284 |
to:
|
|
|
285 |
#define NUM_DIGITAL_PINS 80
|
|
|
286 |
|
|
|
287 |
to digital_pin_to_port_PGM add at the end:
|
|
|
288 |
const uint8_t PROGMEM digital_pin_to_port_PGM[] = {
|
|
|
289 |
....
|
|
|
290 |
PG , // PG 4 ** 70 **
|
|
|
291 |
PG , // PG 3 ** 71 **
|
|
|
292 |
PJ , // PJ 2 ** 72 **
|
|
|
293 |
PJ , // PJ 3 ** 73 **
|
|
|
294 |
PJ , // PJ 7 ** 74 **
|
|
|
295 |
PJ , // PJ 4 ** 75 **
|
|
|
296 |
PJ , // PJ 5 ** 76 **
|
|
|
297 |
PJ , // PJ 6 ** 77 **
|
|
|
298 |
PE , // PE 2 ** 78 **
|
|
|
299 |
PE , // PE 6 ** 79 **
|
|
|
300 |
};
|
|
|
301 |
|
|
|
302 |
to digital_pin_to_bit_mask_PGM add at the end:
|
|
|
303 |
const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = {
|
|
|
304 |
....
|
|
|
305 |
_BV( 4 ) , // PG 4 ** 70 **
|
|
|
306 |
_BV( 3 ) , // PG 3 ** 71 **
|
|
|
307 |
_BV( 2 ) , // PJ 2 ** 72 **
|
|
|
308 |
_BV( 3 ) , // PJ 3 ** 73 **
|
|
|
309 |
_BV( 7 ) , // PJ 7 ** 74 **
|
|
|
310 |
_BV( 4 ) , // PJ 4 ** 75 **
|
|
|
311 |
_BV( 5 ) , // PJ 5 ** 76 **
|
|
|
312 |
_BV( 6 ) , // PJ 6 ** 77 **
|
|
|
313 |
_BV( 2 ) , // PE 2 ** 78 **
|
|
|
314 |
_BV( 6 ) , // PE 6 ** 79 **
|
|
|
315 |
};
|
|
|
316 |
|
|
|
317 |
to digital_pin_to_timer_PGM add at the end:
|
|
|
318 |
const uint8_t PROGMEM digital_pin_to_timer_PGM[] = {
|
|
|
319 |
....
|
|
|
320 |
NOT_ON_TIMER , // PG 4 ** 70 **
|
|
|
321 |
NOT_ON_TIMER , // PG 3 ** 71 **
|
|
|
322 |
NOT_ON_TIMER , // PJ 2 ** 72 **
|
|
|
323 |
NOT_ON_TIMER , // PJ 3 ** 73 **
|
|
|
324 |
NOT_ON_TIMER , // PJ 7 ** 74 **
|
|
|
325 |
NOT_ON_TIMER , // PJ 4 ** 75 **
|
|
|
326 |
NOT_ON_TIMER , // PJ 5 ** 76 **
|
|
|
327 |
NOT_ON_TIMER , // PJ 6 ** 77 **
|
|
|
328 |
NOT_ON_TIMER , // PE 2 ** 78 **
|
|
|
329 |
NOT_ON_TIMER , // PE 6 ** 79 **
|
|
|
330 |
};
|
|
|
331 |
*/
|