Browse Source

Fix SD pins for SKR Pro and GTR (#19047)

Jason Smith 5 years ago
parent
commit
646d90f3da
No account linked to committer's email address

+ 0
- 4
Marlin/src/lcd/extui/ui_api.cpp View File

1057
 // At the moment, we piggy-back off the ultralcd calls, but this could be cleaned up in the future
1057
 // At the moment, we piggy-back off the ultralcd calls, but this could be cleaned up in the future
1058
 
1058
 
1059
 void MarlinUI::init() {
1059
 void MarlinUI::init() {
1060
-  #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
1061
-    SET_INPUT_PULLUP(SD_DETECT_PIN);
1062
-  #endif
1063
-
1064
   ExtUI::onStartup();
1060
   ExtUI::onStartup();
1065
 }
1061
 }
1066
 
1062
 

+ 0
- 4
Marlin/src/lcd/ultralcd.cpp View File

372
 
372
 
373
   #endif // HAS_SHIFT_ENCODER
373
   #endif // HAS_SHIFT_ENCODER
374
 
374
 
375
-  #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
376
-    SET_INPUT_PULLUP(SD_DETECT_PIN);
377
-  #endif
378
-
379
   #if HAS_ENCODER_ACTION && HAS_SLOW_BUTTONS
375
   #if HAS_ENCODER_ACTION && HAS_SLOW_BUTTONS
380
     slow_buttons = 0;
376
     slow_buttons = 0;
381
   #endif
377
   #endif

+ 30
- 22
Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h View File

280
 //#define FAN6_PIN                          PC9   // Fan6
280
 //#define FAN6_PIN                          PC9   // Fan6
281
 //#define FAN7_PIN                          PE14  // Fan7
281
 //#define FAN7_PIN                          PE14  // Fan7
282
 
282
 
283
+#ifndef SDCARD_CONNECTION
284
+  #define SDCARD_CONNECTION ONBOARD
285
+#endif
286
+
283
 //
287
 //
284
-// By default the onboard SD (SPI1) is enabled
288
+// By default the LCD SD (SPI2) is enabled
289
+// Onboard SD is on a completely separate SPI bus, and requires
290
+// overriding pins to access.
285
 //
291
 //
286
-#define CUSTOM_SPI_PINS
287
-#if DISABLED(CUSTOM_SPI_PINS)
292
+#if SD_CONNECTION_IS(LCD)
293
+  #define SD_DETECT_PIN                     PB10
288
   #define SDSS                              PB12
294
   #define SDSS                              PB12
289
-#endif
290
-
291
-// HAL SPI1 pins group
292
-#if ENABLED(CUSTOM_SPI_PINS)
295
+#elif SD_CONNECTION_IS(ONBOARD)
296
+  // Instruct the STM32 HAL to override the default SPI pins from the variant.h file
297
+  #define CUSTOM_SPI_PINS
293
   #define SDSS                              PA4
298
   #define SDSS                              PA4
294
-  #define SD_DETECT_PIN                     PC4
295
-  #define LCD_SDSS                          PA4
296
-
299
+  #define SS_PIN                            SDSS
297
   #define SCK_PIN                           PA5
300
   #define SCK_PIN                           PA5
298
   #define MISO_PIN                          PA6
301
   #define MISO_PIN                          PA6
299
   #define MOSI_PIN                          PA7
302
   #define MOSI_PIN                          PA7
300
-  #define SS_PIN                            PA4   // Chip select for SD card used by Marlin
303
+  #define SD_DETECT_PIN                     PC4
304
+#elif SD_CONNECTION_IS(CUSTOM_CABLE)
305
+  #define "CUSTOM_CABLE is not a supported SDCARD_CONNECTION for this board"
301
 #endif
306
 #endif
302
 
307
 
303
 /**
308
 /**
319
   #define BTN_ENC                           PA15
324
   #define BTN_ENC                           PA15
320
 
325
 
321
   #if ENABLED(CR10_STOCKDISPLAY)
326
   #if ENABLED(CR10_STOCKDISPLAY)
322
-
323
     #define LCD_PINS_RS                     PG6
327
     #define LCD_PINS_RS                     PG6
324
 
328
 
325
     #define BTN_EN1                         PC10
329
     #define BTN_EN1                         PC10
333
     #undef BOARD_ST7920_DELAY_2
337
     #undef BOARD_ST7920_DELAY_2
334
     #undef BOARD_ST7920_DELAY_3
338
     #undef BOARD_ST7920_DELAY_3
335
 
339
 
340
+  #elif ENABLED(MKS_MINI_12864)
341
+    #define DOGLCD_A0                       PG6
342
+    #define DOGLCD_CS                       PG7
343
+    #define BTN_EN1                         PD10
344
+    #define BTN_EN2                         PH10
345
+
346
+    #if SD_CONNECTION_IS(ONBOARD)
347
+      #define SOFTWARE_SPI
348
+    #endif
336
   #else
349
   #else
337
 
350
 
338
     #define LCD_PINS_RS                     PA8
351
     #define LCD_PINS_RS                     PA8
340
     #define BTN_EN1                         PD10
353
     #define BTN_EN1                         PD10
341
     #define BTN_EN2                         PH10
354
     #define BTN_EN2                         PH10
342
 
355
 
343
-    #if DISABLED(CUSTOM_SPI_PINS)
344
-      #define SD_DETECT_PIN                 PB10
345
-      #define LCD_SDSS                      PB12
346
-    #endif
347
-
348
     #define LCD_PINS_ENABLE                 PC10
356
     #define LCD_PINS_ENABLE                 PC10
349
     #define LCD_PINS_D4                     PG8
357
     #define LCD_PINS_D4                     PG8
350
 
358
 
351
     #if ENABLED(FYSETC_MINI_12864)
359
     #if ENABLED(FYSETC_MINI_12864)
352
       #define DOGLCD_CS                     PC10
360
       #define DOGLCD_CS                     PC10
353
       #define DOGLCD_A0                     PA8
361
       #define DOGLCD_A0                     PA8
362
+
363
+      #if SD_CONNECTION_IS(ONBOARD)
364
+        #define SOFTWARE_SPI
365
+      #endif
366
+
354
       //#define LCD_BACKLIGHT_PIN           -1
367
       //#define LCD_BACKLIGHT_PIN           -1
355
       #define LCD_RESET_PIN                 PG8   // Must be high or open for LCD to operate normally.
368
       #define LCD_RESET_PIN                 PG8   // Must be high or open for LCD to operate normally.
356
       #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0)
369
       #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0)
389
     #endif
402
     #endif
390
   #endif
403
   #endif
391
 
404
 
392
-  //#define DOGLCD_CS                       PB12
393
-  //#define DOGLCD_A0                       PA8
394
-  //#define LCD_PINS_DC                     PB14
395
-  //#define DOGLCD_MOSI                     PB15
396
-
397
 #endif // HAS_SPI_LCD
405
 #endif // HAS_SPI_LCD
398
 
406
 
399
 #undef TP
407
 #undef TP

+ 14
- 9
Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h View File

250
 // Onboard SD card
250
 // Onboard SD card
251
 // Must use soft SPI because Marlin's default hardware SPI is tied to LCD's EXP2
251
 // Must use soft SPI because Marlin's default hardware SPI is tied to LCD's EXP2
252
 //
252
 //
253
-#if SD_CONNECTION_IS(ONBOARD)
254
-  #define SOFTWARE_SPI                            // Use soft SPI for onboard SD
253
+#if SD_CONNECTION_IS(LCD)
254
+  #define SD_DETECT_PIN                     PF12
255
+  #define SDSS                              PB12
256
+#elif SD_CONNECTION_IS(ONBOARD)
257
+  // The SKR Pro's ONBOARD SD interface is on SPI1.
258
+  // Due to a pull resistor on the clock line, it needs to use SPI Data Mode 3 to
259
+  // function with Hardware SPI. This is not currently configurable in the HAL,
260
+  // so force Software SPI to work around this issue.
261
+  #define SOFTWARE_SPI
255
   #define SDSS                              PA4
262
   #define SDSS                              PA4
256
   #define SCK_PIN                           PA5
263
   #define SCK_PIN                           PA5
257
   #define MISO_PIN                          PA6
264
   #define MISO_PIN                          PA6
258
   #define MOSI_PIN                          PB5
265
   #define MOSI_PIN                          PB5
266
+  #define SD_DETECT_PIN                     PB11
267
+#elif SD_CONNECTION_IS(CUSTOM_CABLE)
268
+  #define "CUSTOM_CABLE is not a supported SDCARD_CONNECTION for this board"
259
 #endif
269
 #endif
260
 
270
 
261
 /**
271
 /**
275
 #if HAS_SPI_LCD
285
 #if HAS_SPI_LCD
276
   #define BEEPER_PIN                        PG4
286
   #define BEEPER_PIN                        PG4
277
   #define BTN_ENC                           PA8
287
   #define BTN_ENC                           PA8
278
-  #if SD_CONNECTION_IS(LCD)
279
-    #define SDSS                            PB12  // Uses default hardware SPI for LCD's SD
280
-  #endif
281
 
288
 
282
   #if ENABLED(CR10_STOCKDISPLAY)
289
   #if ENABLED(CR10_STOCKDISPLAY)
283
     #define LCD_PINS_RS                     PG6
290
     #define LCD_PINS_RS                     PG6
296
   #elif ENABLED(MKS_MINI_12864)
303
   #elif ENABLED(MKS_MINI_12864)
297
     #define DOGLCD_A0                       PG6
304
     #define DOGLCD_A0                       PG6
298
     #define DOGLCD_CS                       PG3
305
     #define DOGLCD_CS                       PG3
299
-
306
+    #define BTN_EN1                         PG10
307
+    #define BTN_EN2                         PF11
300
   #else
308
   #else
301
 
309
 
302
     #define LCD_PINS_RS                     PD10
310
     #define LCD_PINS_RS                     PD10
303
 
311
 
304
     #define BTN_EN1                         PG10
312
     #define BTN_EN1                         PG10
305
     #define BTN_EN2                         PF11
313
     #define BTN_EN2                         PF11
306
-    #define SD_DETECT_PIN                   PF12
307
-
308
-    #define LCD_SDSS                        PB12
309
 
314
 
310
     #define LCD_PINS_ENABLE                 PD11
315
     #define LCD_PINS_ENABLE                 PD11
311
     #define LCD_PINS_D4                     PG2
316
     #define LCD_PINS_D4                     PG2

+ 4
- 0
Marlin/src/sd/cardreader.cpp View File

137
   // Disable autostart until card is initialized
137
   // Disable autostart until card is initialized
138
   autostart_index = -1;
138
   autostart_index = -1;
139
 
139
 
140
+  #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
141
+    SET_INPUT_PULLUP(SD_DETECT_PIN);
142
+  #endif
143
+  
140
   #if PIN_EXISTS(SDPOWER)
144
   #if PIN_EXISTS(SDPOWER)
141
     OUT_WRITE(SDPOWER_PIN, HIGH); // Power the SD reader
145
     OUT_WRITE(SDPOWER_PIN, HIGH); // Power the SD reader
142
   #endif
146
   #endif

Loading…
Cancel
Save