Skip to content

Commit 858df74

Browse files
ellenspthinkyhead
authored andcommitted
BTT driver expansion for SKR 1.3/1.4 (MarlinFirmware#20088)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
1 parent 5ff7ff7 commit 858df74

File tree

7 files changed

+157
-80
lines changed

7 files changed

+157
-80
lines changed

Marlin/src/lcd/tft/ui_320x240.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ void menu_item(const uint8_t row, bool sel ) {
649649
menu_line(row, sel ? COLOR_SELECTION_BG : COLOR_BACKGROUND);
650650
#if ENABLED(TOUCH_SCREEN)
651651
const TouchControlType tct = TERN(SINGLE_TOUCH_NAVIGATION, true, sel) ? CLICK : MENU_ITEM;
652-
touch.add_control(tct, 0, 2 + 34 * row, 320, 32, encoderTopLine + row);
652+
touch.add_control(tct, 0, 2 + 34 * row, TFT_WIDTH, 32, encoderTopLine + row);
653653
#endif
654654
}
655655

Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h

Lines changed: 99 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -208,31 +208,57 @@
208208
#define E1_SERIAL_TX_PIN P1_01
209209
#define E1_SERIAL_RX_PIN P1_01
210210

211-
#define Z2_SERIAL_TX_PIN P1_01
212-
#define Z2_SERIAL_RX_PIN P1_01
213-
214211
// Reduce baud rate to improve software serial reliability
215212
#define TMC_BAUD_RATE 19200
216213
#endif
217214

215+
/* _____ _____
216+
* NC | 1 2 | GND 5V | 1 2 | GND
217+
* RESET | 3 4 | 1.31 1.23 | 3 4 | 1.22
218+
* 0.18 | 5 6 3.25 1.21 | 5 6 1.20
219+
* 0.16 | 7 8 | 3.26 1.19 | 7 8 | 1.18
220+
* 0.15 | 9 10| 0.17 0.28 | 9 10| 1.30
221+
* ----- -----
222+
* EXP2 EXP1
223+
*/
224+
225+
#define EXPA1_03_PIN P1_23
226+
#define EXPA1_04_PIN P1_22
227+
#define EXPA1_05_PIN P1_21
228+
#define EXPA1_06_PIN P1_20
229+
#define EXPA1_07_PIN P1_19
230+
#define EXPA1_08_PIN P1_18
231+
#define EXPA1_09_PIN P0_28
232+
#define EXPA1_10_PIN P1_30
233+
234+
#define EXPA2_03_PIN -1
235+
#define EXPA2_04_PIN P1_31
236+
#define EXPA2_05_PIN P0_18
237+
#define EXPA2_06_PIN P3_25
238+
#define EXPA2_07_PIN P0_16
239+
#define EXPA2_08_PIN P3_26
240+
#define EXPA2_09_PIN P0_15
241+
#define EXPA2_10_PIN P0_17
242+
218243
//
219244
// SD Connection
220245
//
221246
#if SD_CONNECTION_IS(LCD)
222-
#define SS_PIN P0_16
247+
#define SS_PIN EXPA2_07_PIN
223248
#endif
224249

225250
/**
226251
* _____ _____
227252
* NC | · · | GND 5V | · · | GND
228253
* RESET | · · | 1.31 (SD_DETECT) (LCD_D7) 1.23 | · · | 1.22 (LCD_D6)
229-
* (MOSI) 0.18 | · · | 3.25 (BTN_EN2) (LCD_D5) 1.21 | · · | 1.20 (LCD_D4)
254+
* (MOSI) 0.18 | · · 3.25 (BTN_EN2) (LCD_D5) 1.21 | · · 1.20 (LCD_D4)
230255
* (SD_SS) 0.16 | · · | 3.26 (BTN_EN1) (LCD_RS) 1.19 | · · | 1.18 (LCD_EN)
231256
* (SCK) 0.15 | · · | 0.17 (MISO) (BTN_ENC) 0.28 | · · | 1.30 (BEEPER)
232257
* ----- -----
233258
* EXP2 EXP1
234259
*/
235-
#if HAS_WIRED_LCD
260+
261+
#if HAS_WIRED_LCD && !HAS_BTT_EXP_MOT
236262
#if ENABLED(ANET_FULL_GRAPHICS_LCD_ALT_WIRING)
237263
#error "ANET_FULL_GRAPHICS_LCD_ALT_WIRING only applies to the ANET 1.0 board."
238264

@@ -249,79 +275,79 @@
249275
*
250276
* The ANET_FULL_GRAPHICS_LCD connector plug:
251277
*
252-
* BEFORE AFTER
253-
* _____ _____
254-
* GND 1 | 1 2 | 2 5V 5V 1 | 1 2 | 2 GND
255-
* CS 3 | 3 4 | 4 BTN_EN2 CS 3 | 3 4 | 4 BTN_EN2
256-
* SID 5 | 5 6 6 BTN_EN1 SID 5 | 5 6 6 BTN_EN1
257-
* open 7 | 7 8 | 8 BTN_ENC CLK 7 | 7 8 | 8 BTN_ENC
258-
* CLK 9 | 9 10| 10 Beeper open 9 | 9 10| 10 Beeper
259-
* ----- -----
260-
* LCD LCD
278+
* BEFORE AFTER
279+
* _____ _____
280+
* GND | 1 2 | 5V 5V | 1 2 | GND
281+
* CS | 3 4 | BTN_EN2 CS | 3 4 | BTN_EN2
282+
* SID | 5 6 BTN_EN1 SID | 5 6 BTN_EN1
283+
* open | 7 8 | BTN_ENC CLK | 7 8 | BTN_ENC
284+
* CLK | 9 10| Beeper open | 9 10| Beeper
285+
* ----- -----
286+
* LCD LCD
261287
*/
262288

263-
#define LCD_PINS_RS P1_23
289+
#define LCD_PINS_RS EXPA1_03_PIN
264290

265-
#define BTN_EN1 P1_20
266-
#define BTN_EN2 P1_22
267-
#define BTN_ENC P1_18
291+
#define BTN_EN1 EXPA1_06_PIN
292+
#define BTN_EN2 EXPA1_04_PIN
293+
#define BTN_ENC EXPA1_08_PIN
268294

269-
#define LCD_PINS_ENABLE P1_21
270-
#define LCD_PINS_D4 P1_19
295+
#define LCD_PINS_ENABLE EXPA1_05_PIN
296+
#define LCD_PINS_D4 EXPA1_07_PIN
271297

272298
#elif ENABLED(CR10_STOCKDISPLAY)
273-
#define BTN_ENC P0_28 // (58) open-drain
274-
#define LCD_PINS_RS P1_22
299+
#define BTN_ENC EXPA1_09_PIN // (58) open-drain
300+
#define LCD_PINS_RS EXPA1_04_PIN
275301

276-
#define BTN_EN1 P1_18
277-
#define BTN_EN2 P1_20
302+
#define BTN_EN1 EXPA1_08_PIN
303+
#define BTN_EN2 EXPA1_06_PIN
278304

279-
#define LCD_PINS_ENABLE P1_23
280-
#define LCD_PINS_D4 P1_21
305+
#define LCD_PINS_ENABLE EXPA1_03_PIN
306+
#define LCD_PINS_D4 EXPA1_05_PIN
281307

282308
#elif ENABLED(ENDER2_STOCKDISPLAY)
283309

284310
/** Creality Ender-2 display pinout
285311
* _____
286312
* 5V | 1 2 | GND
287313
* (MOSI) 1.23 | 3 4 | 1.22 (LCD_RS)
288-
* (LCD_A0) 1.21 | 5 6 | 1.20 (BTN_EN2)
314+
* (LCD_A0) 1.21 | 5 6 1.20 (BTN_EN2)
289315
* RESET 1.19 | 7 8 | 1.18 (BTN_EN1)
290316
* (BTN_ENC) 0.28 | 9 10| 1.30 (SCK)
291317
* -----
292318
* EXP1
293319
*/
294320

295-
#define BTN_EN1 P1_18
296-
#define BTN_EN2 P1_20
297-
#define BTN_ENC P0_28
321+
#define BTN_EN1 EXPA1_08_PIN
322+
#define BTN_EN2 EXPA1_06_PIN
323+
#define BTN_ENC EXPA1_09_PIN
298324

299-
#define DOGLCD_CS P1_22
300-
#define DOGLCD_A0 P1_21
301-
#define DOGLCD_SCK P1_30
302-
#define DOGLCD_MOSI P1_23
325+
#define DOGLCD_CS EXPA1_04_PIN
326+
#define DOGLCD_A0 EXPA1_05_PIN
327+
#define DOGLCD_SCK EXPA1_10_PIN
328+
#define DOGLCD_MOSI EXPA1_03_PIN
303329
#define FORCE_SOFT_SPI
304330
#define LCD_BACKLIGHT_PIN -1
305331

306332
#elif HAS_SPI_TFT // Config for Classic UI (emulated DOGM) and Color UI
307-
#define TFT_CS_PIN P1_22
308-
#define TFT_A0_PIN P1_23
309-
#define TFT_DC_PIN P1_23
310-
#define TFT_MISO_PIN P0_17
311-
#define TFT_BACKLIGHT_PIN P1_18
312-
#define TFT_RESET_PIN P1_19
333+
#define TFT_CS_PIN EXPA1_04_PIN
334+
#define TFT_A0_PIN EXPA1_03_PIN
335+
#define TFT_DC_PIN EXPA1_03_PIN
336+
#define TFT_MISO_PIN EXPA2_10_PIN
337+
#define TFT_BACKLIGHT_PIN EXPA1_08_PIN
338+
#define TFT_RESET_PIN EXPA1_07_PIN
313339

314340
#define LCD_USE_DMA_SPI
315341

316-
#define TOUCH_INT_PIN P1_21
317-
#define TOUCH_CS_PIN P1_20
342+
#define TOUCH_INT_PIN EXPA1_05_PIN
343+
#define TOUCH_CS_PIN EXPA1_06_PIN
318344
#define TOUCH_BUTTONS_HW_SPI
319345
#define TOUCH_BUTTONS_HW_SPI_DEVICE 1
320346

321347
// SPI 1
322-
#define SCK_PIN P0_15
323-
#define MISO_PIN P0_17
324-
#define MOSI_PIN P0_18
348+
#define SCK_PIN EXPA2_09_PIN
349+
#define MISO_PIN EXPA2_10_PIN
350+
#define MOSI_PIN EXPA2_05_PIN
325351

326352
// Disable any LCD related PINs config
327353
#define LCD_PINS_ENABLE -1
@@ -361,72 +387,72 @@
361387
#elif IS_TFTGLCD_PANEL
362388

363389
#if ENABLED(TFTGLCD_PANEL_SPI)
364-
#define TFTGLCD_CS P3_26
390+
#define TFTGLCD_CS EXPA2_08_PIN
365391
#endif
366392

367-
#define SD_DETECT_PIN P1_31
393+
#define SD_DETECT_PIN EXPA2_04_PIN
368394

369395
#else
370396

371-
#define BTN_ENC P0_28 // (58) open-drain
372-
#define LCD_PINS_RS P1_19
397+
#define BTN_ENC EXPA1_09_PIN // (58) open-drain
398+
#define LCD_PINS_RS EXPA1_07_PIN
373399

374-
#define BTN_EN1 P3_26 // (31) J3-2 & AUX-4
375-
#define BTN_EN2 P3_25 // (33) J3-4 & AUX-4
400+
#define BTN_EN1 EXPA2_08_PIN // (31) J3-2 & AUX-4
401+
#define BTN_EN2 EXPA2_06_PIN // (33) J3-4 & AUX-4
376402

377-
#define LCD_PINS_ENABLE P1_18
378-
#define LCD_PINS_D4 P1_20
403+
#define LCD_PINS_ENABLE EXPA1_08_PIN
404+
#define LCD_PINS_D4 EXPA1_06_PIN
379405

380-
#define LCD_SDSS P0_16 // (16) J3-7 & AUX-4
406+
#define LCD_SDSS EXPA2_07_PIN // (16) J3-7 & AUX-4
381407

382408
#if SD_CONNECTION_IS(LCD)
383-
#define SD_DETECT_PIN P1_31 // (49) (NOT 5V tolerant)
409+
#define SD_DETECT_PIN EXPA2_04_PIN // (49) (NOT 5V tolerant)
384410
#endif
385411

386412
#if ENABLED(FYSETC_MINI_12864)
387-
#define DOGLCD_CS P1_18
388-
#define DOGLCD_A0 P1_19
389-
#define DOGLCD_SCK P0_15
390-
#define DOGLCD_MOSI P0_18
413+
#define DOGLCD_CS EXPA1_08_PIN
414+
#define DOGLCD_A0 EXPA1_07_PIN
415+
#define DOGLCD_SCK EXPA2_09_PIN
416+
#define DOGLCD_MOSI EXPA2_05_PIN
391417

392418
#define LCD_BACKLIGHT_PIN -1
393419

394420
#define FORCE_SOFT_SPI // Use this if default of hardware SPI causes display problems
395421
// results in LCD soft SPI mode 3, SD soft SPI mode 0
396422

397-
#define LCD_RESET_PIN P1_20 // Must be high or open for LCD to operate normally.
423+
#define LCD_RESET_PIN EXPA1_06_PIN // Must be high or open for LCD to operate normally.
398424

399425
#if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0)
400426
#ifndef RGB_LED_R_PIN
401-
#define RGB_LED_R_PIN P1_21
427+
#define RGB_LED_R_PIN EXPA1_05_PIN
402428
#endif
403429
#ifndef RGB_LED_G_PIN
404-
#define RGB_LED_G_PIN P1_22
430+
#define RGB_LED_G_PIN EXPA1_04_PIN
405431
#endif
406432
#ifndef RGB_LED_B_PIN
407-
#define RGB_LED_B_PIN P1_23
433+
#define RGB_LED_B_PIN EXPA1_03_PIN
408434
#endif
409435
#elif ENABLED(FYSETC_MINI_12864_2_1)
410-
#define NEOPIXEL_PIN P1_21
436+
#define NEOPIXEL_PIN EXPA1_05_PIN
411437
#endif
412438

413439
#else // !FYSETC_MINI_12864
414440

415441
#if ENABLED(MKS_MINI_12864)
416-
#define DOGLCD_CS P1_21
417-
#define DOGLCD_A0 P1_22
418-
#define DOGLCD_SCK P0_15
419-
#define DOGLCD_MOSI P0_18
442+
#define DOGLCD_CS EXPA1_05_PIN
443+
#define DOGLCD_A0 EXPA1_04_PIN
444+
#define DOGLCD_SCK EXPA2_09_PIN
445+
#define DOGLCD_MOSI EXPA2_05_PIN
420446
#define FORCE_SOFT_SPI
421447
#endif
422448

423449
#if IS_ULTIPANEL
424-
#define LCD_PINS_D5 P1_21
425-
#define LCD_PINS_D6 P1_22
426-
#define LCD_PINS_D7 P1_23
450+
#define LCD_PINS_D5 EXPA1_05_PIN
451+
#define LCD_PINS_D6 EXPA1_04_PIN
452+
#define LCD_PINS_D7 EXPA1_03_PIN
427453

428454
#if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
429-
#define BTN_ENC_EN LCD_PINS_D7 // Detect the presence of the encoder
455+
#define BTN_ENC_EN EXPA1_03_PIN // Detect the presence of the encoder
430456
#endif
431457

432458
#endif

Marlin/src/pins/lpc1768/pins_BTT_SKR_common.h

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@
2929
#error "Oops! Make sure you have the LPC1768 environment selected in your IDE."
3030
#endif
3131

32+
// If you have the Big tree tech driver expantion module, enable HAS_BTT_EXP_MOT
33+
// https://github.com/bigtreetech/BTT-Expansion-module/tree/master/BTT%20EXP-MOT
34+
//#define HAS_BTT_EXP_MOT 1
35+
36+
#if BOTH(HAS_WIRED_LCD,HAS_BTT_EXP_MOT)
37+
#ERROR "Having a LCD on EXP1/EXP2 and a expanion motor module on EXP1/EXP2 is not possable."
38+
#endif
39+
3240
// Ignore temp readings during development.
3341
//#define BOGUS_TEMPERATURE_GRACE_PERIOD 2000
3442

@@ -115,3 +123,46 @@
115123
#elif SD_CONNECTION_IS(CUSTOM_CABLE)
116124
#error "No custom SD drive cable defined for this board."
117125
#endif
126+
127+
#if HAS_BTT_EXP_MOT
128+
/* _____ _____
129+
* NC | · · | GND NC | · · | GND
130+
* NC | · · | 1.31 (M1EN) (M2EN) 1.23 | · · | 1.22 (M3EN)
131+
* (M1STP) 0.18 | · · 3.25 (M1DIR) (M1RX) 1.21 | · · 1.20 (M1DIAG)
132+
* (M2DIR) 0.16 | · · | 3.26 (M2STP) (M2RX) 1.19 | · · | 1.18 (M2DIAG)
133+
* (M3DIR) 0.15 | · · | 0.17 (M3STP) (M3RX) 0.28 | · · | 1.30 (M3DIAG)
134+
* ----- -----
135+
* EXP2 EXP1
136+
*/
137+
138+
// M1 on Driver Expansion Module
139+
#define E2_STEP_PIN EXPA2_05_PIN
140+
#define E2_DIR_PIN EXPA2_06_PIN
141+
#define E2_ENABLE_PIN EXPA2_04_PIN
142+
#define E2_DIAG_PIN EXPA1_06_PIN
143+
#define E2_CS_PIN EXPA1_05_PIN
144+
#if HAS_TMC_UART
145+
#define E2_SERIAL_TX_PIN EXPA1_05_PIN
146+
#define E2_SERIAL_RX_PIN EXPA1_05_PIN
147+
#endif
148+
// M2 on Driver Expansion Module
149+
#define E3_STEP_PIN EXPA2_08_PIN
150+
#define E3_DIR_PIN EXPA2_07_PIN
151+
#define E3_ENABLE_PIN EXPA1_03_PIN
152+
#define E3_DIAG_PIN EXPA1_08_PIN
153+
#define E3_CS_PIN EXPA1_07_PIN
154+
#if HAS_TMC_UART
155+
#define E3_SERIAL_TX_PIN EXPA1_07_PIN
156+
#define E3_SERIAL_RX_PIN EXPA1_07_PIN
157+
#endif
158+
// M3 on Driver Expansion Module
159+
#define E4_STEP_PIN EXPA2_10_PIN
160+
#define E4_DIR_PIN EXPA2_09_PIN
161+
#define E4_ENABLE_PIN EXPA1_04_PIN
162+
#define E4_DIAG_PIN EXPA1_10_PIN
163+
#define E4_CS_PIN EXPA1_09_PIN
164+
#if HAS_TMC_UART
165+
#define E4_SERIAL_TX_PIN EXPA1_09_PIN
166+
#define E4_SERIAL_RX_PIN EXPA1_09_PIN
167+
#endif
168+
#endif // HAS_BTT_EXP_MOT

Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@
229229
* _____ _____
230230
* (BEEPER) 1.31 | · · | 1.30 (BTN_ENC) (MISO) 0.8 | · · | 0.7 (SD_SCK)
231231
* (LCD_EN) 0.18 | · · | 0.16 (LCD_RS) (BTN_EN1) 3.25 | · · | 0.28 (SD_CS2)
232-
* (LCD_D4) 0.15 | · · | 0.17 (LCD_D5) (BTN_EN2) 3.26 | · · | 0.9 (SD_MOSI)
232+
* (LCD_D4) 0.15 | · · 0.17 (LCD_D5) (BTN_EN2) 3.26 | · · 0.9 (SD_MOSI)
233233
* (LCD_D6) 1.0 | · · | 1.22 (LCD_D7) (SD_DETECT) 0.27 | · · | RST
234234
* GND | · · | 5V GND | · · | NC
235235
* ----- -----

Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,9 @@
249249

250250
/**
251251
* _____ _____
252-
* (BEEPER) 1.31 | · · | 1.30 (BTN_ENC) (MISO) 0.8 | · · | 0.7 (SD_SCK)
253-
* (LCD_EN) 0.18 | · · | 0.16 (LCD_RS) (BTN_EN1) 3.25 | · · | 0.28 (SD_CS2)
254-
* (LCD_D4) 0.15 | · · | 0.17 (LCD_D5) (BTN_EN2) 3.26 | · · | 0.9 (SD_MOSI)
252+
* (BEEPER) 1.31 | · · | 1.30 (BTN_ENC) (MISO) 0.8 | · · | 0.7 (SD_SCK)
253+
* (LCD_EN) 0.18 | · · | 0.16 (LCD_RS) (BTN_EN1) 3.25 | · · | 0.28 (SD_CS2)
254+
* (LCD_D4) 0.15 | · · 0.17 (LCD_D5) (BTN_EN2) 3.26 | · · 0.9 (SD_MOSI)
255255
* (LCD_D6) 1.0 | · · | 1.22 (LCD_D7) (SD_DETECT) 0.27 | · · | RST
256256
* GND | · · | 5V GND | · · | NC
257257
* ----- -----

Marlin/src/pins/lpc1769/pins_TH3D_EZBOARD.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155
* _____
156156
* 5V | · · | GND
157157
* (LCD_EN) P0_18 | · · | P0_16 (LCD_RS)
158-
* (LCD_D4) P0_15 | · · | P3_25 (BTN_EN2)
158+
* (LCD_D4) P0_15 | · · P3_25 (BTN_EN2)
159159
* (RESET) P2_11 | · · | P3_26 (BTN_EN1)
160160
* (BTN_ENC) P1_30 | · · | P1_31 (BEEPER)
161161
* -----

Marlin/src/pins/ramps/pins_FYSETC_F6_13.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@
201201
* ----- -----
202202
* 5V/D41 | · · | GND 5V | · · | GND
203203
* RESET | · · | D49 (SD_DETECT) (LCD_D7) D29 | · · | D27 (LCD_D6)
204-
* (MOSI) D51 | · · | D33 (BTN_EN2) (LCD_D5) D25 | · · | D23 (LCD_D4)
204+
* (MOSI) D51 | · · D33 (BTN_EN2) (LCD_D5) D25 | · · D23 (LCD_D4)
205205
* (SD_SS) D53 | · · | D31 (BTN_EN1) (LCD_RS) D16 | · · | D17 (LCD_EN)
206206
* (SCK) D52 | · · | D50 (MISO) (BTN_ENC) D35 | · · | D37 (BEEPER)
207207
* ----- -----

0 commit comments

Comments
 (0)