Update SD card connection / sharing options (#14325)

This commit is contained in:
Andy Shaw
2019-06-26 09:55:57 +01:00
committed by Scott Lahteine
parent 9f136a7c67
commit 064177154c
100 changed files with 1508 additions and 860 deletions

View File

@ -86,7 +86,7 @@
#define FAN1_PIN P0_26
#define LCD_SDSS P0_16 // LCD SD chip select
#define ONBOARD_SD_CS P0_06 // On board SD chip select
#define ONBOARD_SD_CS_PIN P0_06 // Chip select for "System" SD card
#if ENABLED(AZSMZ_12864)
#define BEEPER_PIN P1_30
@ -95,28 +95,24 @@
#define BTN_EN1 P4_28
#define BTN_EN2 P1_27
#define BTN_ENC P3_26
#if DISABLED(LPC_SD_ONBOARD)
#define LPC_SD_LCD
#ifndef SDCARD_CONNECTION
#define SDCARD_CONNECTION LCD
#endif
#endif
#if ENABLED(LPC_SD_LCD)
#if SD_CONNECTION_IS(LCD)
#define SCK_PIN P0_15
#define MISO_PIN P0_17
#define MOSI_PIN P0_18
#define SS_PIN LCD_SDSS
#define SD_DETECT_PIN P3_25
#elif ENABLED(LPC_SD_ONBOARD)
#if ENABLED(USB_SD_ONBOARD)
// When sharing the SD card with a PC we want the menu options to
// mount/unmount the card and refresh it. So we disable card detect.
#define SHARED_SD_CARD
#undef SD_DETECT_PIN
#endif
#elif SD_CONNECTION_IS(ONBOARD)
#define SCK_PIN P0_07
#define MISO_PIN P0_08
#define MOSI_PIN P0_09
#define SS_PIN ONBOARD_SD_CS
#define SS_PIN ONBOARD_SD_CS_PIN
#elif SD_CONNECTION_IS(CUSTOM_CABLE)
#error "No custom SD drive cable defined for this board."
#endif
//

View File

@ -189,30 +189,23 @@
//
// SD Support
//
#if !ANY(LPC_SD_LCD, LPC_SD_ONBOARD, LPC_SD_CUSTOM_CABLE)
#define LPC_SD_ONBOARD
#ifndef SDCARD_CONNECTION
#define SDCARD_CONNECTION ONBOARD
#endif
#if ENABLED(LPC_SD_LCD)
#define SCK_PIN P0_15
#define MISO_PIN P0_17
#define MOSI_PIN P0_18
#define SS_PIN P1_23 // Chip select for SD card used by Marlin
#define ONBOARD_SD_CS P0_06 // Chip select for "System" SD card
#elif ENABLED(LPC_SD_ONBOARD)
#if ENABLED(USB_SD_ONBOARD)
// When sharing the SD card with a PC we want the menu options to
// mount/unmount the card and refresh it. So we disable card detect.
#define SHARED_SD_CARD
#undef SD_DETECT_PIN // there is also no detect pin for the onboard card
#endif
#define SCK_PIN P0_07
#define MISO_PIN P0_08
#define MOSI_PIN P0_09
#define SS_PIN P0_06 // Chip select for SD card used by Marlin
#define ONBOARD_SD_CS P0_06 // Chip select for "System" SD card
#define ONBOARD_SD_CS_PIN P0_06 // Chip select for "System" SD card
#if SD_CONNECTION_IS(LCD)
#define SCK_PIN P0_15
#define MISO_PIN P0_17
#define MOSI_PIN P0_18
#define SS_PIN P1_23
#elif SD_CONNECTION_IS(ONBOARD)
#undef SD_DETECT_PIN
#define SCK_PIN P0_07
#define MISO_PIN P0_08
#define MOSI_PIN P0_09
#define SS_PIN ONBOARD_SD_CS_PIN
#elif SD_CONNECTION_IS(CUSTOM_CABLE)
#error "No custom SD drive cable defined for this board."
#endif

View File

@ -255,42 +255,32 @@
// SD Support
//
#if !ANY(LPC_SD_LCD, LPC_SD_ONBOARD, LPC_SD_CUSTOM_CABLE)
#undef USB_SD_DISABLED
#define USB_SD_ONBOARD
#define LPC_SD_LCD
#ifndef SDCARD_CONNECTION
#define SDCARD_CONNECTION LCD
#endif
#if ENABLED(LPC_SD_LCD)
#define ONBOARD_SD_CS_PIN P0_06 // Chip select for "System" SD card
#if SD_CONNECTION_IS(LCD)
#define SCK_PIN P0_15
#define MISO_PIN P0_17
#define MOSI_PIN P0_18
#define SS_PIN P0_16 // Chip select for SD card used by Marlin
#define ONBOARD_SD_CS P0_06 // Chip select for "System" SD card
#elif ENABLED(LPC_SD_ONBOARD)
#if ENABLED(USB_SD_ONBOARD)
// When sharing the SD card with a PC we want the menu options to
// mount/unmount the card and refresh it. So we disable card detect.
#define SHARED_SD_CARD
#undef SD_DETECT_PIN
//#define SD_DETECT_PIN P0_27 // (57) open-drain
#endif
#define SS_PIN P0_16
#elif SD_CONNECTION_IS(ONBOARD)
#undef SD_DETECT_PIN
#define SD_DETECT_PIN P0_27
#define SCK_PIN P0_07
#define MISO_PIN P0_08
#define MOSI_PIN P0_09
#define SS_PIN P0_06 // Chip select for SD card used by Marlin
#define ONBOARD_SD_CS P0_06 // Chip select for "System" SD card
#define SS_PIN ONBOARD_SD_CS_PIN
#elif SD_CONNECTION_IS(CUSTOM_CABLE)
#error "No custom SD drive cable defined for this board."
#endif
/**
* Special pins
* P1_30 (37) (NOT 5V tolerant)
* P1_31 (49) (NOT 5V tolerant)
* P0_27 (57) (Open collector)
* P0_28 (58) (Open collector)
*/
/**
* Special pins
* P1_30 (37) (NOT 5V tolerant)
* P1_31 (49) (NOT 5V tolerant)
* P0_27 (57) (Open collector)
* P0_28 (58) (Open collector)
*/

View File

@ -118,39 +118,30 @@
// MKS_MINI_12864 strongly prefers the SD card on the display and
// requires jumpers on the SKR V1.1 board as documented here:
// https://www.facebook.com/groups/505736576548648/permalink/630639874058317/
#if !ANY(LPC_SD_LCD, LPC_SD_ONBOARD, LPC_SD_CUSTOM_CABLE)
#ifndef SDCARD_CONNECTION
#if ENABLED(MKS_MINI_12864)
#define LPC_SD_LCD
#undef USB_SD_DISABLED
#define USB_SD_ONBOARD
#define SDCARD_CONNECTION LCD
#else
#define USB_SD_ONBOARD
#define LPC_SD_ONBOARD
#define SDCARD_CONNECTION ONBOARD
#endif
#endif
#if ENABLED(LPC_SD_LCD)
#define ONBOARD_SD_CS_PIN P0_06 // Chip select for "System" SD card
#if SD_CONNECTION_IS(LCD)
#define SCK_PIN P0_15
#define MISO_PIN P0_17
#define MOSI_PIN P0_18
#define SS_PIN P1_23 // Chip select for SD card used by Marlin
#define ONBOARD_SD_CS P0_06 // Chip select for "System" SD card
#elif ENABLED(LPC_SD_ONBOARD)
#if ENABLED(USB_SD_ONBOARD)
// When sharing the SD card with a PC we want the menu options to
// mount/unmount the card and refresh it. So we disable card detect.
#define SHARED_SD_CARD
#undef SD_DETECT_PIN // there is also no detect pin for the onboard card
#endif
#define SS_PIN P1_23
#elif SD_CONNECTION_IS(ONBOARD)
#undef SD_DETECT_PIN
#define SD_DETECT_PIN P0_27
#define SCK_PIN P0_07
#define MISO_PIN P0_08
#define MOSI_PIN P0_09
#define SS_PIN P0_06 // Chip select for SD card used by Marlin
#define ONBOARD_SD_CS P0_06 // Chip select for "System" SD card
#define SS_PIN ONBOARD_SD_CS_PIN
#elif SD_CONNECTION_IS(CUSTOM_CABLE)
#error "No custom SD drive cable defined for this board."
#endif
// Trinamic driver support
@ -232,11 +223,11 @@
// EXAMPLES
// Example 1: No LCD attached or a TFT style display using the AUX header RX/TX pins.
// LPC_SD_LCD must not be enabled. Nothing should be connected to EXP1/EXP2.
// SDCARD_CONNECTION must not be 'LCD'. Nothing should be connected to EXP1/EXP2.
//#define SKR_USE_LCD_PINS_FOR_CS
#if ENABLED(SKR_USE_LCD_PINS_FOR_CS)
#if ENABLED(LPC_SD_LCD)
#error "LPC_SD_LCD must not be enabled with SKR_USE_LCD_PINS_FOR_CS."
#if SD_CONNECTION_IS(LCD)
#error "SDCARD_CONNECTION must not be 'LCD' with SKR_USE_LCD_PINS_FOR_CS."
#endif
#define X_CS_PIN P1_23
#define Y_CS_PIN P3_26
@ -247,11 +238,11 @@
// Example 2: A REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
// The SD card reader attached to the LCD (if present) can't be used because
// the pins will be in use. So LPC_SD_LCD must not be defined.
// the pins will be in use. So SDCARD_CONNECTION must not be 'LCD'.
//#define SKR_USE_LCD_SD_CARD_PINS_FOR_CS
#if ENABLED(SKR_USE_LCD_SD_CARD_PINS_FOR_CS)
#if ENABLED(LPC_SD_LCD)
#error "LPC_SD_LCD must not be enabled with SKR_USE_LCD_SD_CARD_PINS_FOR_CS."
#if SD_CONNECTION_IS(LCD)
#error "SDCARD_CONNECTION must not be 'LCD' with SKR_USE_LCD_SD_CARD_PINS_FOR_CS."
#endif
#define X_CS_PIN P0_02
#define Y_CS_PIN P0_03

View File

@ -213,35 +213,25 @@
//
// SD Support
//
#if NONE(LPC_SD_LCD, LPC_SD_ONBOARD, LPC_SD_CUSTOM_CABLE)
#undef USB_SD_DISABLED
#define USB_SD_ONBOARD
#define LPC_SD_ONBOARD
#ifndef SDCARD_CONNECTION
#define SDCARD_CONNECTION ONBOARD
#endif
#if ENABLED(LPC_SD_LCD)
#define ONBOARD_SD_CS_PIN P0_06 // Chip select for "System" SD card
#if SD_CONNECTION_IS(LCD)
#define SCK_PIN P0_07 // (52) system defined J3-9 & AUX-3
#define MISO_PIN P0_08 // (50) system defined J3-10 & AUX-3
#define MOSI_PIN P0_09 // (51) system defined J3-10 & AUX-3
#define SS_PIN P1_23 // (53) system defined J3-5 & AUX-3 (Sometimes called SDSS) - CS used by Marlin
#define ONBOARD_SD_CS P0_06 // Chip select for "System" SD card
#elif ENABLED(LPC_SD_ONBOARD)
#if ENABLED(USB_SD_ONBOARD)
// When sharing the SD card with a PC the LCD menu options are
// needed to mount/unmount and refresh SD. So disable SD detect.
#define SHARED_SD_CARD
#undef SD_DETECT_PIN // No SD detect pin for the onboard card
#endif
#elif SD_CONNECTION_IS(ONBOARD)
#undef SD_DETECT_PIN
#define SCK_PIN P0_07
#define MISO_PIN P0_08
#define MOSI_PIN P0_09
#define SS_PIN P0_06 // Chip select for SD card used by Marlin
#define ONBOARD_SD_CS P0_06 // Chip select for "System" SD card
#define SS_PIN ONBOARD_SD_CS_PIN
#elif SD_CONNECTION_IS(CUSTOM_CABLE)
#error "No custom SD drive cable defined for this board."
#endif
//

View File

@ -158,13 +158,13 @@
#define ENET_TXD0 P1_00 // J12-11
#define ENET_TXD1 P1_01 // J12-12
#if !ANY(LPC_SD_LCD, LPC_SD_ONBOARD, LPC_SD_CUSTOM_CABLE)
#undef USB_SD_DISABLED
#define USB_SD_ONBOARD
#define LPC_SD_ONBOARD
#ifndef SDARD_CONNECTION
#define SDCARD_CONNECTION ONBOARD
#endif
#if ENABLED(LPC_SD_CUSTOM_CABLE)
#define ONBOARD_SD_CS_PIN P0_06 // Chip select for "System" SD card
#if SD_CONNECTION_IS(CUSTOM_CABLE)
/**
* A custom cable is needed. See the README file in the
@ -182,37 +182,23 @@
#define SCK_PIN P1_22 // J8-2 (moved from EXP2 P0.7)
#define MISO_PIN P1_23 // J8-3 (moved from EXP2 P0.8)
#define MOSI_PIN P2_12 // J8-4 (moved from EXP2 P0.9)
#define SS_PIN P0_28 // Chip select for SD card used by Marlin
#define ONBOARD_SD_CS P0_06 // Chip select for "System" SD card
#define SS_PIN P0_28
#define LPC_SOFTWARE_SPI // With a custom cable we need software SPI because the
// selected pins are not on a hardware SPI controller
#elif ENABLED(LPC_SD_LCD)
#elif SD_CONNECTION_IS(LCD)
// use standard cable and header, SPI and SD detect sre shared with on-board SD card
// hardware SPI is used for both SD cards. The detect pin is shred between the
// LCD and onboard SD readers so we disable it.
#define SCK_PIN P0_07
#define MISO_PIN P0_08
#define MOSI_PIN P0_09
#define SS_PIN P0_28 // Chip select for SD card used by Marlin
#define ONBOARD_SD_CS P0_06 // Chip select for "System" SD card
#elif ENABLED(LPC_SD_ONBOARD)
// The external SD card is not used. Hardware SPI is used to access the card.
#if ENABLED(USB_SD_ONBOARD)
// When sharing the SD card with a PC we want the menu options to
// mount/unmount the card and refresh it. So we disable card detect.
#define SHARED_SD_CARD
#else
#define SD_DETECT_PIN P0_27
#endif
#define SS_PIN P0_28
#elif SD_CONNECTION_IS(ONBOARD)
#define SD_DETECT_PIN P0_27
#define SCK_PIN P0_07
#define MISO_PIN P0_08
#define MOSI_PIN P0_09
#define SS_PIN P0_06 // Chip select for SD card used by Marlin
#define ONBOARD_SD_CS P0_06 // Chip select for "System" SD card
#define SS_PIN ONBOARD_SD_CS_PIN
#endif
/**

View File

@ -413,35 +413,25 @@
//
// SD Support
//
#if !ANY(LPC_SD_LCD, LPC_SD_ONBOARD, LPC_SD_CUSTOM_CABLE)
#undef USB_SD_DISABLED
#define USB_SD_ONBOARD
#define LPC_SD_ONBOARD
#ifndef SDCARD_CONNECTION
#define SDCARD_CONNECTION ONBOARD
#endif
#if ENABLED(LPC_SD_LCD)
#define ONBOARD_SD_CS_PIN P0_06 // Chip select for "System" SD card
#if SD_CONNECTION_IS(LCD)
#define SCK_PIN P0_15 // (52) system defined J3-9 & AUX-3
#define MISO_PIN P0_17 // (50) system defined J3-10 & AUX-3
#define MOSI_PIN P0_18 // (51) system defined J3-10 & AUX-3
#define SS_PIN P1_23 // (53) system defined J3-5 & AUX-3 (Sometimes called SDSS) - CS used by Marlin
#define ONBOARD_SD_CS P0_06 // Chip select for "System" SD card
#elif ENABLED(LPC_SD_ONBOARD)
#if ENABLED(USB_SD_ONBOARD)
// When sharing the SD card with a PC we want the menu options to
// mount/unmount the card and refresh it. So we disable card detect.
#define SHARED_SD_CARD
#undef SD_DETECT_PIN // there is also no detect pin for the onboard card
#endif
#elif SD_CONNECTION_IS(ONBOARD)
#undef SD_DETECT_PIN
#define SCK_PIN P0_07
#define MISO_PIN P0_08
#define MOSI_PIN P0_09
#define SS_PIN P0_06 // Chip select for SD card used by Marlin
#define ONBOARD_SD_CS P0_06 // Chip select for "System" SD card
#define SS_PIN ONBOARD_SD_CS_PIN
#elif SD_CONNECTION_IS(CUSTOM_CABLE)
#error "No custom SD drive cable defined for this board."
#endif
/**