Browse Source

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

vanilla_fb_2.0.x
Jason Smith 4 years ago
committed by Scott Lahteine
parent
commit
6043f5d5d0
  1. 4
      Marlin/src/lcd/extui/ui_api.cpp
  2. 4
      Marlin/src/lcd/ultralcd.cpp
  3. 52
      Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h
  4. 23
      Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h
  5. 4
      Marlin/src/sd/cardreader.cpp

4
Marlin/src/lcd/extui/ui_api.cpp

@ -1057,10 +1057,6 @@ namespace ExtUI {
// At the moment, we piggy-back off the ultralcd calls, but this could be cleaned up in the future
void MarlinUI::init() {
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
SET_INPUT_PULLUP(SD_DETECT_PIN);
#endif
ExtUI::onStartup();
}

4
Marlin/src/lcd/ultralcd.cpp

@ -372,10 +372,6 @@ void MarlinUI::init() {
#endif // HAS_SHIFT_ENCODER
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
SET_INPUT_PULLUP(SD_DETECT_PIN);
#endif
#if HAS_ENCODER_ACTION && HAS_SLOW_BUTTONS
slow_buttons = 0;
#endif

52
Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h

@ -280,24 +280,29 @@
//#define FAN6_PIN PC9 // Fan6
//#define FAN7_PIN PE14 // Fan7
#ifndef SDCARD_CONNECTION
#define SDCARD_CONNECTION ONBOARD
#endif
//
// By default the onboard SD (SPI1) is enabled
// By default the LCD SD (SPI2) is enabled
// Onboard SD is on a completely separate SPI bus, and requires
// overriding pins to access.
//
#define CUSTOM_SPI_PINS
#if DISABLED(CUSTOM_SPI_PINS)
#if SD_CONNECTION_IS(LCD)
#define SD_DETECT_PIN PB10
#define SDSS PB12
#endif
// HAL SPI1 pins group
#if ENABLED(CUSTOM_SPI_PINS)
#elif SD_CONNECTION_IS(ONBOARD)
// Instruct the STM32 HAL to override the default SPI pins from the variant.h file
#define CUSTOM_SPI_PINS
#define SDSS PA4
#define SD_DETECT_PIN PC4
#define LCD_SDSS PA4
#define SS_PIN SDSS
#define SCK_PIN PA5
#define MISO_PIN PA6
#define MOSI_PIN PA7
#define SS_PIN PA4 // Chip select for SD card used by Marlin
#define SD_DETECT_PIN PC4
#elif SD_CONNECTION_IS(CUSTOM_CABLE)
#define "CUSTOM_CABLE is not a supported SDCARD_CONNECTION for this board"
#endif
/**
@ -319,7 +324,6 @@
#define BTN_ENC PA15
#if ENABLED(CR10_STOCKDISPLAY)
#define LCD_PINS_RS PG6
#define BTN_EN1 PC10
@ -333,6 +337,15 @@
#undef BOARD_ST7920_DELAY_2
#undef BOARD_ST7920_DELAY_3
#elif ENABLED(MKS_MINI_12864)
#define DOGLCD_A0 PG6
#define DOGLCD_CS PG7
#define BTN_EN1 PD10
#define BTN_EN2 PH10
#if SD_CONNECTION_IS(ONBOARD)
#define SOFTWARE_SPI
#endif
#else
#define LCD_PINS_RS PA8
@ -340,17 +353,17 @@
#define BTN_EN1 PD10
#define BTN_EN2 PH10
#if DISABLED(CUSTOM_SPI_PINS)
#define SD_DETECT_PIN PB10
#define LCD_SDSS PB12
#endif
#define LCD_PINS_ENABLE PC10
#define LCD_PINS_D4 PG8
#if ENABLED(FYSETC_MINI_12864)
#define DOGLCD_CS PC10
#define DOGLCD_A0 PA8
#if SD_CONNECTION_IS(ONBOARD)
#define SOFTWARE_SPI
#endif
//#define LCD_BACKLIGHT_PIN -1
#define LCD_RESET_PIN PG8 // Must be high or open for LCD to operate normally.
#if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0)
@ -389,11 +402,6 @@
#endif
#endif
//#define DOGLCD_CS PB12
//#define DOGLCD_A0 PA8
//#define LCD_PINS_DC PB14
//#define DOGLCD_MOSI PB15
#endif // HAS_SPI_LCD
#undef TP

23
Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h

@ -250,12 +250,22 @@
// Onboard SD card
// Must use soft SPI because Marlin's default hardware SPI is tied to LCD's EXP2
//
#if SD_CONNECTION_IS(ONBOARD)
#define SOFTWARE_SPI // Use soft SPI for onboard SD
#if SD_CONNECTION_IS(LCD)
#define SD_DETECT_PIN PF12
#define SDSS PB12
#elif SD_CONNECTION_IS(ONBOARD)
// The SKR Pro's ONBOARD SD interface is on SPI1.
// Due to a pull resistor on the clock line, it needs to use SPI Data Mode 3 to
// function with Hardware SPI. This is not currently configurable in the HAL,
// so force Software SPI to work around this issue.
#define SOFTWARE_SPI
#define SDSS PA4
#define SCK_PIN PA5
#define MISO_PIN PA6
#define MOSI_PIN PB5
#define SD_DETECT_PIN PB11
#elif SD_CONNECTION_IS(CUSTOM_CABLE)
#define "CUSTOM_CABLE is not a supported SDCARD_CONNECTION for this board"
#endif
/**
@ -275,9 +285,6 @@
#if HAS_SPI_LCD
#define BEEPER_PIN PG4
#define BTN_ENC PA8
#if SD_CONNECTION_IS(LCD)
#define SDSS PB12 // Uses default hardware SPI for LCD's SD
#endif
#if ENABLED(CR10_STOCKDISPLAY)
#define LCD_PINS_RS PG6
@ -296,16 +303,14 @@
#elif ENABLED(MKS_MINI_12864)
#define DOGLCD_A0 PG6
#define DOGLCD_CS PG3
#define BTN_EN1 PG10
#define BTN_EN2 PF11
#else
#define LCD_PINS_RS PD10
#define BTN_EN1 PG10
#define BTN_EN2 PF11
#define SD_DETECT_PIN PF12
#define LCD_SDSS PB12
#define LCD_PINS_ENABLE PD11
#define LCD_PINS_D4 PG2

4
Marlin/src/sd/cardreader.cpp

@ -137,6 +137,10 @@ CardReader::CardReader() {
// Disable autostart until card is initialized
autostart_index = -1;
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
SET_INPUT_PULLUP(SD_DETECT_PIN);
#endif
#if PIN_EXISTS(SDPOWER)
OUT_WRITE(SDPOWER_PIN, HIGH); // Power the SD reader
#endif

Loading…
Cancel
Save