Prusa MINI Firmware overview
pins_BIGTREE_SKR_V1.1.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 #ifndef TARGET_LPC1768
25  #error "Oops! Make sure you have the LPC1768 environment selected in your IDE."
26 #endif
27 
28 #define BOARD_INFO_NAME "BIGTREE SKR 1.1"
29 
30 //
31 // Limit Switches
32 //
33 #define X_MIN_PIN P1_29
34 #define X_MAX_PIN P1_28
35 #define Y_MIN_PIN P1_27
36 #define Y_MAX_PIN P1_26
37 #define Z_MIN_PIN P1_25
38 #define Z_MAX_PIN P1_24
39 
40 //
41 // Steppers
42 //
43 #define X_STEP_PIN P0_04
44 #define X_DIR_PIN P0_05
45 #define X_ENABLE_PIN P4_28
46 
47 #define Y_STEP_PIN P2_01
48 #define Y_DIR_PIN P2_02
49 #define Y_ENABLE_PIN P2_00
50 
51 #define Z_STEP_PIN P0_20
52 #define Z_DIR_PIN P0_21
53 #define Z_ENABLE_PIN P0_19
54 
55 #define E0_STEP_PIN P0_11
56 #define E0_DIR_PIN P2_13
57 #define E0_ENABLE_PIN P2_12
58 
59 #define E1_STEP_PIN P0_01
60 #define E1_DIR_PIN P0_00
61 #define E1_ENABLE_PIN P0_10
62 
63 //
64 // Temperature Sensors
65 // 3.3V max when defined as an analog input
66 //
67 #define TEMP_BED_PIN 0 // Analog Input
68 #define TEMP_0_PIN 1 // Analog Input
69 #define TEMP_1_PIN 2 // Analog Input
70 
71 //
72 // Heaters / Fans
73 //
74 #define HEATER_0_PIN P2_07
75 #if HOTENDS == 1
76  #define FAN1_PIN P2_04
77 #else
78  #define HEATER_1_PIN P2_04
79 #endif
80 #define FAN_PIN P2_03
81 #define HEATER_BED_PIN P2_05
82 
83 /**
84  * LCD / Controller
85  *
86  * As of 20 JAN 2019 only the REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER display has
87  * been tested with these settings. It can be connected to the SKR using standard cables
88  * via the EXP1 and EXP2 ports. Other displays may need a custom cable and/or changes to
89  * the pins defined below.
90  *
91  * The SD card on the LCD controller uses the same SPI signals as the LCD, resulting in
92  * garbage/lines on the LCD display during SD card access. The LCD code mitigates this
93  * by redrawing the screen after SD card accesses.
94  */
95 
96 #if HAS_SPI_LCD
97  #define BEEPER_PIN P1_30
98  #define BTN_EN1 P3_26
99  #define BTN_EN2 P3_25
100  #define BTN_ENC P2_11
101 
102  #define SD_DETECT_PIN P1_31
103  #define LCD_SDSS P1_23
104  #define LCD_PINS_RS P0_16
105  #define LCD_PINS_ENABLE P0_18
106  #define LCD_PINS_D4 P0_15
107 
108  #if ENABLED(MKS_MINI_12864)
109  #define DOGLCD_CS P2_06
110  #define DOGLCD_A0 P0_16
111  #endif
112 #endif
113 
114 //
115 // SD Support
116 //
117 // MKS_MINI_12864 strongly prefers the SD card on the display and
118 // requires jumpers on the SKR V1.1 board as documented here:
119 // https://www.facebook.com/groups/505736576548648/permalink/630639874058317/
120 #ifndef SDCARD_CONNECTION
121  #if ENABLED(MKS_MINI_12864)
122  #define SDCARD_CONNECTION LCD
123  #else
124  #define SDCARD_CONNECTION ONBOARD
125  #endif
126 #endif
127 
128 #define ONBOARD_SD_CS_PIN P0_06 // Chip select for "System" SD card
129 
130 #if SD_CONNECTION_IS(LCD)
131  #define SCK_PIN P0_15
132  #define MISO_PIN P0_17
133  #define MOSI_PIN P0_18
134  #define SS_PIN P1_23
135 #elif SD_CONNECTION_IS(ONBOARD)
136  #undef SD_DETECT_PIN
137  #define SD_DETECT_PIN P0_27
138  #define SCK_PIN P0_07
139  #define MISO_PIN P0_08
140  #define MOSI_PIN P0_09
141  #define SS_PIN ONBOARD_SD_CS_PIN
142 #elif SD_CONNECTION_IS(CUSTOM_CABLE)
143  #error "No custom SD drive cable defined for this board."
144 #endif
145 
146 // Trinamic driver support
147 
148 #if HAS_TRINAMIC
149  // Using TMC devices in intelligent mode requires extra connections to each device. Unfortunately
150  // the SKR does not have many free pins (especially if a display is in use). The SPI-based devices
151  // will require 3 connections (clock, mosi, miso), plus a chip select line (CS) for each driver.
152  // The UART-based devices require 2 pis per deriver (one of which must be interrupt capable).
153  // The same SPI pins can be shared with the display/SD card reader, meaning SPI-based devices are
154  // probably a good choice for this board.
155  //
156  // SOFTWARE_DRIVER_ENABLE is a good option. It uses SPI to control the driver enable and allows the
157  // hardware ENABLE pins for each driver to be repurposed as SPI chip select. To use this mode the
158  // driver modules will probably need to be modified, removing the pin used for the enable line from
159  // the module and wiring this connection directly to GND (as is the case for TMC2130).
160  // Using this option and sharing all of the SPI pins allows 5 TMC2130 drivers to be used along with
161  // a REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER without requiring the use of any extra pins.
162  //
163  // Other options will probably require the use of any free pins and the TFT serial port or a
164  // different type of display (like the TFT), using the pins normally used for the display and encoder.
165  // Unfortunately, tests show it's not possible to use endstop and thermistor pins for chip-select.
166  // Sample settings are provided below, but only some have been tested.
167  //
168  // Another option is to share the enable and chip-select pins when using SPI. Several users have
169  // reported that this works. However, it's unlikely that this configuration will allow SPI communi-
170  // cation with the device when the drivers are active, meaning that some of the more advanced TMC
171  // options may not be available.
172 
173  // When using any TMC SPI-based drivers, software SPI is used
174  // because pins may be shared with the display or SD card.
175  #define TMC_USE_SW_SPI
176  #define TMC_SW_MOSI P0_18
177  #define TMC_SW_MISO P0_17
178  // To minimize pin usage use the same clock pin as the display/SD card reader. (May generate LCD noise.)
179  #define TMC_SW_SCK P0_15
180  // If pin 2_06 is unused, it can be used for the clock to avoid the LCD noise.
181  //#define TMC_SW_SCK P2_06
182 
183  #if ENABLED(SOFTWARE_DRIVER_ENABLE)
184 
185  // Software enable allows the enable pins to be repurposed as chip-select pins.
186  // Note: Requires the driver modules to be modified to always be enabled with the enable pin removed.
187  #if AXIS_DRIVER_TYPE_X(TMC2130)
188  #define X_CS_PIN P4_28
189  #undef X_ENABLE_PIN
190  #define X_ENABLE_PIN -1
191  #endif
192 
193  #if AXIS_DRIVER_TYPE_Y(TMC2130)
194  #define Y_CS_PIN P2_00
195  #undef Y_ENABLE_PIN
196  #define Y_ENABLE_PIN -1
197  #endif
198 
199  #if AXIS_DRIVER_TYPE_Z(TMC2130)
200  #define Z_CS_PIN P0_19
201  #undef Z_ENABLE_PIN
202  #define Z_ENABLE_PIN -1
203  #endif
204 
205  #if AXIS_DRIVER_TYPE_E0(TMC2130)
206  #define E0_CS_PIN P2_12
207  #undef E0_ENABLE_PIN
208  #define E0_ENABLE_PIN -1
209  #endif
210 
211 
212  #if AXIS_DRIVER_TYPE_E1(TMC2130)
213  #define E1_CS_PIN P0_10
214  #undef E1_ENABLE_PIN
215  #define E1_ENABLE_PIN -1
216  #endif
217 
218  #else // !SOFTWARE_DRIVER_ENABLE
219 
220  // A chip-select pin is needed for each driver.
221 
222  // EXAMPLES
223 
224  // Example 1: No LCD attached or a TFT style display using the AUX header RX/TX pins.
225  // SDCARD_CONNECTION must not be 'LCD'. Nothing should be connected to EXP1/EXP2.
226  //#define SKR_USE_LCD_PINS_FOR_CS
227  #if ENABLED(SKR_USE_LCD_PINS_FOR_CS)
228  #if SD_CONNECTION_IS(LCD)
229  #error "SDCARD_CONNECTION must not be 'LCD' with SKR_USE_LCD_PINS_FOR_CS."
230  #endif
231  #define X_CS_PIN P1_23
232  #define Y_CS_PIN P3_26
233  #define Z_CS_PIN P2_11
234  #define E0_CS_PIN P3_25
235  #define E1_CS_PIN P1_31
236  #endif
237 
238  // Example 2: A REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
239  // The SD card reader attached to the LCD (if present) can't be used because
240  // the pins will be in use. So SDCARD_CONNECTION must not be 'LCD'.
241  //#define SKR_USE_LCD_SD_CARD_PINS_FOR_CS
242  #if ENABLED(SKR_USE_LCD_SD_CARD_PINS_FOR_CS)
243  #if SD_CONNECTION_IS(LCD)
244  #error "SDCARD_CONNECTION must not be 'LCD' with SKR_USE_LCD_SD_CARD_PINS_FOR_CS."
245  #endif
246  #define X_CS_PIN P0_02
247  #define Y_CS_PIN P0_03
248  #define Z_CS_PIN P2_06
249  // We use SD_DETECT_PIN for E0
250  #undef SD_DETECT_PIN
251  #define E0_CS_PIN P1_31
252  // We use LCD_SDSS pin for E1
253  #undef LCD_SDSS
254  #define LCD_SDSS -1
255  #define E1_CS_PIN P1_23
256  #endif
257 
258  // Example 3: Use the driver enable pins for chip-select.
259  // Commands must not be sent to the drivers when enabled. So certain
260  // advanced features (like driver monitoring) will not be available.
261  //#define SKR_USE_ENABLE_CS
262  #if ENABLED(SKR_USE_ENABLE_FOR_CS)
263  #define X_CS_PIN X_ENABLE_PIN
264  #define Y_CS_PIN Y_ENABLE_PIN
265  #define Z_CS_PIN Z_ENABLE_PIN
266  #define E0_CS_PIN E0_ENABLE_PIN
267  #define E1_CS_PIN E1_ENABLE_PIN
268  #endif
269 
270  #endif // SOFTWARE_DRIVER_ENABLE
271 
272 #endif