diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index d78657275b..c283c86dd5 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1823,16 +1823,6 @@ */ //#define SDSUPPORT -/** - * SD CARD: SPI SPEED - * - * Enable one of the following items for a slower SPI transfer speed. - * This may be required to resolve "volume init" errors. - */ -//#define SPI_SPEED SPI_HALF_SPEED -//#define SPI_SPEED SPI_QUARTER_SPEED -//#define SPI_SPEED SPI_EIGHTH_SPEED - /** * SD CARD: ENABLE CRC * diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 990eb05144..0a64764cae 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1182,6 +1182,16 @@ #endif #if ENABLED(SDSUPPORT) + /** + * SD Card SPI Speed + * May be required to resolve "volume init" errors. + * + * Enable and set to SPI_HALF_SPEED, SPI_QUARTER_SPEED, or SPI_EIGHTH_SPEED + * otherwise full speed will be applied. + * + * :['SPI_HALF_SPEED', 'SPI_QUARTER_SPEED', 'SPI_EIGHTH_SPEED'] + */ + //#define SD_SPI_SPEED SPI_HALF_SPEED // The standard SD detect circuit reads LOW when media is inserted and HIGH when empty. // Enable this option and set to HIGH if your SD cards are incorrectly detected. diff --git a/Marlin/src/HAL/AVR/HAL_SPI.cpp b/Marlin/src/HAL/AVR/HAL_SPI.cpp index 31e589746c..3e5572e559 100644 --- a/Marlin/src/HAL/AVR/HAL_SPI.cpp +++ b/Marlin/src/HAL/AVR/HAL_SPI.cpp @@ -34,17 +34,17 @@ #include "../../inc/MarlinConfig.h" void spiBegin() { - OUT_WRITE(SS_PIN, HIGH); - SET_OUTPUT(SCK_PIN); - SET_INPUT(MISO_PIN); - SET_OUTPUT(MOSI_PIN); + OUT_WRITE(SD_SS_PIN, HIGH); + SET_OUTPUT(SD_SCK_PIN); + SET_INPUT(SD_MISO_PIN); + SET_OUTPUT(SD_MOSI_PIN); #if DISABLED(SOFTWARE_SPI) // SS must be in output mode even it is not chip select - //SET_OUTPUT(SS_PIN); + //SET_OUTPUT(SD_SS_PIN); // set SS high - may be chip select for another SPI device //#if SET_SPI_SS_HIGH - //WRITE(SS_PIN, HIGH); + //WRITE(SD_SS_PIN, HIGH); //#endif // set a default rate spiInit(1); @@ -195,19 +195,19 @@ void spiBegin() { // no interrupts during byte receive - about 8µs cli(); // output pin high - like sending 0xFF - WRITE(MOSI_PIN, HIGH); + WRITE(SD_MOSI_PIN, HIGH); LOOP_L_N(i, 8) { - WRITE(SCK_PIN, HIGH); + WRITE(SD_SCK_PIN, HIGH); nop; // adjust so SCK is nice nop; data <<= 1; - if (READ(MISO_PIN)) data |= 1; + if (READ(SD_MISO_PIN)) data |= 1; - WRITE(SCK_PIN, LOW); + WRITE(SD_SCK_PIN, LOW); } sei(); @@ -225,10 +225,10 @@ void spiBegin() { // no interrupts during byte send - about 8µs cli(); LOOP_L_N(i, 8) { - WRITE(SCK_PIN, LOW); - WRITE(MOSI_PIN, data & 0x80); + WRITE(SD_SCK_PIN, LOW); + WRITE(SD_MOSI_PIN, data & 0x80); data <<= 1; - WRITE(SCK_PIN, HIGH); + WRITE(SD_SCK_PIN, HIGH); } nop; // hold SCK high for a few ns @@ -236,7 +236,7 @@ void spiBegin() { nop; nop; - WRITE(SCK_PIN, LOW); + WRITE(SD_SCK_PIN, LOW); sei(); } diff --git a/Marlin/src/HAL/AVR/spi_pins.h b/Marlin/src/HAL/AVR/spi_pins.h index f3fa78e2bf..831972938a 100644 --- a/Marlin/src/HAL/AVR/spi_pins.h +++ b/Marlin/src/HAL/AVR/spi_pins.h @@ -51,15 +51,15 @@ #define AVR_SS_PIN 16 #endif -#ifndef SCK_PIN - #define SCK_PIN AVR_SCK_PIN +#ifndef SD_SCK_PIN + #define SD_SCK_PIN AVR_SCK_PIN #endif -#ifndef MISO_PIN - #define MISO_PIN AVR_MISO_PIN +#ifndef SD_MISO_PIN + #define SD_MISO_PIN AVR_MISO_PIN #endif -#ifndef MOSI_PIN - #define MOSI_PIN AVR_MOSI_PIN +#ifndef SD_MOSI_PIN + #define SD_MOSI_PIN AVR_MOSI_PIN #endif -#ifndef SS_PIN - #define SS_PIN AVR_SS_PIN +#ifndef SD_SS_PIN + #define SD_SS_PIN AVR_SS_PIN #endif diff --git a/Marlin/src/HAL/DUE/HAL_SPI.cpp b/Marlin/src/HAL/DUE/HAL_SPI.cpp index 0451d8bcc4..342c373735 100644 --- a/Marlin/src/HAL/DUE/HAL_SPI.cpp +++ b/Marlin/src/HAL/DUE/HAL_SPI.cpp @@ -69,10 +69,10 @@ // run at ~8 .. ~10Mhz - Tx version (Rx data discarded) static uint8_t spiTransferTx0(uint8_t bout) { // using Mode 0 - uint32_t MOSI_PORT_PLUS30 = ((uint32_t) PORT(MOSI_PIN)) + 0x30; /* SODR of port */ - uint32_t MOSI_MASK = PIN_MASK(MOSI_PIN); - uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SCK_PIN)) + 0x30; /* SODR of port */ - uint32_t SCK_MASK = PIN_MASK(SCK_PIN); + uint32_t MOSI_PORT_PLUS30 = ((uint32_t) PORT(SD_MOSI_PIN)) + 0x30; /* SODR of port */ + uint32_t MOSI_MASK = PIN_MASK(SD_MOSI_PIN); + uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SD_SCK_PIN)) + 0x30; /* SODR of port */ + uint32_t SCK_MASK = PIN_MASK(SD_SCK_PIN); uint32_t idx = 0; /* Negate bout, as the assembler requires a negated value */ @@ -154,9 +154,9 @@ static uint8_t spiTransferRx0(uint8_t) { // using Mode 0 uint32_t bin = 0; uint32_t work = 0; - uint32_t BITBAND_MISO_PORT = BITBAND_ADDRESS( ((uint32_t)PORT(MISO_PIN))+0x3C, PIN_SHIFT(MISO_PIN)); /* PDSR of port in bitband area */ - uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SCK_PIN)) + 0x30; /* SODR of port */ - uint32_t SCK_MASK = PIN_MASK(SCK_PIN); + uint32_t BITBAND_MISO_PORT = BITBAND_ADDRESS( ((uint32_t)PORT(SD_MISO_PIN))+0x3C, PIN_SHIFT(SD_MISO_PIN)); /* PDSR of port in bitband area */ + uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SD_SCK_PIN)) + 0x30; /* SODR of port */ + uint32_t SCK_MASK = PIN_MASK(SD_SCK_PIN); /* The software SPI routine */ __asm__ __volatile__( @@ -225,15 +225,15 @@ static uint8_t spiTransfer1(uint8_t b) { // using Mode 0 int bits = 8; do { - WRITE(MOSI_PIN, b & 0x80); + WRITE(SD_MOSI_PIN, b & 0x80); b <<= 1; // little setup time - WRITE(SCK_PIN, HIGH); + WRITE(SD_SCK_PIN, HIGH); DELAY_NS(125); // 10 cycles @ 84mhz - b |= (READ(MISO_PIN) != 0); + b |= (READ(SD_MISO_PIN) != 0); - WRITE(SCK_PIN, LOW); + WRITE(SD_SCK_PIN, LOW); DELAY_NS(125); // 10 cycles @ 84mhz } while (--bits); return b; @@ -245,15 +245,15 @@ static uint8_t spiTransferX(uint8_t b) { // using Mode 0 int bits = 8; do { - WRITE(MOSI_PIN, b & 0x80); + WRITE(SD_MOSI_PIN, b & 0x80); b <<= 1; // little setup time - WRITE(SCK_PIN, HIGH); + WRITE(SD_SCK_PIN, HIGH); __delay_4cycles(spiDelayCyclesX4); - b |= (READ(MISO_PIN) != 0); + b |= (READ(SD_MISO_PIN) != 0); - WRITE(SCK_PIN, LOW); + WRITE(SD_SCK_PIN, LOW); __delay_4cycles(spiDelayCyclesX4); } while (--bits); return b; @@ -271,10 +271,10 @@ // Block transfers run at ~8 .. ~10Mhz - Tx version (Rx data discarded) static void spiTxBlock0(const uint8_t* ptr, uint32_t todo) { - uint32_t MOSI_PORT_PLUS30 = ((uint32_t) PORT(MOSI_PIN)) + 0x30; /* SODR of port */ - uint32_t MOSI_MASK = PIN_MASK(MOSI_PIN); - uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SCK_PIN)) + 0x30; /* SODR of port */ - uint32_t SCK_MASK = PIN_MASK(SCK_PIN); + uint32_t MOSI_PORT_PLUS30 = ((uint32_t) PORT(SD_MOSI_PIN)) + 0x30; /* SODR of port */ + uint32_t MOSI_MASK = PIN_MASK(SD_MOSI_PIN); + uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SD_SCK_PIN)) + 0x30; /* SODR of port */ + uint32_t SCK_MASK = PIN_MASK(SD_SCK_PIN); uint32_t work = 0; uint32_t txval = 0; @@ -352,9 +352,9 @@ static void spiRxBlock0(uint8_t* ptr, uint32_t todo) { uint32_t bin = 0; uint32_t work = 0; - uint32_t BITBAND_MISO_PORT = BITBAND_ADDRESS( ((uint32_t)PORT(MISO_PIN))+0x3C, PIN_SHIFT(MISO_PIN)); /* PDSR of port in bitband area */ - uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SCK_PIN)) + 0x30; /* SODR of port */ - uint32_t SCK_MASK = PIN_MASK(SCK_PIN); + uint32_t BITBAND_MISO_PORT = BITBAND_ADDRESS( ((uint32_t)PORT(SD_MISO_PIN))+0x3C, PIN_SHIFT(SD_MISO_PIN)); /* PDSR of port in bitband area */ + uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SD_SCK_PIN)) + 0x30; /* SODR of port */ + uint32_t SCK_MASK = PIN_MASK(SD_SCK_PIN); /* The software SPI routine */ __asm__ __volatile__( @@ -442,22 +442,22 @@ static pfnSpiRxBlock spiRxBlock = (pfnSpiRxBlock)spiRxBlockX; #if MB(ALLIGATOR) - #define _SS_WRITE(S) WRITE(SS_PIN, S) + #define _SS_WRITE(S) WRITE(SD_SS_PIN, S) #else #define _SS_WRITE(S) NOOP #endif void spiBegin() { - SET_OUTPUT(SS_PIN); + SET_OUTPUT(SD_SS_PIN); _SS_WRITE(HIGH); - SET_OUTPUT(SCK_PIN); - SET_INPUT(MISO_PIN); - SET_OUTPUT(MOSI_PIN); + SET_OUTPUT(SD_SCK_PIN); + SET_INPUT(SD_MISO_PIN); + SET_OUTPUT(SD_MOSI_PIN); } uint8_t spiRec() { _SS_WRITE(LOW); - WRITE(MOSI_PIN, HIGH); // Output 1s 1 + WRITE(SD_MOSI_PIN, HIGH); // Output 1s 1 uint8_t b = spiTransferRx(0xFF); _SS_WRITE(HIGH); return b; @@ -466,7 +466,7 @@ void spiRead(uint8_t* buf, uint16_t nbyte) { if (nbyte) { _SS_WRITE(LOW); - WRITE(MOSI_PIN, HIGH); // Output 1s 1 + WRITE(SD_MOSI_PIN, HIGH); // Output 1s 1 spiRxBlock(buf, nbyte); _SS_WRITE(HIGH); } @@ -519,8 +519,8 @@ } _SS_WRITE(HIGH); - WRITE(MOSI_PIN, HIGH); - WRITE(SCK_PIN, LOW); + WRITE(SD_MOSI_PIN, HIGH); + WRITE(SD_SCK_PIN, LOW); } /** Begin SPI transaction, set clock, bit order, data mode */ @@ -575,20 +575,20 @@ // Configure SPI pins PIO_Configure( - g_APinDescription[SCK_PIN].pPort, - g_APinDescription[SCK_PIN].ulPinType, - g_APinDescription[SCK_PIN].ulPin, - g_APinDescription[SCK_PIN].ulPinConfiguration); + g_APinDescription[SD_SCK_PIN].pPort, + g_APinDescription[SD_SCK_PIN].ulPinType, + g_APinDescription[SD_SCK_PIN].ulPin, + g_APinDescription[SD_SCK_PIN].ulPinConfiguration); PIO_Configure( - g_APinDescription[MOSI_PIN].pPort, - g_APinDescription[MOSI_PIN].ulPinType, - g_APinDescription[MOSI_PIN].ulPin, - g_APinDescription[MOSI_PIN].ulPinConfiguration); + g_APinDescription[SD_MOSI_PIN].pPort, + g_APinDescription[SD_MOSI_PIN].ulPinType, + g_APinDescription[SD_MOSI_PIN].ulPin, + g_APinDescription[SD_MOSI_PIN].ulPinConfiguration); PIO_Configure( - g_APinDescription[MISO_PIN].pPort, - g_APinDescription[MISO_PIN].ulPinType, - g_APinDescription[MISO_PIN].ulPin, - g_APinDescription[MISO_PIN].ulPinConfiguration); + g_APinDescription[SD_MISO_PIN].pPort, + g_APinDescription[SD_MISO_PIN].ulPinType, + g_APinDescription[SD_MISO_PIN].ulPin, + g_APinDescription[SD_MISO_PIN].ulPinConfiguration); // set master mode, peripheral select, fault detection SPI_Configure(SPI0, ID_SPI0, SPI_MR_MSTR | SPI_MR_MODFDIS | SPI_MR_PS); @@ -606,7 +606,7 @@ WRITE(SPI_EEPROM1_CS, HIGH); WRITE(SPI_EEPROM2_CS, HIGH); WRITE(SPI_FLASH_CS, HIGH); - WRITE(SS_PIN, HIGH); + WRITE(SD_SS_PIN, HIGH); OUT_WRITE(SDSS, LOW); diff --git a/Marlin/src/HAL/DUE/inc/SanityCheck.h b/Marlin/src/HAL/DUE/inc/SanityCheck.h index 6880696506..26fb44f398 100644 --- a/Marlin/src/HAL/DUE/inc/SanityCheck.h +++ b/Marlin/src/HAL/DUE/inc/SanityCheck.h @@ -40,7 +40,7 @@ * Usually the hardware SPI pins are only available to the LCD. This makes the DUE hard SPI used at the same time * as the TMC2130 soft SPI the most common setup. */ -#define _IS_HW_SPI(P) (defined(TMC_SW_##P) && (TMC_SW_##P == MOSI_PIN || TMC_SW_##P == MISO_PIN || TMC_SW_##P == SCK_PIN)) +#define _IS_HW_SPI(P) (defined(TMC_SW_##P) && (TMC_SW_##P == SD_MOSI_PIN || TMC_SW_##P == SD_MISO_PIN || TMC_SW_##P == SD_SCK_PIN)) #if ENABLED(SDSUPPORT) && HAS_DRIVER(TMC2130) #if ENABLED(TMC_USE_SW_SPI) diff --git a/Marlin/src/HAL/DUE/spi_pins.h b/Marlin/src/HAL/DUE/spi_pins.h index e28eaf8270..cec22c2c37 100644 --- a/Marlin/src/HAL/DUE/spi_pins.h +++ b/Marlin/src/HAL/DUE/spi_pins.h @@ -43,22 +43,22 @@ #define SPI_PIN 87 #define SPI_CHAN 1 #endif - #define SCK_PIN 76 - #define MISO_PIN 74 - #define MOSI_PIN 75 + #define SD_SCK_PIN 76 + #define SD_MISO_PIN 74 + #define SD_MOSI_PIN 75 #else // defaults #define DUE_SOFTWARE_SPI - #ifndef SCK_PIN - #define SCK_PIN 52 + #ifndef SD_SCK_PIN + #define SD_SCK_PIN 52 #endif - #ifndef MISO_PIN - #define MISO_PIN 50 + #ifndef SD_MISO_PIN + #define SD_MISO_PIN 50 #endif - #ifndef MOSI_PIN - #define MOSI_PIN 51 + #ifndef SD_MOSI_PIN + #define SD_MOSI_PIN 51 #endif #endif /* A.28, A.29, B.21, C.26, C.29 */ -#define SS_PIN SDSS +#define SD_SS_PIN SDSS diff --git a/Marlin/src/HAL/ESP32/HAL_SPI.cpp b/Marlin/src/HAL/ESP32/HAL_SPI.cpp index 8e5875fc38..8ee837ba15 100644 --- a/Marlin/src/HAL/ESP32/HAL_SPI.cpp +++ b/Marlin/src/HAL/ESP32/HAL_SPI.cpp @@ -53,11 +53,11 @@ static SPISettings spiConfig; // ------------------------ void spiBegin() { - #if !PIN_EXISTS(SS) - #error "SS_PIN not defined!" + #if !PIN_EXISTS(SD_SS) + #error "SD_SS_PIN not defined!" #endif - OUT_WRITE(SS_PIN, HIGH); + OUT_WRITE(SD_SS_PIN, HIGH); } void spiInit(uint8_t spiRate) { diff --git a/Marlin/src/HAL/ESP32/spi_pins.h b/Marlin/src/HAL/ESP32/spi_pins.h index 15f8f2ab6b..cfe71eee4a 100644 --- a/Marlin/src/HAL/ESP32/spi_pins.h +++ b/Marlin/src/HAL/ESP32/spi_pins.h @@ -18,7 +18,7 @@ */ #pragma once -#define SS_PIN SDSS -#define SCK_PIN 18 -#define MISO_PIN 19 -#define MOSI_PIN 23 +#define SD_SS_PIN SDSS +#define SD_SCK_PIN 18 +#define SD_MISO_PIN 19 +#define SD_MOSI_PIN 23 diff --git a/Marlin/src/HAL/LINUX/spi_pins.h b/Marlin/src/HAL/LINUX/spi_pins.h index 01ba28e5b6..33136ac9dd 100644 --- a/Marlin/src/HAL/LINUX/spi_pins.h +++ b/Marlin/src/HAL/LINUX/spi_pins.h @@ -24,31 +24,32 @@ #include "../../core/macros.h" #include "../../inc/MarlinConfigPre.h" -#if BOTH(HAS_MARLINUI_U8GLIB, SDSUPPORT) && (LCD_PINS_D4 == SCK_PIN || LCD_PINS_ENABLE == MOSI_PIN || DOGLCD_SCK == SCK_PIN || DOGLCD_MOSI == MOSI_PIN) +#if BOTH(HAS_MARLINUI_U8GLIB, SDSUPPORT) && (LCD_PINS_D4 == SD_SCK_PIN || LCD_PINS_ENABLE == SD_MOSI_PIN || DOGLCD_SCK == SD_SCK_PIN || DOGLCD_MOSI == SD_MOSI_PIN) #define LPC_SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently // needed due to the speed and mode required for communicating with each device being different. // This requirement can be removed if the SPI access to these devices is updated to use // spiBeginTransaction. #endif -/** onboard SD card */ -//#define SCK_PIN P0_07 -//#define MISO_PIN P0_08 -//#define MOSI_PIN P0_09 -//#define SS_PIN P0_06 -/** external */ -#ifndef SCK_PIN - #define SCK_PIN 50 +// Onboard SD +//#define SD_SCK_PIN P0_07 +//#define SD_MISO_PIN P0_08 +//#define SD_MOSI_PIN P0_09 +//#define SD_SS_PIN P0_06 + +// External SD +#ifndef SD_SCK_PIN + #define SD_SCK_PIN 50 #endif -#ifndef MISO_PIN - #define MISO_PIN 51 +#ifndef SD_MISO_PIN + #define SD_MISO_PIN 51 #endif -#ifndef MOSI_PIN - #define MOSI_PIN 52 +#ifndef SD_MOSI_PIN + #define SD_MOSI_PIN 52 #endif -#ifndef SS_PIN - #define SS_PIN 53 +#ifndef SD_SS_PIN + #define SD_SS_PIN 53 #endif #ifndef SDSS - #define SDSS SS_PIN + #define SDSS SD_SS_PIN #endif diff --git a/Marlin/src/HAL/LPC1768/HAL_SPI.cpp b/Marlin/src/HAL/LPC1768/HAL_SPI.cpp index 16ac789fc0..dbc89a33f5 100644 --- a/Marlin/src/HAL/LPC1768/HAL_SPI.cpp +++ b/Marlin/src/HAL/LPC1768/HAL_SPI.cpp @@ -55,27 +55,33 @@ #include #include +#include "../shared/HAL_SPI.h" + // ------------------------ // Public functions // ------------------------ #if ENABLED(LPC_SOFTWARE_SPI) - #include - // Software SPI - static uint8_t SPI_speed = 0; + #include + + #ifndef HAL_SPI_SPEED + #define HAL_SPI_SPEED SPI_FULL_SPEED + #endif + + static uint8_t SPI_speed = HAL_SPI_SPEED; static uint8_t spiTransfer(uint8_t b) { - return swSpiTransfer(b, SPI_speed, SCK_PIN, MISO_PIN, MOSI_PIN); + return swSpiTransfer(b, SPI_speed, SD_SCK_PIN, SD_MISO_PIN, SD_MOSI_PIN); } void spiBegin() { - swSpiBegin(SCK_PIN, MISO_PIN, MOSI_PIN); + swSpiBegin(SD_SCK_PIN, SD_MISO_PIN, SD_MOSI_PIN); } void spiInit(uint8_t spiRate) { - SPI_speed = swSpiInit(spiRate, SCK_PIN, MOSI_PIN); + SPI_speed = swSpiInit(spiRate, SD_SCK_PIN, SD_MOSI_PIN); } uint8_t spiRec() { return spiTransfer(0xFF); } @@ -100,14 +106,20 @@ #else - void spiBegin() { // setup SCK, MOSI & MISO pins for SSP0 - spiInit(SPI_SPEED); - } + #ifndef HAL_SPI_SPEED + #ifdef SD_SPI_SPEED + #define HAL_SPI_SPEED SD_SPI_SPEED + #else + #define HAL_SPI_SPEED SPI_FULL_SPEED + #endif + #endif + + void spiBegin() { spiInit(HAL_SPI_SPEED); } // Set up SCK, MOSI & MISO pins for SSP0 void spiInit(uint8_t spiRate) { - #if MISO_PIN == BOARD_SPI1_MISO_PIN + #if SD_MISO_PIN == BOARD_SPI1_MISO_PIN SPI.setModule(1); - #elif MISO_PIN == BOARD_SPI2_MISO_PIN + #elif SD_MISO_PIN == BOARD_SPI2_MISO_PIN SPI.setModule(2); #endif SPI.setDataSize(DATA_SIZE_8BIT); @@ -150,10 +162,9 @@ (void)spiTransfer(buf[i]); } - /** Begin SPI transaction, set clock, bit order, data mode */ + // Begin SPI transaction, set clock, bit order, data mode void spiBeginTransaction(uint32_t spiClock, uint8_t bitOrder, uint8_t dataMode) { - // TODO: to be implemented - + // TODO: Implement this method } #endif // LPC_SOFTWARE_SPI @@ -392,9 +403,9 @@ void SPIClass::updateSettings() { SSP_Init(_currentSetting->spi_d, &HW_SPI_init); // puts the values into the proper bits in the SSP0 registers } -#if MISO_PIN == BOARD_SPI1_MISO_PIN +#if SD_MISO_PIN == BOARD_SPI1_MISO_PIN SPIClass SPI(1); -#elif MISO_PIN == BOARD_SPI2_MISO_PIN +#elif SD_MISO_PIN == BOARD_SPI2_MISO_PIN SPIClass SPI(2); #endif diff --git a/Marlin/src/HAL/LPC1768/inc/SanityCheck.h b/Marlin/src/HAL/LPC1768/inc/SanityCheck.h index 06e060d93a..11b8761550 100644 --- a/Marlin/src/HAL/LPC1768/inc/SanityCheck.h +++ b/Marlin/src/HAL/LPC1768/inc/SanityCheck.h @@ -116,8 +116,8 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o #elif HAS_WIRED_LCD #if IS_TX1(BTN_EN2) || IS_RX1(BTN_EN1) #error "Serial port pins (1) conflict with Encoder Buttons!" - #elif ANY_TX(1, SCK_PIN, LCD_PINS_D4, DOGLCD_SCK, LCD_RESET_PIN, LCD_PINS_RS, SHIFT_CLK) \ - || ANY_RX(1, LCD_SDSS, LCD_PINS_RS, MISO_PIN, DOGLCD_A0, SS_PIN, LCD_SDSS, DOGLCD_CS, LCD_RESET_PIN, LCD_BACKLIGHT_PIN) + #elif ANY_TX(1, SD_SCK_PIN, LCD_PINS_D4, DOGLCD_SCK, LCD_RESET_PIN, LCD_PINS_RS, SHIFT_CLK) \ + || ANY_RX(1, LCD_SDSS, LCD_PINS_RS, SD_MISO_PIN, DOGLCD_A0, SD_SS_PIN, LCD_SDSS, DOGLCD_CS, LCD_RESET_PIN, LCD_BACKLIGHT_PIN) #error "Serial port pins (1) conflict with LCD pins!" #endif #endif @@ -205,8 +205,8 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o #error "SDA0 overlaps with BEEPER_PIN!" #elif IS_SCL0(BTN_ENC) #error "SCL0 overlaps with Encoder Button!" - #elif IS_SCL0(SS_PIN) - #error "SCL0 overlaps with SS_PIN!" + #elif IS_SCL0(SD_SS_PIN) + #error "SCL0 overlaps with SD_SS_PIN!" #elif IS_SCL0(LCD_SDSS) #error "SCL0 overlaps with LCD_SDSS!" #endif diff --git a/Marlin/src/HAL/LPC1768/main.cpp b/Marlin/src/HAL/LPC1768/main.cpp index 96faf54d7f..f41a576376 100644 --- a/Marlin/src/HAL/LPC1768/main.cpp +++ b/Marlin/src/HAL/LPC1768/main.cpp @@ -90,11 +90,11 @@ void HAL_init() { //debug_frmwrk_init(); //_DBG("\n\nDebug running\n"); // Initialize the SD card chip select pins as soon as possible - #if PIN_EXISTS(SS) - OUT_WRITE(SS_PIN, HIGH); + #if PIN_EXISTS(SD_SS) + OUT_WRITE(SD_SS_PIN, HIGH); #endif - #if PIN_EXISTS(ONBOARD_SD_CS) && ONBOARD_SD_CS_PIN != SS_PIN + #if PIN_EXISTS(ONBOARD_SD_CS) && ONBOARD_SD_CS_PIN != SD_SS_PIN OUT_WRITE(ONBOARD_SD_CS_PIN, HIGH); #endif diff --git a/Marlin/src/HAL/LPC1768/spi_pins.h b/Marlin/src/HAL/LPC1768/spi_pins.h index b4da5d4df2..e7d774742f 100644 --- a/Marlin/src/HAL/LPC1768/spi_pins.h +++ b/Marlin/src/HAL/LPC1768/spi_pins.h @@ -23,7 +23,7 @@ #include "../../core/macros.h" -#if BOTH(SDSUPPORT, HAS_MARLINUI_U8GLIB) && (LCD_PINS_D4 == SCK_PIN || LCD_PINS_ENABLE == MOSI_PIN || DOGLCD_SCK == SCK_PIN || DOGLCD_MOSI == MOSI_PIN) +#if BOTH(SDSUPPORT, HAS_MARLINUI_U8GLIB) && (LCD_PINS_D4 == SD_SCK_PIN || LCD_PINS_ENABLE == SD_MOSI_PIN || DOGLCD_SCK == SD_SCK_PIN || DOGLCD_MOSI == SD_MOSI_PIN) #define LPC_SOFTWARE_SPI // If the SD card and LCD adapter share the same SPI pins, then software SPI is currently // needed due to the speed and mode required for communicating with each device being different. // This requirement can be removed if the SPI access to these devices is updated to use @@ -31,24 +31,24 @@ #endif /** onboard SD card */ -//#define SCK_PIN P0_07 -//#define MISO_PIN P0_08 -//#define MOSI_PIN P0_09 -//#define SS_PIN P0_06 +//#define SD_SCK_PIN P0_07 +//#define SD_MISO_PIN P0_08 +//#define SD_MOSI_PIN P0_09 +//#define SD_SS_PIN P0_06 /** external */ -#ifndef SCK_PIN - #define SCK_PIN P0_15 +#ifndef SD_SCK_PIN + #define SD_SCK_PIN P0_15 #endif -#ifndef MISO_PIN - #define MISO_PIN P0_17 +#ifndef SD_MISO_PIN + #define SD_MISO_PIN P0_17 #endif -#ifndef MOSI_PIN - #define MOSI_PIN P0_18 +#ifndef SD_MOSI_PIN + #define SD_MOSI_PIN P0_18 #endif -#ifndef SS_PIN - #define SS_PIN P1_23 +#ifndef SD_SS_PIN + #define SD_SS_PIN P1_23 #endif #if !defined(SDSS) || SDSS == P_NC // gets defaulted in pins.h #undef SDSS - #define SDSS SS_PIN + #define SDSS SD_SS_PIN #endif diff --git a/Marlin/src/HAL/LPC1768/tft/xpt2046.h b/Marlin/src/HAL/LPC1768/tft/xpt2046.h index 223985f3d2..65602bda0f 100644 --- a/Marlin/src/HAL/LPC1768/tft/xpt2046.h +++ b/Marlin/src/HAL/LPC1768/tft/xpt2046.h @@ -28,16 +28,16 @@ #endif #ifndef TOUCH_MISO_PIN - #define TOUCH_MISO_PIN MISO_PIN + #define TOUCH_MISO_PIN SD_MISO_PIN #endif #ifndef TOUCH_MOSI_PIN - #define TOUCH_MOSI_PIN MOSI_PIN + #define TOUCH_MOSI_PIN SD_MOSI_PIN #endif #ifndef TOUCH_SCK_PIN - #define TOUCH_SCK_PIN SCK_PIN + #define TOUCH_SCK_PIN SD_SCK_PIN #endif #ifndef TOUCH_CS_PIN - #define TOUCH_CS_PIN SS_PIN + #define TOUCH_CS_PIN SD_SS_PIN #endif #ifndef TOUCH_INT_PIN #define TOUCH_INT_PIN -1 diff --git a/Marlin/src/HAL/LPC1768/u8g/u8g_com_HAL_LPC1768_hw_spi.cpp b/Marlin/src/HAL/LPC1768/u8g/u8g_com_HAL_LPC1768_hw_spi.cpp index 057e10e0f5..b1eea13d57 100644 --- a/Marlin/src/HAL/LPC1768/u8g/u8g_com_HAL_LPC1768_hw_spi.cpp +++ b/Marlin/src/HAL/LPC1768/u8g/u8g_com_HAL_LPC1768_hw_spi.cpp @@ -62,10 +62,13 @@ #include #include "../../shared/HAL_SPI.h" -void spiBegin(); -void spiInit(uint8_t spiRate); -void spiSend(uint8_t b); -void spiSend(const uint8_t* buf, size_t n); +#ifndef LCD_SPI_SPEED + #ifdef SD_SPI_SPEED + #define LCD_SPI_SPEED SD_SPI_SPEED // Assume SPI speed shared with SD + #else + #define LCD_SPI_SPEED SPI_FULL_SPEED // Use full speed if SD speed is not supplied + #endif +#endif uint8_t u8g_com_HAL_LPC1768_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) { switch (msg) { @@ -81,10 +84,7 @@ uint8_t u8g_com_HAL_LPC1768_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, u8g_SetPIOutput(u8g, U8G_PI_RESET); u8g_Delay(5); spiBegin(); - #ifndef SPI_SPEED - #define SPI_SPEED SPI_FULL_SPEED // use same SPI speed as SD card - #endif - spiInit(SPI_SPEED); + spiInit(LCD_SPI_SPEED); break; case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */ diff --git a/Marlin/src/HAL/SAMD51/spi_pins.h b/Marlin/src/HAL/SAMD51/spi_pins.h index 5a9b1275ef..2a667bcaa1 100644 --- a/Marlin/src/HAL/SAMD51/spi_pins.h +++ b/Marlin/src/HAL/SAMD51/spi_pins.h @@ -30,16 +30,16 @@ * SPI | 53 52 50 51 | * SPI1 | 83 81 80 82 | * +-------------------------+ - * Any pin can be used for Chip Select (SS_PIN) + * Any pin can be used for Chip Select (SD_SS_PIN) */ - #ifndef SCK_PIN - #define SCK_PIN 52 + #ifndef SD_SCK_PIN + #define SD_SCK_PIN 52 #endif - #ifndef MISO_PIN - #define MISO_PIN 50 + #ifndef SD_MISO_PIN + #define SD_MISO_PIN 50 #endif - #ifndef MOSI_PIN - #define MOSI_PIN 51 + #ifndef SD_MOSI_PIN + #define SD_MOSI_PIN 51 #endif #ifndef SDSS #define SDSS 53 @@ -51,4 +51,4 @@ #endif -#define SS_PIN SDSS +#define SD_SS_PIN SDSS diff --git a/Marlin/src/HAL/STM32/HAL_SPI.cpp b/Marlin/src/HAL/STM32/HAL_SPI.cpp index d79f72cad2..eef480777b 100644 --- a/Marlin/src/HAL/STM32/HAL_SPI.cpp +++ b/Marlin/src/HAL/STM32/HAL_SPI.cpp @@ -45,10 +45,10 @@ static SPISettings spiConfig; #include "../shared/Delay.h" void spiBegin(void) { - OUT_WRITE(SS_PIN, HIGH); - OUT_WRITE(SCK_PIN, HIGH); - SET_INPUT(MISO_PIN); - OUT_WRITE(MOSI_PIN, HIGH); + OUT_WRITE(SD_SS_PIN, HIGH); + OUT_WRITE(SD_SCK_PIN, HIGH); + SET_INPUT(SD_MISO_PIN); + OUT_WRITE(SD_MOSI_PIN, HIGH); } static uint16_t delay_STM32_soft_spi; @@ -72,15 +72,15 @@ static SPISettings spiConfig; uint8_t HAL_SPI_STM32_SpiTransfer_Mode_3(uint8_t b) { // using Mode 3 for (uint8_t bits = 8; bits--;) { - WRITE(SCK_PIN, LOW); - WRITE(MOSI_PIN, b & 0x80); + WRITE(SD_SCK_PIN, LOW); + WRITE(SD_MOSI_PIN, b & 0x80); DELAY_NS(delay_STM32_soft_spi); - WRITE(SCK_PIN, HIGH); + WRITE(SD_SCK_PIN, HIGH); DELAY_NS(delay_STM32_soft_spi); b <<= 1; // little setup time - b |= (READ(MISO_PIN) != 0); + b |= (READ(SD_MISO_PIN) != 0); } DELAY_NS(125); return b; @@ -132,8 +132,8 @@ static SPISettings spiConfig; * @details Only configures SS pin since stm32duino creates and initialize the SPI object */ void spiBegin() { - #if PIN_EXISTS(SS) - OUT_WRITE(SS_PIN, HIGH); + #if PIN_EXISTS(SD_SS) + OUT_WRITE(SD_SS_PIN, HIGH); #endif } @@ -154,9 +154,9 @@ static SPISettings spiConfig; spiConfig = SPISettings(clock, MSBFIRST, SPI_MODE0); #if ENABLED(CUSTOM_SPI_PINS) - SPI.setMISO(MISO_PIN); - SPI.setMOSI(MOSI_PIN); - SPI.setSCLK(SCK_PIN); + SPI.setMISO(SD_MISO_PIN); + SPI.setMOSI(SD_MOSI_PIN); + SPI.setSCLK(SD_SCK_PIN); #endif SPI.begin(); diff --git a/Marlin/src/HAL/STM32/spi_pins.h b/Marlin/src/HAL/STM32/spi_pins.h index 176e2a7b20..e2052c5c77 100644 --- a/Marlin/src/HAL/STM32/spi_pins.h +++ b/Marlin/src/HAL/STM32/spi_pins.h @@ -21,15 +21,15 @@ /** * Define SPI Pins: SCK, MISO, MOSI, SS */ -#ifndef SCK_PIN - #define SCK_PIN PIN_SPI_SCK +#ifndef SD_SCK_PIN + #define SD_SCK_PIN PIN_SPI_SCK #endif -#ifndef MISO_PIN - #define MISO_PIN PIN_SPI_MISO +#ifndef SD_MISO_PIN + #define SD_MISO_PIN PIN_SPI_MISO #endif -#ifndef MOSI_PIN - #define MOSI_PIN PIN_SPI_MOSI +#ifndef SD_MOSI_PIN + #define SD_MOSI_PIN PIN_SPI_MOSI #endif -#ifndef SS_PIN - #define SS_PIN PIN_SPI_SS +#ifndef SD_SS_PIN + #define SD_SS_PIN PIN_SPI_SS #endif diff --git a/Marlin/src/HAL/STM32F1/HAL_SPI.cpp b/Marlin/src/HAL/STM32F1/HAL_SPI.cpp index 76b1c3e246..7e876f765f 100644 --- a/Marlin/src/HAL/STM32F1/HAL_SPI.cpp +++ b/Marlin/src/HAL/STM32F1/HAL_SPI.cpp @@ -61,8 +61,8 @@ * @details Only configures SS pin since libmaple creates and initialize the SPI object */ void spiBegin() { - #if PIN_EXISTS(SS) - OUT_WRITE(SS_PIN, HIGH); + #if PIN_EXISTS(SD_SS) + OUT_WRITE(SD_SS_PIN, HIGH); #endif } diff --git a/Marlin/src/HAL/STM32F1/spi_pins.h b/Marlin/src/HAL/STM32F1/spi_pins.h index 59ac446410..7d650ffe37 100644 --- a/Marlin/src/HAL/STM32F1/spi_pins.h +++ b/Marlin/src/HAL/STM32F1/spi_pins.h @@ -31,23 +31,23 @@ * SPI2 | PB12 PB13 PB14 PB15 | * SPI3 | PA15 PB3 PB4 PB5 | * +-----------------------------+ - * Any pin can be used for Chip Select (SS_PIN) + * Any pin can be used for Chip Select (SD_SS_PIN) * SPI1 is enabled by default */ -#ifndef SCK_PIN - #define SCK_PIN PA5 +#ifndef SD_SCK_PIN + #define SD_SCK_PIN PA5 #endif -#ifndef MISO_PIN - #define MISO_PIN PA6 +#ifndef SD_MISO_PIN + #define SD_MISO_PIN PA6 #endif -#ifndef MOSI_PIN - #define MOSI_PIN PA7 +#ifndef SD_MOSI_PIN + #define SD_MOSI_PIN PA7 #endif -#ifndef SS_PIN - #define SS_PIN PA4 +#ifndef SD_SS_PIN + #define SD_SS_PIN PA4 #endif #undef SDSS -#define SDSS SS_PIN +#define SDSS SD_SS_PIN #ifndef SPI_DEVICE #define SPI_DEVICE 1 diff --git a/Marlin/src/HAL/STM32F1/tft/xpt2046.h b/Marlin/src/HAL/STM32F1/tft/xpt2046.h index 223985f3d2..65602bda0f 100644 --- a/Marlin/src/HAL/STM32F1/tft/xpt2046.h +++ b/Marlin/src/HAL/STM32F1/tft/xpt2046.h @@ -28,16 +28,16 @@ #endif #ifndef TOUCH_MISO_PIN - #define TOUCH_MISO_PIN MISO_PIN + #define TOUCH_MISO_PIN SD_MISO_PIN #endif #ifndef TOUCH_MOSI_PIN - #define TOUCH_MOSI_PIN MOSI_PIN + #define TOUCH_MOSI_PIN SD_MOSI_PIN #endif #ifndef TOUCH_SCK_PIN - #define TOUCH_SCK_PIN SCK_PIN + #define TOUCH_SCK_PIN SD_SCK_PIN #endif #ifndef TOUCH_CS_PIN - #define TOUCH_CS_PIN SS_PIN + #define TOUCH_CS_PIN SD_SS_PIN #endif #ifndef TOUCH_INT_PIN #define TOUCH_INT_PIN -1 diff --git a/Marlin/src/HAL/TEENSY31_32/HAL_SPI.cpp b/Marlin/src/HAL/TEENSY31_32/HAL_SPI.cpp index cdb3f4701c..dce236ef6b 100644 --- a/Marlin/src/HAL/TEENSY31_32/HAL_SPI.cpp +++ b/Marlin/src/HAL/TEENSY31_32/HAL_SPI.cpp @@ -35,18 +35,18 @@ static SPISettings spiConfig; // Initialize SPI bus void spiBegin() { - #if !PIN_EXISTS(SS) - #error "SS_PIN not defined!" + #if !PIN_EXISTS(SD_SS) + #error "SD_SS_PIN not defined!" #endif - OUT_WRITE(SS_PIN, HIGH); - SET_OUTPUT(SCK_PIN); - SET_INPUT(MISO_PIN); - SET_OUTPUT(MOSI_PIN); + OUT_WRITE(SD_SS_PIN, HIGH); + SET_OUTPUT(SD_SCK_PIN); + SET_INPUT(SD_MISO_PIN); + SET_OUTPUT(SD_MOSI_PIN); #if 0 && DISABLED(SOFTWARE_SPI) // set SS high - may be chip select for another SPI device #if SET_SPI_SS_HIGH - WRITE(SS_PIN, HIGH); + WRITE(SD_SS_PIN, HIGH); #endif // set a default rate spiInit(SPI_HALF_SPEED); // 1 diff --git a/Marlin/src/HAL/TEENSY31_32/spi_pins.h b/Marlin/src/HAL/TEENSY31_32/spi_pins.h index 5754fbfeed..6d0d05f85a 100644 --- a/Marlin/src/HAL/TEENSY31_32/spi_pins.h +++ b/Marlin/src/HAL/TEENSY31_32/spi_pins.h @@ -21,7 +21,7 @@ */ #pragma once -#define SCK_PIN 13 -#define MISO_PIN 12 -#define MOSI_PIN 11 -#define SS_PIN 20 //SDSS // A.28, A.29, B.21, C.26, C.29 +#define SD_SCK_PIN 13 +#define SD_MISO_PIN 12 +#define SD_MOSI_PIN 11 +#define SD_SS_PIN 20 // SDSS // A.28, A.29, B.21, C.26, C.29 diff --git a/Marlin/src/HAL/TEENSY35_36/HAL_SPI.cpp b/Marlin/src/HAL/TEENSY35_36/HAL_SPI.cpp index b36900a321..84852cd358 100644 --- a/Marlin/src/HAL/TEENSY35_36/HAL_SPI.cpp +++ b/Marlin/src/HAL/TEENSY35_36/HAL_SPI.cpp @@ -35,18 +35,18 @@ static SPISettings spiConfig; void spiBegin() { - #if !PIN_EXISTS(SS) - #error "SS_PIN not defined!" + #if !PIN_EXISTS(SD_SS) + #error "SD_SS_PIN not defined!" #endif - OUT_WRITE(SS_PIN, HIGH); - SET_OUTPUT(SCK_PIN); - SET_INPUT(MISO_PIN); - SET_OUTPUT(MOSI_PIN); + OUT_WRITE(SD_SS_PIN, HIGH); + SET_OUTPUT(SD_SCK_PIN); + SET_INPUT(SD_MISO_PIN); + SET_OUTPUT(SD_MOSI_PIN); #if 0 && DISABLED(SOFTWARE_SPI) // set SS high - may be chip select for another SPI device #if SET_SPI_SS_HIGH - WRITE(SS_PIN, HIGH); + WRITE(SD_SS_PIN, HIGH); #endif // set a default rate spiInit(SPI_HALF_SPEED); // 1 diff --git a/Marlin/src/HAL/TEENSY35_36/spi_pins.h b/Marlin/src/HAL/TEENSY35_36/spi_pins.h index c76344d075..cfffdc9325 100644 --- a/Marlin/src/HAL/TEENSY35_36/spi_pins.h +++ b/Marlin/src/HAL/TEENSY35_36/spi_pins.h @@ -25,7 +25,7 @@ * HAL SPI Pins for Teensy 3.5 (MK64FX512) and Teensy 3.6 (MK66FX1M0) */ -#define SCK_PIN 13 -#define MISO_PIN 12 -#define MOSI_PIN 11 -#define SS_PIN 20 // SDSS // A.28, A.29, B.21, C.26, C.29 +#define SD_SCK_PIN 13 +#define SD_MISO_PIN 12 +#define SD_MOSI_PIN 11 +#define SD_SS_PIN 20 // SDSS // A.28, A.29, B.21, C.26, C.29 diff --git a/Marlin/src/HAL/TEENSY40_41/HAL_SPI.cpp b/Marlin/src/HAL/TEENSY40_41/HAL_SPI.cpp index 20b472aa35..8c93049027 100644 --- a/Marlin/src/HAL/TEENSY40_41/HAL_SPI.cpp +++ b/Marlin/src/HAL/TEENSY40_41/HAL_SPI.cpp @@ -50,20 +50,20 @@ static SPISettings spiConfig; // ------------------------ void spiBegin() { - #ifndef SS_PIN - #error "SS_PIN is not defined!" + #ifndef SD_SS_PIN + #error "SD_SS_PIN is not defined!" #endif - OUT_WRITE(SS_PIN, HIGH); + OUT_WRITE(SD_SS_PIN, HIGH); - //SET_OUTPUT(SCK_PIN); - //SET_INPUT(MISO_PIN); - //SET_OUTPUT(MOSI_PIN); + //SET_OUTPUT(SD_SCK_PIN); + //SET_INPUT(SD_MISO_PIN); + //SET_OUTPUT(SD_MOSI_PIN); #if 0 && DISABLED(SOFTWARE_SPI) // set SS high - may be chip select for another SPI device #if SET_SPI_SS_HIGH - WRITE(SS_PIN, HIGH); + WRITE(SD_SS_PIN, HIGH); #endif // set a default rate spiInit(SPI_HALF_SPEED); // 1 diff --git a/Marlin/src/HAL/TEENSY40_41/spi_pins.h b/Marlin/src/HAL/TEENSY40_41/spi_pins.h index d6f8d41bf6..ba4a2c700a 100644 --- a/Marlin/src/HAL/TEENSY40_41/spi_pins.h +++ b/Marlin/src/HAL/TEENSY40_41/spi_pins.h @@ -25,7 +25,7 @@ * HAL SPI Pins for Teensy 4.0 (IMXRT1062DVL6A) / 4.1 (IMXRT1062DVJ6A) */ -#define SCK_PIN 13 -#define MISO_PIN 12 -#define MOSI_PIN 11 -#define SS_PIN 20 // SDSS // A.28, A.29, B.21, C.26, C.29 +#define SD_SCK_PIN 13 +#define SD_MISO_PIN 12 +#define SD_MOSI_PIN 11 +#define SD_SS_PIN 20 // SDSS // A.28, A.29, B.21, C.26, C.29 diff --git a/Marlin/src/feature/dac/dac_dac084s085.cpp b/Marlin/src/feature/dac/dac_dac084s085.cpp index 82d17fa28f..649aa5561b 100644 --- a/Marlin/src/feature/dac/dac_dac084s085.cpp +++ b/Marlin/src/feature/dac/dac_dac084s085.cpp @@ -92,7 +92,7 @@ void dac084s085::cshigh() { WRITE(SPI_EEPROM1_CS, HIGH); WRITE(SPI_EEPROM2_CS, HIGH); WRITE(SPI_FLASH_CS, HIGH); - WRITE(SS_PIN, HIGH); + WRITE(SD_SS_PIN, HIGH); } #endif // MB(ALLIGATOR) diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index c94fcd0cfe..388adb1809 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -1045,9 +1045,9 @@ #define INVERT_E_DIR false #endif -// Fallback SPI Speed -#ifndef SPI_SPEED - #define SPI_SPEED SPI_FULL_SPEED +// Fallback SPI Speed for SD +#if ENABLED(SDSUPPORT) && !defined(SD_SPI_SPEED) + #define SD_SPI_SPEED SPI_FULL_SPEED #endif /** diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index e9ea26aa7a..388caa9eb1 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -2590,10 +2590,10 @@ */ #if HAS_MARLINUI_U8GLIB #ifndef DOGLCD_SCK - #define DOGLCD_SCK SCK_PIN + #define DOGLCD_SCK SD_SCK_PIN #endif #ifndef DOGLCD_MOSI - #define DOGLCD_MOSI MOSI_PIN + #define DOGLCD_MOSI SD_MOSI_PIN #endif #endif @@ -2683,7 +2683,7 @@ // Force SDCARD_SORT_ALPHA to be enabled for Graphical LCD on LPC1768 // on boards where SD card and LCD display share the same SPI bus // because of a bug in the shared SPI implementation. (See #8122) -#if defined(TARGET_LPC1768) && IS_RRD_FG_SC && (SCK_PIN == LCD_PINS_D4) +#if defined(TARGET_LPC1768) && IS_RRD_FG_SC && (SD_SCK_PIN == LCD_PINS_D4) #define SDCARD_SORT_ALPHA // Keep one directory level in RAM. Changing directory levels // may still glitch the screen, but LCD updates clean it up. #undef SDSORT_LIMIT diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 62c954c899..de5960df4c 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -105,9 +105,9 @@ #elif defined(USE_AUTOMATIC_VERSIONING) #error "USE_AUTOMATIC_VERSIONING is now CUSTOM_VERSION_FILE." #elif defined(SDSLOW) - #error "SDSLOW deprecated. Set SPI_SPEED to SPI_HALF_SPEED instead." + #error "SDSLOW deprecated. Set SD_SPI_SPEED to SPI_HALF_SPEED instead." #elif defined(SDEXTRASLOW) - #error "SDEXTRASLOW deprecated. Set SPI_SPEED to SPI_QUARTER_SPEED instead." + #error "SDEXTRASLOW deprecated. Set SD_SPI_SPEED to SPI_QUARTER_SPEED instead." #elif defined(FILAMENT_SENSOR) #error "FILAMENT_SENSOR is now FILAMENT_WIDTH_SENSOR." #elif defined(ENDSTOPPULLUP_FIL_RUNOUT) diff --git a/Marlin/src/lcd/dogm/marlinui_DOGM.h b/Marlin/src/lcd/dogm/marlinui_DOGM.h index 29a1b7d3cf..16cb70dbd8 100644 --- a/Marlin/src/lcd/dogm/marlinui_DOGM.h +++ b/Marlin/src/lcd/dogm/marlinui_DOGM.h @@ -37,7 +37,7 @@ // RepRapWorld Graphical LCD #define U8G_CLASS U8GLIB_ST7920_128X64_4X - #if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SCK_PIN) && (LCD_PINS_ENABLE == MOSI_PIN) + #if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SD_SCK_PIN) && (LCD_PINS_ENABLE == SD_MOSI_PIN) #define U8G_PARAM LCD_PINS_RS #else #define U8G_PARAM LCD_PINS_D4, LCD_PINS_ENABLE, LCD_PINS_RS @@ -48,7 +48,7 @@ // RepRap Discount Full Graphics Smart Controller // and other variant LCDs using ST7920 - #if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SCK_PIN) && (LCD_PINS_ENABLE == MOSI_PIN) + #if DISABLED(SDSUPPORT) && (LCD_PINS_D4 == SD_SCK_PIN) && (LCD_PINS_ENABLE == SD_MOSI_PIN) #define U8G_CLASS U8GLIB_ST7920_128X64_4X_HAL // 2 stripes, HW SPI (Shared with SD card. Non-standard LCD adapter on AVR.) #define U8G_PARAM LCD_PINS_RS #else @@ -88,7 +88,7 @@ #define SMART_RAMPS MB(RAMPS_SMART_EFB, RAMPS_SMART_EEB, RAMPS_SMART_EFF, RAMPS_SMART_EEF, RAMPS_SMART_SF) #define U8G_CLASS U8GLIB_64128N_2X_HAL // 4 stripes (HW-SPI) - #if SMART_RAMPS || DOGLCD_SCK != SCK_PIN || DOGLCD_MOSI != MOSI_PIN + #if SMART_RAMPS || DOGLCD_SCK != SD_SCK_PIN || DOGLCD_MOSI != SD_MOSI_PIN #define FORCE_SOFT_SPI // SW-SPI #endif diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/archim2-flash/media_file_reader.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/archim2-flash/media_file_reader.cpp index 8d2d74ea26..9868492d81 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/archim2-flash/media_file_reader.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/archim2-flash/media_file_reader.cpp @@ -27,7 +27,7 @@ #if ENABLED(SDSUPPORT) bool MediaFileReader::open(const char* filename) { - card.init(SPI_SPEED, SDSS); + card.init(SD_SPI_SPEED, SDSS); volume.init(&card); root.openRoot(&volume); return file.open(&root, filename, O_READ); diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/basic/spi.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/basic/spi.cpp index a9b46e013b..006cbe872c 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/basic/spi.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/basic/spi.cpp @@ -33,7 +33,7 @@ namespace FTDI { SPIClass EVE_SPI(CLCD_SPI_BUS); #endif #ifndef CLCD_HW_SPI_SPEED - #define CLCD_HW_SPI_SPEED 8000000 >> SPI_SPEED + #define CLCD_HW_SPI_SPEED 8000000 >> SD_SPI_SPEED #endif SPISettings SPI::spi_settings(CLCD_HW_SPI_SPEED, MSBFIRST, SPI_MODE0); #endif diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/media_player_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/media_player_screen.cpp index 8912663f27..eb0b78a325 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/media_player_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/media_player_screen.cpp @@ -151,7 +151,7 @@ void MediaPlayerScreen::playStream(void *obj, media_streamer_func_t *data_stream SERIAL_ECHO_MSG("Done playing video"); exit: - spiInit(SPI_SPEED); // Restore default speed + spiInit(SD_SPI_SPEED); // Restore default speed // Since playing media overwrites RAMG, we need to reinitialize // everything that is stored in RAMG. diff --git a/Marlin/src/libs/private_spi.h b/Marlin/src/libs/private_spi.h index 9c0ffe7486..1d8eacd22d 100644 --- a/Marlin/src/libs/private_spi.h +++ b/Marlin/src/libs/private_spi.h @@ -35,12 +35,12 @@ class SPIclass { // Hardware SPI template<> -class SPIclass { +class SPIclass { public: FORCE_INLINE static void init() { - OUT_WRITE(SCK_PIN, LOW); - OUT_WRITE(MOSI_PIN, HIGH); - SET_INPUT_PULLUP(MISO_PIN); + OUT_WRITE(SD_SCK_PIN, LOW); + OUT_WRITE(SD_MOSI_PIN, HIGH); + SET_INPUT_PULLUP(SD_MISO_PIN); } FORCE_INLINE static uint8_t receive() { #if defined(__AVR__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__) || defined(__IMXRT1062__) diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index d704ebc85b..fea992f681 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -53,7 +53,7 @@ #define MAX31865_CS2_PIN MAX6675_SS2_PIN #endif #ifndef MAX31865_MOSI_PIN - #define MAX31865_MOSI_PIN MOSI_PIN + #define MAX31865_MOSI_PIN SD_MOSI_PIN #endif #ifndef MAX31865_MISO_PIN #define MAX31865_MISO_PIN MAX6675_DO_PIN @@ -1662,7 +1662,7 @@ void Temperature::updateTemperaturesFromRawValues() { #if MAX6675_SEPARATE_SPI template SoftSPI SPIclass::softSPI; - SPIclass max6675_spi; + SPIclass max6675_spi; #endif // Init fans according to whether they're native PWM or Software PWM diff --git a/Marlin/src/pins/esp32/pins_E4D.h b/Marlin/src/pins/esp32/pins_E4D.h index 6009ea6cdb..4a5a2bf9b0 100644 --- a/Marlin/src/pins/esp32/pins_E4D.h +++ b/Marlin/src/pins/esp32/pins_E4D.h @@ -100,8 +100,8 @@ // // MicroSD card on SPI // -#define MOSI_PIN 23 -#define MISO_PIN 19 -#define SCK_PIN 18 +#define SD_MOSI_PIN 23 +#define SD_MISO_PIN 19 +#define SD_SCK_PIN 18 #define SDSS 5 #define USES_SHARED_SPI // SPI is shared by SD card with TMC SPI drivers diff --git a/Marlin/src/pins/esp32/pins_FYSETC_E4.h b/Marlin/src/pins/esp32/pins_FYSETC_E4.h index 5b62518689..50a8587b1e 100644 --- a/Marlin/src/pins/esp32/pins_FYSETC_E4.h +++ b/Marlin/src/pins/esp32/pins_FYSETC_E4.h @@ -104,9 +104,9 @@ // // MicroSD card // -#define MOSI_PIN 23 -#define MISO_PIN 19 -#define SCK_PIN 18 +#define SD_MOSI_PIN 23 +#define SD_MISO_PIN 19 +#define SD_SCK_PIN 18 #define SDSS 5 #define USES_SHARED_SPI // SPI is shared by SD card with TMC SPI drivers diff --git a/Marlin/src/pins/esp32/pins_MRR_ESPA.h b/Marlin/src/pins/esp32/pins_MRR_ESPA.h index 02cdd0a009..fe67f75372 100644 --- a/Marlin/src/pins/esp32/pins_MRR_ESPA.h +++ b/Marlin/src/pins/esp32/pins_MRR_ESPA.h @@ -93,9 +93,9 @@ // // MicroSD card // -#define MOSI_PIN 23 -#define MISO_PIN 19 -#define SCK_PIN 18 +#define SD_MOSI_PIN 23 +#define SD_MISO_PIN 19 +#define SD_SCK_PIN 18 #define SDSS 5 #define USES_SHARED_SPI // SPI is shared by SD card with TMC SPI drivers diff --git a/Marlin/src/pins/esp32/pins_MRR_ESPE.h b/Marlin/src/pins/esp32/pins_MRR_ESPE.h index f95a53240b..3f9a6a0af3 100644 --- a/Marlin/src/pins/esp32/pins_MRR_ESPE.h +++ b/Marlin/src/pins/esp32/pins_MRR_ESPE.h @@ -112,9 +112,9 @@ // // MicroSD card // -#define MOSI_PIN 23 -#define MISO_PIN 19 -#define SCK_PIN 18 +#define SD_MOSI_PIN 23 +#define SD_MISO_PIN 19 +#define SD_SCK_PIN 18 #define SDSS 5 #define USES_SHARED_SPI // SPI is shared by SD card with TMC SPI drivers diff --git a/Marlin/src/pins/lpc1768/pins_AZSMZ_MINI.h b/Marlin/src/pins/lpc1768/pins_AZSMZ_MINI.h index 78e7426674..70682ad151 100644 --- a/Marlin/src/pins/lpc1768/pins_AZSMZ_MINI.h +++ b/Marlin/src/pins/lpc1768/pins_AZSMZ_MINI.h @@ -102,16 +102,16 @@ #endif #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_SCK_PIN P0_15 + #define SD_MISO_PIN P0_17 + #define SD_MOSI_PIN P0_18 + #define SD_SS_PIN LCD_SDSS #define SD_DETECT_PIN P3_25 #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_PIN + #define SD_SCK_PIN P0_07 + #define SD_MISO_PIN P0_08 + #define SD_MOSI_PIN P0_09 + #define SD_SS_PIN ONBOARD_SD_CS_PIN #elif SD_CONNECTION_IS(CUSTOM_CABLE) #error "No custom SD drive cable defined for this board." #endif diff --git a/Marlin/src/pins/lpc1768/pins_BIQU_B300_V1.0.h b/Marlin/src/pins/lpc1768/pins_BIQU_B300_V1.0.h index 8c1c124d90..5ac119f398 100644 --- a/Marlin/src/pins/lpc1768/pins_BIQU_B300_V1.0.h +++ b/Marlin/src/pins/lpc1768/pins_BIQU_B300_V1.0.h @@ -155,11 +155,11 @@ * Hardware SPI can't be used because P0_17 (MISO) is not brought out on this board. */ #if ENABLED(SDSUPPORT) - #define SCK_PIN P0_15 // EXP1-5 - #define MISO_PIN P0_16 // EXP1-4 - #define MOSI_PIN P0_18 // EXP1-3 - #define SS_PIN P1_30 // EXP1-2 - #define SDSS SS_PIN + #define SD_SCK_PIN P0_15 // EXP1-5 + #define SD_MISO_PIN P0_16 // EXP1-4 + #define SD_MOSI_PIN P0_18 // EXP1-3 + #define SD_SS_PIN P1_30 // EXP1-2 + #define SDSS SD_SS_PIN #endif /** diff --git a/Marlin/src/pins/lpc1768/pins_BIQU_BQ111_A4.h b/Marlin/src/pins/lpc1768/pins_BIQU_BQ111_A4.h index d92d5e578f..3b2137b400 100644 --- a/Marlin/src/pins/lpc1768/pins_BIQU_BQ111_A4.h +++ b/Marlin/src/pins/lpc1768/pins_BIQU_BQ111_A4.h @@ -127,11 +127,11 @@ */ #if ENABLED(SDSUPPORT) - #define SCK_PIN P0_15 // EXP1-5 - #define MISO_PIN P0_16 // EXP1-4 - #define MOSI_PIN P0_18 // EXP1-3 - #define SS_PIN P1_30 // EXP1-2 - #define SDSS SS_PIN + #define SD_SCK_PIN P0_15 // EXP1-5 + #define SD_MISO_PIN P0_16 // EXP1-4 + #define SD_MOSI_PIN P0_18 // EXP1-3 + #define SD_SS_PIN P1_30 // EXP1-2 + #define SDSS SD_SS_PIN #endif // SDSUPPORT diff --git a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_1.h b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_1.h index 0701e45992..8c1396d3fe 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_1.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_1.h @@ -107,7 +107,7 @@ #endif #if SD_CONNECTION_IS(LCD) - #define SS_PIN P1_23 + #define SD_SS_PIN P1_23 #endif // Trinamic driver support diff --git a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h index c621f93a2a..e5b78024cb 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h @@ -375,7 +375,7 @@ #endif #if SD_CONNECTION_IS(LCD) - #define SS_PIN EXPA2_07_PIN + #define SD_SS_PIN EXPA2_07_PIN #endif /** diff --git a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h index 829c38ec45..7500431d54 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h @@ -244,7 +244,7 @@ // SD Connection // #if SD_CONNECTION_IS(LCD) - #define SS_PIN EXPA2_07_PIN + #define SD_SS_PIN EXPA2_07_PIN #endif /** @@ -374,9 +374,9 @@ #define TOUCH_BUTTONS_HW_SPI_DEVICE 1 // SPI 1 - #define SCK_PIN EXPA2_09_PIN - #define MISO_PIN EXPA2_10_PIN - #define MOSI_PIN EXPA2_05_PIN + #define SD_SCK_PIN EXPA2_09_PIN + #define SD_MISO_PIN EXPA2_10_PIN + #define SD_MOSI_PIN EXPA2_05_PIN // Disable any LCD related PINs config #define LCD_PINS_ENABLE -1 diff --git a/Marlin/src/pins/lpc1768/pins_BTT_SKR_common.h b/Marlin/src/pins/lpc1768/pins_BTT_SKR_common.h index 533c92e067..a43940f8f0 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_common.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_common.h @@ -114,16 +114,16 @@ #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 SD_SCK_PIN P0_15 + #define SD_MISO_PIN P0_17 + #define SD_MOSI_PIN P0_18 #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 ONBOARD_SD_CS_PIN + #define SD_SCK_PIN P0_07 + #define SD_MISO_PIN P0_08 + #define SD_MOSI_PIN P0_09 + #define SD_SS_PIN ONBOARD_SD_CS_PIN #elif SD_CONNECTION_IS(CUSTOM_CABLE) #error "No custom SD drive cable defined for this board." #endif diff --git a/Marlin/src/pins/lpc1768/pins_GMARSH_X6_REV1.h b/Marlin/src/pins/lpc1768/pins_GMARSH_X6_REV1.h index 9977230094..1970c0c479 100644 --- a/Marlin/src/pins/lpc1768/pins_GMARSH_X6_REV1.h +++ b/Marlin/src/pins/lpc1768/pins_GMARSH_X6_REV1.h @@ -154,15 +154,15 @@ #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 + #define SD_SCK_PIN P0_15 + #define SD_MISO_PIN P0_17 + #define SD_MOSI_PIN P0_18 + #define SD_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 ONBOARD_SD_CS_PIN + #define SD_SCK_PIN P0_07 + #define SD_MISO_PIN P0_08 + #define SD_MOSI_PIN P0_09 + #define SD_SS_PIN ONBOARD_SD_CS_PIN #endif diff --git a/Marlin/src/pins/lpc1768/pins_MKS_SBASE.h b/Marlin/src/pins/lpc1768/pins_MKS_SBASE.h index b993e38460..ea9748ca54 100644 --- a/Marlin/src/pins/lpc1768/pins_MKS_SBASE.h +++ b/Marlin/src/pins/lpc1768/pins_MKS_SBASE.h @@ -182,26 +182,25 @@ * SD_DETECT_PIN entirely and remove that wire from the the custom cable. */ #define SD_DETECT_PIN P2_11 // J8-5 (moved from EXP2 P0.27) - #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 + #define SD_SCK_PIN P1_22 // J8-2 (moved from EXP2 P0.7) + #define SD_MISO_PIN P1_23 // J8-3 (moved from EXP2 P0.8) + #define SD_MOSI_PIN P2_12 // J8-4 (moved from EXP2 P0.9) + #define SD_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 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 -#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 ONBOARD_SD_CS_PIN +#elif SD_CONNECTION_IS(LCD) || SD_CONNECTION_IS(ONBOARD) + #define SD_SCK_PIN P0_07 + #define SD_MISO_PIN P0_08 + #define SD_MOSI_PIN P0_09 + #if SD_CONNECTION_IS(LCD) + // Use standard cable and header, SPI and SD detect are shared with onboard SD card. + // Hardware SPI is used for both SD cards. The detect pin is shared between the + // LCD and onboard SD readers so we disable it. + #define SD_SS_PIN P0_28 + #else + #define SD_DETECT_PIN P0_27 + #define SD_SS_PIN ONBOARD_SD_CS_PIN + #endif #endif /** @@ -238,8 +237,8 @@ #define LCD_PINS_ENABLE P0_18 // EXP1.3 #define LCD_PINS_D4 P0_15 // EXP1.5 #if ANY(VIKI2, miniVIKI) - #define DOGLCD_SCK SCK_PIN - #define DOGLCD_MOSI MOSI_PIN + #define DOGLCD_SCK SD_SCK_PIN + #define DOGLCD_MOSI SD_MOSI_PIN #endif #if ENABLED(FYSETC_MINI_12864) diff --git a/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h b/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h index 6d9d225eff..b919ecad85 100644 --- a/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h +++ b/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h @@ -375,13 +375,13 @@ #if SD_CONNECTION_IS(LCD) || 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 SD_SCK_PIN P0_07 + #define SD_MISO_PIN P0_08 + #define SD_MOSI_PIN P0_09 #if SD_CONNECTION_IS(ONBOARD) - #define SS_PIN ONBOARD_SD_CS_PIN + #define SD_SS_PIN ONBOARD_SD_CS_PIN #else - #define SS_PIN P0_28 + #define SD_SS_PIN P0_28 #endif #elif SD_CONNECTION_IS(CUSTOM_CABLE) #error "No custom SD drive cable defined for this board." diff --git a/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h b/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h index f746064991..e045245188 100644 --- a/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h +++ b/Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h @@ -336,11 +336,6 @@ #elif HAS_WIRED_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) - #if ENABLED(FYSETC_MINI_12864) #define BEEPER_PIN P1_01 #define BTN_ENC P1_04 @@ -375,8 +370,8 @@ #define DOGLCD_CS P0_16 // (16) #define DOGLCD_A0 P2_06 // (59) J3-8 & AUX-2 - #define DOGLCD_SCK SCK_PIN - #define DOGLCD_MOSI MOSI_PIN + #define DOGLCD_SCK SD_SCK_PIN + #define DOGLCD_MOSI SD_MOSI_PIN #define STAT_LED_BLUE_PIN P0_26 // (63) may change if cable changes #define STAT_LED_RED_PIN P1_21 // ( 6) may change if cable changes @@ -464,16 +459,16 @@ #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 SD_SCK_PIN P0_15 // (52) system defined J3-9 & AUX-3 + #define SD_MISO_PIN P0_17 // (50) system defined J3-10 & AUX-3 + #define SD_MOSI_PIN P0_18 // (51) system defined J3-10 & AUX-3 + #define SD_SS_PIN P1_23 // (53) system defined J3-5 & AUX-3 (Sometimes called SDSS) - CS used by Marlin #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 + #define SD_SCK_PIN P0_07 + #define SD_MISO_PIN P0_08 + #define SD_MOSI_PIN P0_09 + #define SD_SS_PIN ONBOARD_SD_CS_PIN #elif SD_CONNECTION_IS(CUSTOM_CABLE) #error "No custom SD drive cable defined for this board." #endif diff --git a/Marlin/src/pins/lpc1769/pins_AZTEEG_X5_MINI.h b/Marlin/src/pins/lpc1769/pins_AZTEEG_X5_MINI.h index ac1d9f6906..596efdbb97 100644 --- a/Marlin/src/pins/lpc1769/pins_AZTEEG_X5_MINI.h +++ b/Marlin/src/pins/lpc1769/pins_AZTEEG_X5_MINI.h @@ -162,8 +162,8 @@ #define BEEPER_PIN P1_30 // (37) may change if cable changes #define DOGLCD_CS P0_26 // (63) J5-3 & AUX-2 - #define DOGLCD_SCK SCK_PIN - #define DOGLCD_MOSI MOSI_PIN + #define DOGLCD_SCK SD_SCK_PIN + #define DOGLCD_MOSI SD_MOSI_PIN #define STAT_LED_BLUE_PIN P0_26 // (63) may change if cable changes #define STAT_LED_RED_PIN P1_21 // ( 6) may change if cable changes @@ -204,16 +204,16 @@ #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 + #define SD_SCK_PIN P0_15 + #define SD_MISO_PIN P0_17 + #define SD_MOSI_PIN P0_18 + #define SD_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 + #define SD_SCK_PIN P0_07 + #define SD_MISO_PIN P0_08 + #define SD_MOSI_PIN P0_09 + #define SD_SS_PIN ONBOARD_SD_CS_PIN #elif SD_CONNECTION_IS(CUSTOM_CABLE) #error "No custom SD drive cable defined for this board." #endif diff --git a/Marlin/src/pins/lpc1769/pins_BTT_SKR_E3_TURBO.h b/Marlin/src/pins/lpc1769/pins_BTT_SKR_E3_TURBO.h index a34b70bae3..0e93aec945 100644 --- a/Marlin/src/pins/lpc1769/pins_BTT_SKR_E3_TURBO.h +++ b/Marlin/src/pins/lpc1769/pins_BTT_SKR_E3_TURBO.h @@ -253,10 +253,10 @@ #if SD_CONNECTION_IS(ONBOARD) #define SD_DETECT_PIN P2_00 - #define SCK_PIN P0_07 - #define MISO_PIN P0_08 - #define MOSI_PIN P0_09 - #define SS_PIN P0_06 + #define SD_SCK_PIN P0_07 + #define SD_MISO_PIN P0_08 + #define SD_MOSI_PIN P0_09 + #define SD_SS_PIN P0_06 #elif SD_CONNECTION_IS(CUSTOM_CABLE) #error "SD CUSTOM_CABLE is not compatible with SKR E3 Turbo." #endif diff --git a/Marlin/src/pins/lpc1769/pins_COHESION3D_REMIX.h b/Marlin/src/pins/lpc1769/pins_COHESION3D_REMIX.h index 66604ef635..edf13cee29 100644 --- a/Marlin/src/pins/lpc1769/pins_COHESION3D_REMIX.h +++ b/Marlin/src/pins/lpc1769/pins_COHESION3D_REMIX.h @@ -233,17 +233,16 @@ #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 -#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 +#if SD_CONNECTION_IS(LCD) || SD_CONNECTION_IS(ONBOARD) + #define SD_SCK_PIN P0_07 // (52) system defined J3-9 & AUX-3 + #define SD_MISO_PIN P0_08 // (50) system defined J3-10 & AUX-3 + #define SD_MOSI_PIN P0_09 // (51) system defined J3-10 & AUX-3 + #if SD_CONNECTION_IS(LCD) + #define SD_SS_PIN P1_23 // (53) system defined J3-5 & AUX-3 (Sometimes called SDSS) - CS used by Marlin + #else + #undef SD_DETECT_PIN + #define SD_SS_PIN ONBOARD_SD_CS_PIN + #endif #elif SD_CONNECTION_IS(CUSTOM_CABLE) #error "No custom SD drive cable defined for this board." #endif diff --git a/Marlin/src/pins/lpc1769/pins_FLY_CDY.h b/Marlin/src/pins/lpc1769/pins_FLY_CDY.h index 5e4bea1c2b..3982d76a01 100644 --- a/Marlin/src/pins/lpc1769/pins_FLY_CDY.h +++ b/Marlin/src/pins/lpc1769/pins_FLY_CDY.h @@ -167,15 +167,15 @@ #endif #if SD_CONNECTION_IS(ONBOARD) - #define SS_PIN P0_06 - #define SCK_PIN P0_07 - #define MISO_PIN P0_08 - #define MOSI_PIN P0_09 + #define SD_SS_PIN P0_06 + #define SD_SCK_PIN P0_07 + #define SD_MISO_PIN P0_08 + #define SD_MOSI_PIN P0_09 #define SD_DETECT_PIN P0_05 #elif SD_CONNECTION_IS(LCD) - #define SCK_PIN P0_15 - #define MISO_PIN P0_17 - #define MOSI_PIN P0_18 - #define SS_PIN P0_16 + #define SD_SCK_PIN P0_15 + #define SD_MISO_PIN P0_17 + #define SD_MOSI_PIN P0_18 + #define SD_SS_PIN P0_16 #define SD_DETECT_PIN P2_06 #endif diff --git a/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h b/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h index 638268a546..79c79c5914 100644 --- a/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h +++ b/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h @@ -394,13 +394,13 @@ #if SD_CONNECTION_IS(LCD) || 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 SD_SCK_PIN P0_07 + #define SD_MISO_PIN P0_08 + #define SD_MOSI_PIN P0_09 #if SD_CONNECTION_IS(ONBOARD) - #define SS_PIN ONBOARD_SD_CS_PIN + #define SD_SS_PIN ONBOARD_SD_CS_PIN #else - #define SS_PIN P0_28 + #define SD_SS_PIN P0_28 #endif #elif SD_CONNECTION_IS(CUSTOM_CABLE) #error "No custom SD drive cable defined for this board." diff --git a/Marlin/src/pins/lpc1769/pins_SMOOTHIEBOARD.h b/Marlin/src/pins/lpc1769/pins_SMOOTHIEBOARD.h index 4e10d8d1da..c5ce3f8795 100644 --- a/Marlin/src/pins/lpc1769/pins_SMOOTHIEBOARD.h +++ b/Marlin/src/pins/lpc1769/pins_SMOOTHIEBOARD.h @@ -124,10 +124,10 @@ */ #define SD_DETECT_PIN P0_27 // EXP2 Pin 7 (SD_CD, SD_DET) - #define MISO_PIN P0_08 // EXP2 Pin 1 (PB3, SD_MISO) - #define SCK_PIN P0_07 // EXP2 Pin 2 (SD_SCK) - #define SS_PIN P0_28 // EXP2 Pin 4 (SD_CSEL, SD_CS) - #define MOSI_PIN P0_09 // EXP2 Pin 6 (PB2, SD_MOSI) + #define SD_MISO_PIN P0_08 // EXP2 Pin 1 (PB3, SD_MISO) + #define SD_SCK_PIN P0_07 // EXP2 Pin 2 (SD_SCK) + #define SD_SS_PIN P0_28 // EXP2 Pin 4 (SD_CSEL, SD_CS) + #define SD_MOSI_PIN P0_09 // EXP2 Pin 6 (PB2, SD_MOSI) /** * The Smoothieboard supports the REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER with either diff --git a/Marlin/src/pins/lpc1769/pins_TH3D_EZBOARD.h b/Marlin/src/pins/lpc1769/pins_TH3D_EZBOARD.h index c11cd9e9da..d4f3e5bc21 100644 --- a/Marlin/src/pins/lpc1769/pins_TH3D_EZBOARD.h +++ b/Marlin/src/pins/lpc1769/pins_TH3D_EZBOARD.h @@ -141,11 +141,11 @@ #define SDCARD_CONNECTION ONBOARD -#define SCK_PIN P0_07 -#define MISO_PIN P0_08 -#define MOSI_PIN P0_09 +#define SD_SCK_PIN P0_07 +#define SD_MISO_PIN P0_08 +#define SD_MOSI_PIN P0_09 #define ONBOARD_SD_CS_PIN P0_06 -#define SS_PIN ONBOARD_SD_CS_PIN +#define SD_SS_PIN ONBOARD_SD_CS_PIN // // LCD / Controller diff --git a/Marlin/src/pins/pinsDebug_list.h b/Marlin/src/pins/pinsDebug_list.h index cf839e2abd..0e1b1b09e5 100644 --- a/Marlin/src/pins/pinsDebug_list.h +++ b/Marlin/src/pins/pinsDebug_list.h @@ -702,7 +702,7 @@ // REPORT_NAME_DIGITAL(__LINE__, MISO) // #endif #if PIN_EXISTS(MISO) - REPORT_NAME_DIGITAL(__LINE__, MISO_PIN) + REPORT_NAME_DIGITAL(__LINE__, SD_MISO_PIN) #endif #if PIN_EXISTS(MOSFET_A) REPORT_NAME_DIGITAL(__LINE__, MOSFET_A_PIN) @@ -720,7 +720,7 @@ // REPORT_NAME_DIGITAL(__LINE__, MOSI) // #endif #if PIN_EXISTS(MOSI) - REPORT_NAME_DIGITAL(__LINE__, MOSI_PIN) + REPORT_NAME_DIGITAL(__LINE__, SD_MOSI_PIN) #endif #if PIN_EXISTS(MOTOR_CURRENT_PWM_E) REPORT_NAME_DIGITAL(__LINE__, MOTOR_CURRENT_PWM_E_PIN) @@ -801,7 +801,7 @@ // REPORT_NAME_DIGITAL(__LINE__, SCK) // #endif #if PIN_EXISTS(SCK) - REPORT_NAME_DIGITAL(__LINE__, SCK_PIN) + REPORT_NAME_DIGITAL(__LINE__, SD_SCK_PIN) #endif // #if defined(SCL) && SCL >= 0 // REPORT_NAME_DIGITAL(__LINE__, SCL) @@ -909,7 +909,7 @@ REPORT_NAME_DIGITAL(__LINE__, SR_STROBE_PIN) #endif #if PIN_EXISTS(SS) - REPORT_NAME_DIGITAL(__LINE__, SS_PIN) + REPORT_NAME_DIGITAL(__LINE__, SD_SS_PIN) #endif #if PIN_EXISTS(STAT_LED_BLUE) REPORT_NAME_DIGITAL(__LINE__, STAT_LED_BLUE_PIN) diff --git a/Marlin/src/pins/ramps/pins_DUPLICATOR_I3_PLUS.h b/Marlin/src/pins/ramps/pins_DUPLICATOR_I3_PLUS.h index 87d24890c9..93ec3d6070 100644 --- a/Marlin/src/pins/ramps/pins_DUPLICATOR_I3_PLUS.h +++ b/Marlin/src/pins/ramps/pins_DUPLICATOR_I3_PLUS.h @@ -80,9 +80,9 @@ #define SDSS 53 // PB0 / SS #define LED_PIN 13 // PB7 / PWM13 -#define MISO_PIN 50 // PB3 -#define MOSI_PIN 51 // PB2 -#define SCK_PIN 52 // PB1 +#define SD_MISO_PIN 50 // PB3 +#define SD_MOSI_PIN 51 // PB2 +#define SD_SCK_PIN 52 // PB1 // // LCDs and Controllers diff --git a/Marlin/src/pins/sam/pins_ARCHIM1.h b/Marlin/src/pins/sam/pins_ARCHIM1.h index 1fda0ccb44..57bbeb62a2 100644 --- a/Marlin/src/pins/sam/pins_ARCHIM1.h +++ b/Marlin/src/pins/sam/pins_ARCHIM1.h @@ -170,9 +170,9 @@ #define INT_SDSS 55 // D55 PA24/MCDA3 // External SD card reader on SC2 -#define SCK_PIN 76 // D76 PA27 -#define MISO_PIN 74 // D74 PA25 -#define MOSI_PIN 75 // D75 PA26 +#define SD_SCK_PIN 76 // D76 PA27 +#define SD_MISO_PIN 74 // D74 PA25 +#define SD_MOSI_PIN 75 // D75 PA26 #define SDSS 87 // D87 PA29 // 2MB SPI Flash diff --git a/Marlin/src/pins/sam/pins_ARCHIM2.h b/Marlin/src/pins/sam/pins_ARCHIM2.h index 5923ea0f8f..3776cf8bb5 100644 --- a/Marlin/src/pins/sam/pins_ARCHIM2.h +++ b/Marlin/src/pins/sam/pins_ARCHIM2.h @@ -192,9 +192,9 @@ #define INT_SDSS 55 // D55 PA24/MCDA3 // External SD card reader on SC2 -#define SCK_PIN 76 // D76 PA27 -#define MISO_PIN 74 // D74 PA25 -#define MOSI_PIN 75 // D75 PA26 +#define SD_SCK_PIN 76 // D76 PA27 +#define SD_MISO_PIN 74 // D74 PA25 +#define SD_MOSI_PIN 75 // D75 PA26 #define SDSS 87 // D87 PA29 // Unused Digital GPIO J20 Pins diff --git a/Marlin/src/pins/sam/pins_CNCONTROLS_15D.h b/Marlin/src/pins/sam/pins_CNCONTROLS_15D.h index fcd2bb4c67..5bf31450b7 100644 --- a/Marlin/src/pins/sam/pins_CNCONTROLS_15D.h +++ b/Marlin/src/pins/sam/pins_CNCONTROLS_15D.h @@ -117,9 +117,9 @@ // // SD card // -#define SCK_PIN 76 -#define MISO_PIN 74 -#define MOSI_PIN 75 +#define SD_SCK_PIN 76 +#define SD_MISO_PIN 74 +#define SD_MOSI_PIN 75 #define SDSS 53 #define SD_DETECT_PIN 40 diff --git a/Marlin/src/pins/sam/pins_PRINTRBOARD_G2.h b/Marlin/src/pins/sam/pins_PRINTRBOARD_G2.h index ea4b950a17..424d858a85 100644 --- a/Marlin/src/pins/sam/pins_PRINTRBOARD_G2.h +++ b/Marlin/src/pins/sam/pins_PRINTRBOARD_G2.h @@ -151,9 +151,9 @@ ///////////////////////////////////////////////////////// -#define MISO_PIN 68 // set to unused pins for now -#define MOSI_PIN 69 // set to unused pins for now -#define SCK_PIN 70 // set to unused pins for now +#define SD_MISO_PIN 68 // set to unused pins for now +#define SD_MOSI_PIN 69 // set to unused pins for now +#define SD_SCK_PIN 70 // set to unused pins for now #define SDSS 71 // set to unused pins for now /** diff --git a/Marlin/src/pins/sam/pins_ULTRATRONICS_PRO.h b/Marlin/src/pins/sam/pins_ULTRATRONICS_PRO.h index 0b91ba61d6..ea096187f7 100644 --- a/Marlin/src/pins/sam/pins_ULTRATRONICS_PRO.h +++ b/Marlin/src/pins/sam/pins_ULTRATRONICS_PRO.h @@ -147,9 +147,9 @@ #define SPI_EEPROM2_CS -1 #define SPI_FLASH_CS -1 -#define SCK_PIN 76 -#define MISO_PIN 74 -#define MOSI_PIN 75 +#define SD_SCK_PIN 76 +#define SD_MISO_PIN 74 +#define SD_MOSI_PIN 75 // SPI for Max6675 or Max31855 Thermocouple #define MAX6675_SS_PIN 65 diff --git a/Marlin/src/pins/sanguino/pins_MELZI_CREALITY.h b/Marlin/src/pins/sanguino/pins_MELZI_CREALITY.h index f110fe5794..97db36dd54 100644 --- a/Marlin/src/pins/sanguino/pins_MELZI_CREALITY.h +++ b/Marlin/src/pins/sanguino/pins_MELZI_CREALITY.h @@ -91,13 +91,13 @@ PIN: 3 Port: B3 Z_STEP_PIN protected PIN: 4 Port: B4 AVR_SS_PIN protected . FAN_PIN protected - . SS_PIN protected + . SD_SS_PIN protected PIN: 5 Port: B5 AVR_MOSI_PIN Output = 1 - . MOSI_PIN Output = 1 + . SD_MOSI_PIN Output = 1 PIN: 6 Port: B6 AVR_MISO_PIN Input = 0 TIMER3A PWM: 0 WGM: 1 COM3A: 0 CS: 3 TCCR3A: 1 TCCR3B: 3 TIMSK3: 0 - . MISO_PIN Input = 0 + . SD_MISO_PIN Input = 0 PIN: 7 Port: B7 AVR_SCK_PIN Output = 0 TIMER3B PWM: 0 WGM: 1 COM3B: 0 CS: 3 TCCR3A: 1 TCCR3B: 3 TIMSK3: 0 - . SCK_PIN Output = 0 + . SD_SCK_PIN Output = 0 PIN: 8 Port: D0 RXD Input = 1 PIN: 9 Port: D1 TXD Input = 0 PIN: 10 Port: D2 BTN_EN2 Input = 1 diff --git a/Marlin/src/pins/sanguino/pins_ZMIB_V2.h b/Marlin/src/pins/sanguino/pins_ZMIB_V2.h index 3cf68ac905..d064d80132 100644 --- a/Marlin/src/pins/sanguino/pins_ZMIB_V2.h +++ b/Marlin/src/pins/sanguino/pins_ZMIB_V2.h @@ -49,11 +49,11 @@ * PIN: 4 Port: B4 SDSS * PIN: 4 Port: B4 V1: EXP1_6 * PIN: 5 Port: B5 AVR_MOSI_PIN - * . MOSI_PIN + * . SD_MOSI_PIN * PIN: 6 Port: B6 AVR_MISO_PIN - * . EXP1_9(MISO_PIN) + * . EXP1_9(SD_MISO_PIN) * PIN: 7 Port: B7 AVR_SCK_PIN - * . EXP1_10(SCK_PIN) + * . EXP1_10(SD_SCK_PIN) * PIN: 8 Port: D0 RXD * PIN: 9 Port: D1 TXD * PIN: 10 Port: D2 EXP1_8 diff --git a/Marlin/src/pins/stm32f0/pins_MALYAN_M300.h b/Marlin/src/pins/stm32f0/pins_MALYAN_M300.h index a0e035a916..2717439f24 100644 --- a/Marlin/src/pins/stm32f0/pins_MALYAN_M300.h +++ b/Marlin/src/pins/stm32f0/pins_MALYAN_M300.h @@ -41,7 +41,7 @@ // // SD CARD SPI // -#define SDSS SS_PIN +#define SDSS SD_SS_PIN // // Timers diff --git a/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h b/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h index a124b4d583..0426e80fd2 100644 --- a/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h +++ b/Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h @@ -280,7 +280,7 @@ #define SD_DETECT_PIN PC4 #elif SD_CONNECTION_IS(LCD) && BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) #define SD_DETECT_PIN PA15 - #define SS_PIN PA10 + #define SD_SS_PIN PA10 #elif SD_CONNECTION_IS(CUSTOM_CABLE) #error "SD CUSTOM_CABLE is not compatible with SKR E3 DIP." #endif diff --git a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h index ead939707f..bab662d1be 100644 --- a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h +++ b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h @@ -274,7 +274,7 @@ #define SD_DETECT_PIN PC4 #elif SD_CONNECTION_IS(LCD) && (BOTH(TOUCH_UI_FTDI_EVE, LCD_FYSETC_TFT81050) || IS_TFTGLCD_PANEL) #define SD_DETECT_PIN PB5 - #define SS_PIN PA10 + #define SD_SS_PIN PA10 #elif SD_CONNECTION_IS(CUSTOM_CABLE) #error "SD CUSTOM_CABLE is not compatible with SKR Mini E3." #endif diff --git a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_V1_1.h b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_V1_1.h index 410424f6b5..8668e1defd 100644 --- a/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_V1_1.h +++ b/Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_V1_1.h @@ -217,16 +217,16 @@ #if SD_CONNECTION_IS(LCD) #define SPI_DEVICE 3 #define SD_DETECT_PIN PB9 - #define SCK_PIN PB3 - #define MISO_PIN PB4 - #define MOSI_PIN PB5 - #define SS_PIN PA15 + #define SD_SCK_PIN PB3 + #define SD_MISO_PIN PB4 + #define SD_MOSI_PIN PB5 + #define SD_SS_PIN PA15 #elif SD_CONNECTION_IS(ONBOARD) #define SD_DETECT_PIN PA3 - #define SCK_PIN PA5 - #define MISO_PIN PA6 - #define MOSI_PIN PA7 - #define SS_PIN PA4 + #define SD_SCK_PIN PA5 + #define SD_MISO_PIN PA6 + #define SD_MOSI_PIN PA7 + #define SD_SS_PIN PA4 #endif #define ONBOARD_SPI_DEVICE 1 // SPI1 #define ONBOARD_SD_CS_PIN PA4 // Chip select for "System" SD card diff --git a/Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h b/Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h index a255160829..43dfdece44 100644 --- a/Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h +++ b/Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h @@ -166,10 +166,10 @@ // #if SD_CONNECTION_IS(ONBOARD) #define SD_DETECT_PIN -1 - #define SCK_PIN PA5 - #define MISO_PIN PA6 - #define MOSI_PIN PA7 - #define SS_PIN PA4 + #define SD_SCK_PIN PA5 + #define SD_MISO_PIN PA6 + #define SD_MOSI_PIN PA7 + #define SD_SS_PIN PA4 #endif #define ONBOARD_SPI_DEVICE 1 // SPI1 diff --git a/Marlin/src/pins/stm32f1/pins_CHITU3D_V5.h b/Marlin/src/pins/stm32f1/pins_CHITU3D_V5.h index 32d4e0c9d4..c90ae84acb 100644 --- a/Marlin/src/pins/stm32f1/pins_CHITU3D_V5.h +++ b/Marlin/src/pins/stm32f1/pins_CHITU3D_V5.h @@ -175,10 +175,10 @@ // SPI1(PA7)=LCD & SPI3(PB5)=STUFF, are not available // Needs to use SPI2 #define SPI_DEVICE 2 -#define SCK_PIN PB13 -#define MISO_PIN PB14 -#define MOSI_PIN PB15 -#define SS_PIN PB12 +#define SD_SCK_PIN PB13 +#define SD_MISO_PIN PB14 +#define SD_MOSI_PIN PB15 +#define SD_SS_PIN PB12 // // SD Card diff --git a/Marlin/src/pins/stm32f1/pins_CHITU3D_V6.h b/Marlin/src/pins/stm32f1/pins_CHITU3D_V6.h index 066a6cc8aa..96cf36629a 100644 --- a/Marlin/src/pins/stm32f1/pins_CHITU3D_V6.h +++ b/Marlin/src/pins/stm32f1/pins_CHITU3D_V6.h @@ -190,10 +190,10 @@ // SPI1(PA7)=LCD & SPI3(PB5)=STUFF, are not available // so SPI2 is required. #define SPI_DEVICE 2 -#define SCK_PIN PB13 -#define MISO_PIN PB14 -#define MOSI_PIN PB15 -#define SS_PIN PB12 +#define SD_SCK_PIN PB13 +#define SD_MISO_PIN PB14 +#define SD_MOSI_PIN PB15 +#define SD_SS_PIN PB12 // // SD Card diff --git a/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h b/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h index c52b12b26b..c49c31e741 100644 --- a/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h +++ b/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h @@ -62,9 +62,9 @@ // SPI // Note: FLSun Hispeed (clone MKS_Robin_miniV2) board is using SPI2 interface. // -#define SCK_PIN PB13 // SPI2 -#define MISO_PIN PB14 // SPI2 -#define MOSI_PIN PB15 // SPI2 +#define SD_SCK_PIN PB13 // SPI2 +#define SD_MISO_PIN PB14 // SPI2 +#define SD_MOSI_PIN PB15 // SPI2 #define SPI_DEVICE 2 // SPI Flash @@ -246,10 +246,10 @@ // Use the on-board card socket labeled SD_Extender #if SD_CONNECTION_IS(CUSTOM_CABLE) - #define SCK_PIN PC12 - #define MISO_PIN PC8 - #define MOSI_PIN PD2 - #define SS_PIN -1 + #define SD_SCK_PIN PC12 + #define SD_MISO_PIN PC8 + #define SD_MOSI_PIN PD2 + #define SD_SS_PIN -1 #define SD_DETECT_PIN PD12 // SD_CD (if -1 no detection) #else #define SDIO_SUPPORT diff --git a/Marlin/src/pins/stm32f1/pins_FLY_MINI.h b/Marlin/src/pins/stm32f1/pins_FLY_MINI.h index 859f9fab1e..2278d55870 100644 --- a/Marlin/src/pins/stm32f1/pins_FLY_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_FLY_MINI.h @@ -133,12 +133,12 @@ // LCD / Controller // #define SPI_DEVICE 2 -#define SS_PIN PB12 -#define SCK_PIN PB13 -#define MISO_PIN PB14 -#define MOSI_PIN PB15 +#define SD_SS_PIN PB12 +#define SD_SCK_PIN PB13 +#define SD_MISO_PIN PB14 +#define SD_MOSI_PIN PB15 -#define SDSS SS_PIN +#define SDSS SD_SS_PIN #define SD_DETECT_PIN PB11 #define BEEPER_PIN PC14 diff --git a/Marlin/src/pins/stm32f1/pins_GTM32_MINI.h b/Marlin/src/pins/stm32f1/pins_GTM32_MINI.h index 52b857ac0a..5b97e7f202 100644 --- a/Marlin/src/pins/stm32f1/pins_GTM32_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_GTM32_MINI.h @@ -216,23 +216,23 @@ // // SD Card on RepRapDiscount Smart Controller (J2) or on SD_CARD connector // - #define SS_PIN PC11 - #define SCK_PIN PC12 - #define MOSI_PIN PD2 - #define MISO_PIN PC8 + #define SD_SS_PIN PC11 + #define SD_SCK_PIN PC12 + #define SD_MOSI_PIN PD2 + #define SD_MISO_PIN PC8 #define SD_DETECT_PIN PC7 #else // // Use the on-board card socket labeled TF_CARD_SOCKET // - #define SS_PIN PA4 - #define SCK_PIN PA5 - #define MOSI_PIN PA7 - #define MISO_PIN PA6 + #define SD_SS_PIN PA4 + #define SD_SCK_PIN PA5 + #define SD_MOSI_PIN PA7 + #define SD_MISO_PIN PA6 #define SD_DETECT_PIN -1 // Card detect is not connected #endif -#define SDSS SS_PIN +#define SDSS SD_SS_PIN // // ESP WiFi can be soldered to J9 connector which is wired to USART2. diff --git a/Marlin/src/pins/stm32f1/pins_GTM32_MINI_A30.h b/Marlin/src/pins/stm32f1/pins_GTM32_MINI_A30.h index 85d0be6d6b..173eb67f0d 100644 --- a/Marlin/src/pins/stm32f1/pins_GTM32_MINI_A30.h +++ b/Marlin/src/pins/stm32f1/pins_GTM32_MINI_A30.h @@ -210,23 +210,23 @@ // // SD Card on RepRapDiscount Smart Controller (J2) or on SD_CARD connector // - #define SS_PIN PC11 - #define SCK_PIN PC12 - #define MOSI_PIN PD2 - #define MISO_PIN PC8 + #define SD_SS_PIN PC11 + #define SD_SCK_PIN PC12 + #define SD_MOSI_PIN PD2 + #define SD_MISO_PIN PC8 #define SD_DETECT_PIN PC7 #else // // Use the on-board card socket labeled TF_CARD_SOCKET // - #define SS_PIN PA4 - #define SCK_PIN PA5 - #define MOSI_PIN PA7 - #define MISO_PIN PA6 + #define SD_SS_PIN PA4 + #define SD_SCK_PIN PA5 + #define SD_MOSI_PIN PA7 + #define SD_MISO_PIN PA6 #define SD_DETECT_PIN -1 // Card detect is not connected #endif -#define SDSS SS_PIN +#define SDSS SD_SS_PIN // // ESP WiFi can be soldered to J9 connector which is wired to USART2. diff --git a/Marlin/src/pins/stm32f1/pins_GTM32_PRO_VB.h b/Marlin/src/pins/stm32f1/pins_GTM32_PRO_VB.h index 52b857ac0a..5b97e7f202 100644 --- a/Marlin/src/pins/stm32f1/pins_GTM32_PRO_VB.h +++ b/Marlin/src/pins/stm32f1/pins_GTM32_PRO_VB.h @@ -216,23 +216,23 @@ // // SD Card on RepRapDiscount Smart Controller (J2) or on SD_CARD connector // - #define SS_PIN PC11 - #define SCK_PIN PC12 - #define MOSI_PIN PD2 - #define MISO_PIN PC8 + #define SD_SS_PIN PC11 + #define SD_SCK_PIN PC12 + #define SD_MOSI_PIN PD2 + #define SD_MISO_PIN PC8 #define SD_DETECT_PIN PC7 #else // // Use the on-board card socket labeled TF_CARD_SOCKET // - #define SS_PIN PA4 - #define SCK_PIN PA5 - #define MOSI_PIN PA7 - #define MISO_PIN PA6 + #define SD_SS_PIN PA4 + #define SD_SCK_PIN PA5 + #define SD_MOSI_PIN PA7 + #define SD_MISO_PIN PA6 #define SD_DETECT_PIN -1 // Card detect is not connected #endif -#define SDSS SS_PIN +#define SDSS SD_SS_PIN // // ESP WiFi can be soldered to J9 connector which is wired to USART2. diff --git a/Marlin/src/pins/stm32f1/pins_GTM32_REV_B.h b/Marlin/src/pins/stm32f1/pins_GTM32_REV_B.h index 292119ce02..b4a34a4b1e 100644 --- a/Marlin/src/pins/stm32f1/pins_GTM32_REV_B.h +++ b/Marlin/src/pins/stm32f1/pins_GTM32_REV_B.h @@ -212,24 +212,24 @@ // // SD Card on RepRapDiscount Smart Controller (J2) or on SD_CARD connector // - #define SS_PIN PB12 // PC11 - #define SCK_PIN PB13 // PC12 // PC1 - #define MOSI_PIN PB15 // PD2 // PD2 - #define MISO_PIN PB14 // PC8 + #define SD_SS_PIN PB12 // PC11 + #define SD_SCK_PIN PB13 // PC12 // PC1 + #define SD_MOSI_PIN PB15 // PD2 // PD2 + #define SD_MISO_PIN PB14 // PC8 #define SD_DETECT_PIN PC7 #else // // Use the on-board card socket labeled TF_CARD_SOCKET // - #define SS_PIN PA4 - #define SCK_PIN PA5 - #define MOSI_PIN PA7 - #define MISO_PIN PA6 // PA6 + #define SD_SS_PIN PA4 + #define SD_SCK_PIN PA5 + #define SD_MOSI_PIN PA7 + #define SD_MISO_PIN PA6 // PA6 #define SD_DETECT_PIN -1 // Card detect is not connected #endif -#define SDSS SS_PIN +#define SDSS SD_SS_PIN // // ESP WiFi can be soldered to J9 connector which is wired to USART2. diff --git a/Marlin/src/pins/stm32f1/pins_MALYAN_M200.h b/Marlin/src/pins/stm32f1/pins_MALYAN_M200.h index 95e7e92174..e33e029deb 100644 --- a/Marlin/src/pins/stm32f1/pins_MALYAN_M200.h +++ b/Marlin/src/pins/stm32f1/pins_MALYAN_M200.h @@ -41,7 +41,7 @@ #define FLASH_EEPROM_EMULATION #endif -#define SDSS SS_PIN +#define SDSS SD_SS_PIN // Based on PWM timer usage, we have to use these timers and soft PWM for the fans // On STM32F103: diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h index 21dad6df3e..ae9419ab79 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h @@ -168,9 +168,9 @@ #define SDIO_CLOCK 4500000 #define SDIO_READ_RETRIES 16 #if ENABLED(SDIO_SUPPORT) - #define SCK_PIN PB13 // SPI2 - #define MISO_PIN PB14 // SPI2 - #define MOSI_PIN PB15 // SPI2 + #define SD_SCK_PIN PB13 // SPI2 + #define SD_MISO_PIN PB14 // SPI2 + #define SD_MOSI_PIN PB15 // SPI2 /** * MKS Robin has a few hardware revisions * https://github.com/makerbase-mks/MKS-Robin/tree/master/MKS%20Robin/Hardware @@ -184,10 +184,10 @@ //#define SD_DETECT_PIN PF12 // SD_CD #else // SD as custom software SPI (SDIO pins) - #define SCK_PIN PC12 - #define MISO_PIN PC8 - #define MOSI_PIN PD2 - #define SS_PIN -1 + #define SD_SCK_PIN PC12 + #define SD_MISO_PIN PC8 + #define SD_MOSI_PIN PD2 + #define SD_SS_PIN -1 #define ONBOARD_SD_CS_PIN PC11 #define SDSS PD2 #define SD_DETECT_PIN -1 diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h index 66d90e0194..c4a7e9f408 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h @@ -180,10 +180,10 @@ // #define SPI_DEVICE 2 #define SD_DETECT_PIN PC10 -#define SCK_PIN PB13 -#define MISO_PIN PB14 -#define MOSI_PIN PB15 -#define SS_PIN PA15 +#define SD_SCK_PIN PB13 +#define SD_MISO_PIN PB14 +#define SD_MOSI_PIN PB15 +#define SD_SS_PIN PA15 #ifndef BOARD_ST7920_DELAY_1 #define BOARD_ST7920_DELAY_1 DELAY_NS(125) diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE.h index 1ad18a6497..13c2d41d57 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE.h @@ -142,7 +142,7 @@ // SPI // #define SPI_DEVICE 2 -#define SCK_PIN PB13 -#define MISO_PIN P1B4 -#define MOSI_PIN P1B5 -#define SS_PIN PA15 +#define SD_SCK_PIN PB13 +#define SD_MISO_PIN P1B4 +#define SD_MOSI_PIN P1B5 +#define SD_SS_PIN PA15 diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE3.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE3.h index 27bd4033cd..f814052fa8 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE3.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE3.h @@ -153,7 +153,7 @@ // SPI // #define SPI_DEVICE 2 -#define SCK_PIN PB13 -#define MISO_PIN PB14 -#define MOSI_PIN PB15 -#define SS_PIN PA15 +#define SD_SCK_PIN PB13 +#define SD_MISO_PIN PB14 +#define SD_MOSI_PIN PB15 +#define SD_SS_PIN PA15 diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h index 89bb41b197..39676bf9d7 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h @@ -193,10 +193,10 @@ #if SD_CONNECTION_IS(LCD) #define SD_DETECT_PIN PG3 - #define SCK_PIN PB13 - #define MISO_PIN PB14 - #define MOSI_PIN PB15 - #define SS_PIN PG6 + #define SD_SCK_PIN PB13 + #define SD_MISO_PIN PB14 + #define SD_MOSI_PIN PB15 + #define SD_SS_PIN PG6 #elif SD_CONNECTION_IS(ONBOARD) #define SDIO_SUPPORT #define SD_DETECT_PIN PD12 diff --git a/Marlin/src/pins/stm32f1/pins_TRIGORILLA_PRO.h b/Marlin/src/pins/stm32f1/pins_TRIGORILLA_PRO.h index 543a90b66b..cf1b7861ed 100644 --- a/Marlin/src/pins/stm32f1/pins_TRIGORILLA_PRO.h +++ b/Marlin/src/pins/stm32f1/pins_TRIGORILLA_PRO.h @@ -166,17 +166,17 @@ #define SPI_DEVICE 2 #if ENABLED(SDIO_SUPPORT) - #define SCK_PIN PB13 // SPI2 ok - #define MISO_PIN PB14 // SPI2 ok - #define MOSI_PIN PB15 // SPI2 ok - #define SS_PIN PC11 // PB12 is X- ok + #define SD_SCK_PIN PB13 // SPI2 ok + #define SD_MISO_PIN PB14 // SPI2 ok + #define SD_MOSI_PIN PB15 // SPI2 ok + #define SD_SS_PIN PC11 // PB12 is X- ok #define SD_DETECT_PIN -1 // SD_CD ok #else // SD as custom software SPI (SDIO pins) - #define SCK_PIN PC12 - #define MISO_PIN PC8 - #define MOSI_PIN PD2 - #define SS_PIN -1 + #define SD_SCK_PIN PC12 + #define SD_MISO_PIN PC8 + #define SD_MOSI_PIN PD2 + #define SD_SS_PIN -1 #define ONBOARD_SD_CS_PIN PC11 #define SDSS PD2 #define SD_DETECT_PIN -1 diff --git a/Marlin/src/pins/stm32f4/pins_ANET_ET4.h b/Marlin/src/pins/stm32f4/pins_ANET_ET4.h index 0721aab844..a63ed1ddf0 100644 --- a/Marlin/src/pins/stm32f4/pins_ANET_ET4.h +++ b/Marlin/src/pins/stm32f4/pins_ANET_ET4.h @@ -210,9 +210,9 @@ #if DISABLED(SDIO_SUPPORT) #define SOFTWARE_SPI #define SDSS SDIO_D3_PIN - #define SCK_PIN SDIO_CK_PIN - #define MISO_PIN SDIO_D0_PIN - #define MOSI_PIN SDIO_CMD_PIN + #define SD_SCK_PIN SDIO_CK_PIN + #define SD_MISO_PIN SDIO_D0_PIN + #define SD_MOSI_PIN SDIO_CMD_PIN #endif #ifndef SD_DETECT_PIN diff --git a/Marlin/src/pins/stm32f4/pins_BLACK_STM32F407VE.h b/Marlin/src/pins/stm32f4/pins_BLACK_STM32F407VE.h index 4b981c9251..c2ad907e04 100644 --- a/Marlin/src/pins/stm32f4/pins_BLACK_STM32F407VE.h +++ b/Marlin/src/pins/stm32f4/pins_BLACK_STM32F407VE.h @@ -156,8 +156,8 @@ #ifndef SDIO_SUPPORT #define SOFTWARE_SPI // Use soft SPI for onboard SD #define SDSS SDIO_D3_PIN - #define SCK_PIN SDIO_CK_PIN - #define MISO_PIN SDIO_D0_PIN - #define MOSI_PIN SDIO_CMD_PIN + #define SD_SCK_PIN SDIO_CK_PIN + #define SD_MISO_PIN SDIO_D0_PIN + #define SD_MOSI_PIN SDIO_CMD_PIN #endif #endif diff --git a/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h b/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h index af2ebce9ed..939bc1eccd 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h @@ -175,10 +175,10 @@ // HAL SPI1 pins #define CUSTOM_SPI_PINS #if ENABLED(CUSTOM_SPI_PINS) - #define SCK_PIN PA5 // SPI1 SCLK - #define SS_PIN PA4 // SPI1 SSEL - #define MISO_PIN PA6 // SPI1 MISO - #define MOSI_PIN PA7 // SPI1 MOSI + #define SD_SCK_PIN PA5 // SPI1 SCLK + #define SD_SS_PIN PA4 // SPI1 SSEL + #define SD_MISO_PIN PA6 // SPI1 MISO + #define SD_MOSI_PIN PA7 // SPI1 MOSI #endif // diff --git a/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h b/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h index d8a6e453fe..981064fa4d 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h @@ -341,10 +341,10 @@ // Instruct the STM32 HAL to override the default SPI pins from the variant.h file #define CUSTOM_SPI_PINS #define SDSS PA4 - #define SS_PIN SDSS - #define SCK_PIN PA5 - #define MISO_PIN PA6 - #define MOSI_PIN PA7 + #define SD_SS_PIN SDSS + #define SD_SCK_PIN PA5 + #define SD_MISO_PIN PA6 + #define SD_MOSI_PIN PA7 #define SD_DETECT_PIN PC4 #elif SD_CONNECTION_IS(CUSTOM_CABLE) diff --git a/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h b/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h index be05ebcfa9..54153beb1e 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h @@ -303,9 +303,9 @@ // 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_SCK_PIN PA5 + #define SD_MISO_PIN PA6 + #define SD_MOSI_PIN PB5 #define SD_DETECT_PIN PB11 #elif SD_CONNECTION_IS(CUSTOM_CABLE) diff --git a/Marlin/src/pins/stm32f4/pins_FLYF407ZG.h b/Marlin/src/pins/stm32f4/pins_FLYF407ZG.h index 933ee532a9..7965d262c3 100644 --- a/Marlin/src/pins/stm32f4/pins_FLYF407ZG.h +++ b/Marlin/src/pins/stm32f4/pins_FLYF407ZG.h @@ -196,16 +196,16 @@ #ifndef SDIO_SUPPORT #define SOFTWARE_SPI // Use soft SPI for onboard SD #define SDSS SDIO_D3_PIN - #define SCK_PIN SDIO_CK_PIN - #define MISO_PIN SDIO_D0_PIN - #define MOSI_PIN SDIO_CMD_PIN + #define SD_SCK_PIN SDIO_CK_PIN + #define SD_MISO_PIN SDIO_D0_PIN + #define SD_MOSI_PIN SDIO_CMD_PIN #endif #elif SD_CONNECTION_IS(LCD) - #define SCK_PIN PB13 - #define MISO_PIN PB14 - #define MOSI_PIN PB15 + #define SD_SCK_PIN PB13 + #define SD_MISO_PIN PB14 + #define SD_MOSI_PIN PB15 #define SDSS PF11 #define SD_DETECT_PIN PB2 diff --git a/Marlin/src/pins/stm32f4/pins_FYSETC_S6.h b/Marlin/src/pins/stm32f4/pins_FYSETC_S6.h index 7616d744cb..7d435c8cd5 100644 --- a/Marlin/src/pins/stm32f4/pins_FYSETC_S6.h +++ b/Marlin/src/pins/stm32f4/pins_FYSETC_S6.h @@ -180,9 +180,9 @@ // // SPI // -#define SCK_PIN PA5 -#define MISO_PIN PA6 -#define MOSI_PIN PA7 +#define SD_SCK_PIN PA5 +#define SD_MISO_PIN PA6 +#define SD_MOSI_PIN PA7 // // Misc. Functions diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h index 688c321c72..18cbdeaaf5 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_K.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_K.h @@ -153,10 +153,10 @@ #define KILL_PIN -1 #define POWER_LOSS_PIN PA4 // Power-loss / nAC_FAULT -#define SCK_PIN PC12 -#define MISO_PIN PC8 -#define MOSI_PIN PD2 -#define SS_PIN PC11 +#define SD_SCK_PIN PC12 +#define SD_MISO_PIN PC8 +#define SD_MOSI_PIN PD2 +#define SD_SS_PIN PC11 #define SD_DETECT_PIN PA8 #define BEEPER_PIN PC7 diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h index 8775847738..486aabfd8e 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h @@ -158,10 +158,10 @@ #define SDIO_SUPPORT #define SDIO_CLOCK 4800000 -#define SCK_PIN PC12 -#define MISO_PIN PC8 -#define MOSI_PIN PD2 -#define SS_PIN PC11 +#define SD_SCK_PIN PC12 +#define SD_MISO_PIN PC8 +#define SD_MOSI_PIN PD2 +#define SD_SS_PIN PC11 #define SD_DETECT_PIN PG15 diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_X.h b/Marlin/src/pins/stm32f4/pins_LERDGE_X.h index ebf7120a44..c73b9927ac 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_X.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_X.h @@ -117,10 +117,10 @@ // Lerdge supports auto-power off and power loss sense through a single pin. #define POWER_LOSS_PIN PC14 // Power-loss / nAC_FAULT -#define SCK_PIN PC12 -#define MISO_PIN PC8 -#define MOSI_PIN PD2 -#define SS_PIN PC11 +#define SD_SCK_PIN PC12 +#define SD_MISO_PIN PC8 +#define SD_MOSI_PIN PD2 +#define SD_SS_PIN PC11 // // SD support diff --git a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h index 81edff6793..47997c4677 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h @@ -217,11 +217,11 @@ #define CUSTOM_SPI_PINS // TODO: needed because is the only way to set SPI3 for SD on STM32 (by now) #if ENABLED(CUSTOM_SPI_PINS) #define ENABLE_SPI3 - #define SS_PIN -1 + #define SD_SS_PIN -1 #define SDSS PC9 - #define SCK_PIN PC10 - #define MISO_PIN PC11 - #define MOSI_PIN PC12 + #define SD_SCK_PIN PC10 + #define SD_MISO_PIN PC11 + #define SD_MOSI_PIN PC12 #define SD_DETECT_PIN PD12 #endif #endif @@ -234,9 +234,9 @@ #if ENABLED(CUSTOM_SPI_PINS) #define ENABLE_SPI1 #define SDSS PE10 - #define SCK_PIN PA5 - #define MISO_PIN PA6 - #define MOSI_PIN PA7 + #define SD_SCK_PIN PA5 + #define SD_MISO_PIN PA6 + #define SD_MOSI_PIN PA7 #define SD_DETECT_PIN PE12 #endif #endif diff --git a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h index 719f8773f5..5533e35f07 100644 --- a/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h +++ b/Marlin/src/pins/stm32f4/pins_MKS_ROBIN_PRO_V2.h @@ -220,11 +220,11 @@ #define SD_SPI MARLIN_SPI(HardwareSPI3, PC9) #else #define ENABLE_SPI3 - #define SS_PIN -1 + #define SD_SS_PIN -1 #define SDSS PC9 - #define SCK_PIN PC10 - #define MISO_PIN PC11 - #define MOSI_PIN PC12 + #define SD_SCK_PIN PC10 + #define SD_MISO_PIN PC11 + #define SD_MOSI_PIN PC12 #endif #define SD_DETECT_PIN PD12 #endif @@ -239,9 +239,9 @@ #if ENABLED(CUSTOM_SPI_PINS) #define ENABLE_SPI1 #define SDSS PE10 - #define SCK_PIN PA5 - #define MISO_PIN PA6 - #define MOSI_PIN PA7 + #define SD_SCK_PIN PA5 + #define SD_MISO_PIN PA6 + #define SD_MOSI_PIN PA7 #define SD_DETECT_PIN PE12 #endif #endif diff --git a/Marlin/src/pins/stm32f4/pins_RUMBA32_common.h b/Marlin/src/pins/stm32f4/pins_RUMBA32_common.h index 959e893edc..2a0cfa897c 100644 --- a/Marlin/src/pins/stm32f4/pins_RUMBA32_common.h +++ b/Marlin/src/pins/stm32f4/pins_RUMBA32_common.h @@ -126,9 +126,9 @@ // // SPI // -#define SCK_PIN PA5 -#define MISO_PIN PA6 -#define MOSI_PIN PA7 +#define SD_SCK_PIN PA5 +#define SD_MISO_PIN PA6 +#define SD_MOSI_PIN PA7 // // Misc. Functions diff --git a/Marlin/src/pins/stm32f4/pins_STEVAL_3DP001V1.h b/Marlin/src/pins/stm32f4/pins_STEVAL_3DP001V1.h index 0278dd8434..25679517c2 100644 --- a/Marlin/src/pins/stm32f4/pins_STEVAL_3DP001V1.h +++ b/Marlin/src/pins/stm32f4/pins_STEVAL_3DP001V1.h @@ -120,13 +120,13 @@ #define L6470_CHAIN_MOSI_PIN 19 // PA7 #define L6470_CHAIN_SS_PIN 16 // PA4 - //#define SCK_PIN L6470_CHAIN_SCK_PIN - //#define MISO_PIN L6470_CHAIN_MISO_PIN - //#define MOSI_PIN L6470_CHAIN_MOSI_PIN + //#define SD_SCK_PIN L6470_CHAIN_SCK_PIN + //#define SD_MISO_PIN L6470_CHAIN_MISO_PIN + //#define SD_MOSI_PIN L6470_CHAIN_MOSI_PIN #else - //#define SCK_PIN 13 // PB13 SPI_S - //#define MISO_PIN 12 // PB14 SPI_M - //#define MOSI_PIN 11 // PB15 SPI_M + //#define SD_SCK_PIN 13 // PB13 SPI_S + //#define SD_MISO_PIN 12 // PB14 SPI_M + //#define SD_MOSI_PIN 11 // PB15 SPI_M #endif /** @@ -249,9 +249,9 @@ #define SOFTWARE_SPI // Use soft SPI for onboard SD #undef SDSS #define SDSS SDIO_D3_PIN - #define SCK_PIN SDIO_CK_PIN - #define MISO_PIN SDIO_D0_PIN - #define MOSI_PIN SDIO_CMD_PIN + #define SD_SCK_PIN SDIO_CK_PIN + #define SD_MISO_PIN SDIO_D0_PIN + #define SD_MOSI_PIN SDIO_CMD_PIN #endif #endif diff --git a/Marlin/src/pins/stm32f4/pins_VAKE403D.h b/Marlin/src/pins/stm32f4/pins_VAKE403D.h index e2463fd47e..1135af847f 100644 --- a/Marlin/src/pins/stm32f4/pins_VAKE403D.h +++ b/Marlin/src/pins/stm32f4/pins_VAKE403D.h @@ -99,16 +99,16 @@ #define E1_CS_PIN PB0 #endif -#define SCK_PIN PE12 // PA5 // SPI1 for SD card -#define MISO_PIN PE13 // PA6 -#define MOSI_PIN PE14 // PA7 +#define SD_SCK_PIN PE12 // PA5 // SPI1 for SD card +#define SD_MISO_PIN PE13 // PA6 +#define SD_MOSI_PIN PE14 // PA7 // added for SD card : optional or not ??? //#define SD_CHIP_SELECT_PIN SDSS // The default chip select pin for the SD card is SS. // The following three pins must not be redefined for hardware SPI. -//#define SPI_MOSI_PIN MOSI_PIN // SPI Master Out Slave In pin -//#define SPI_MISO_PIN MISO_PIN // SPI Master In Slave Out pin -//#define SPI_SCK_PIN SCK_PIN // SPI Clock pin +//#define SPI_MOSI_PIN SD_MOSI_PIN // SPI Master Out Slave In pin +//#define SPI_MISO_PIN SD_MISO_PIN // SPI Master In Slave Out pin +//#define SPI_SCK_PIN SD_SCK_PIN // SPI Clock pin // // Temperature Sensors (Analog inputs) @@ -159,7 +159,7 @@ #if ENABLED(SDSUPPORT) #define SD_DETECT_PIN PB7 - #define SS_PIN PB_15 // USD_CS -> CS for onboard SD + #define SD_SS_PIN PB_15 // USD_CS -> CS for onboard SD #endif // diff --git a/Marlin/src/pins/stm32f7/pins_NUCLEO_F767ZI.h b/Marlin/src/pins/stm32f7/pins_NUCLEO_F767ZI.h index 466cce565d..5e50548c9b 100644 --- a/Marlin/src/pins/stm32f7/pins_NUCLEO_F767ZI.h +++ b/Marlin/src/pins/stm32f7/pins_NUCLEO_F767ZI.h @@ -170,10 +170,10 @@ #define SERVO1_PIN PB5 // PWM Capable, TIM3_CH2 // SPI for external SD Card (Not entirely sure this will work) -#define SCK_PIN PA5 -#define MISO_PIN PA6 -#define MOSI_PIN PA7 -#define SS_PIN PA4 +#define SD_SCK_PIN PA5 +#define SD_MISO_PIN PA6 +#define SD_MOSI_PIN PA7 +#define SD_SS_PIN PA4 #define SDSS PA4 #define LED_PIN LED_BLUE diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index 88b42f836d..7b162f7343 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -379,9 +379,9 @@ void CardReader::mount() { flag.mounted = false; if (root.isOpen()) root.close(); - if (!sd2card.init(SPI_SPEED, SDSS) + if (!sd2card.init(SD_SPI_SPEED, SDSS) #if defined(LCD_SDSS) && (LCD_SDSS != SDSS) - && !sd2card.init(SPI_SPEED, LCD_SDSS) + && !sd2card.init(SD_SPI_SPEED, LCD_SDSS) #endif ) SERIAL_ECHO_MSG(STR_SD_INIT_FAIL); else if (!volume.init(&sd2card)) diff --git a/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp b/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp index 28a18cd9d8..c6e3c73f52 100644 --- a/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp +++ b/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp @@ -50,7 +50,7 @@ #if ENABLED(USE_UHS3_USB) #define NO_AUTO_SPEED - #define UHS_MAX3421E_SPD 8000000 >> SPI_SPEED + #define UHS_MAX3421E_SPD 8000000 >> SD_SPI_SPEED #define UHS_DEVICE_WINDOWS_USB_SPEC_VIOLATION_DESCRIPTOR_DEVICE 1 #define UHS_HOST_MAX_INTERFACE_DRIVERS 2 #define MASS_MAX_SUPPORTED_LUN 1 diff --git a/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.h b/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.h index 83245168ab..e6980a03aa 100644 --- a/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.h +++ b/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.h @@ -42,7 +42,7 @@ #define SD_CHIP_SELECT_PIN 10 // Software SPI chip select pin for the SD #else // hardware pin defs - #define SD_CHIP_SELECT_PIN SS_PIN // The default chip select pin for the SD card is SS. + #define SD_CHIP_SELECT_PIN SD_SS_PIN // The default chip select pin for the SD card is SS. #endif #endif diff --git a/Marlin/src/sd/usb_flashdrive/lib-uhs2/usbhost.cpp b/Marlin/src/sd/usb_flashdrive/lib-uhs2/usbhost.cpp index 358b49d5b4..190a0f1a9e 100644 --- a/Marlin/src/sd/usb_flashdrive/lib-uhs2/usbhost.cpp +++ b/Marlin/src/sd/usb_flashdrive/lib-uhs2/usbhost.cpp @@ -114,13 +114,7 @@ bool MAX3421e::start() { ncs(); spiBegin(); - spiInit( - #ifdef SPI_SPEED - SPI_SPEED - #else - SPI_FULL_SPEED - #endif - ); + spiInit(SD_SPI_SPEED); // MAX3421e - full-duplex, level interrupt, vbus off. regWr(rPINCTL, (bmFDUPSPI | bmINTLEVEL | GPX_VBDET));