Browse Source

Prefix SD SPI pins (SCK, MISO, MOSI, SS) (#20606)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
vanilla_fb_2.0.x
Victor Oliveira 3 years ago
committed by Scott Lahteine
parent
commit
2c58d0881b
  1. 10
      Marlin/Configuration.h
  2. 10
      Marlin/Configuration_adv.h
  3. 28
      Marlin/src/HAL/AVR/HAL_SPI.cpp
  4. 16
      Marlin/src/HAL/AVR/spi_pins.h
  5. 88
      Marlin/src/HAL/DUE/HAL_SPI.cpp
  6. 2
      Marlin/src/HAL/DUE/inc/SanityCheck.h
  7. 20
      Marlin/src/HAL/DUE/spi_pins.h
  8. 6
      Marlin/src/HAL/ESP32/HAL_SPI.cpp
  9. 8
      Marlin/src/HAL/ESP32/spi_pins.h
  10. 33
      Marlin/src/HAL/LINUX/spi_pins.h
  11. 41
      Marlin/src/HAL/LPC1768/HAL_SPI.cpp
  12. 8
      Marlin/src/HAL/LPC1768/inc/SanityCheck.h
  13. 6
      Marlin/src/HAL/LPC1768/main.cpp
  14. 28
      Marlin/src/HAL/LPC1768/spi_pins.h
  15. 8
      Marlin/src/HAL/LPC1768/tft/xpt2046.h
  16. 16
      Marlin/src/HAL/LPC1768/u8g/u8g_com_HAL_LPC1768_hw_spi.cpp
  17. 16
      Marlin/src/HAL/SAMD51/spi_pins.h
  18. 26
      Marlin/src/HAL/STM32/HAL_SPI.cpp
  19. 16
      Marlin/src/HAL/STM32/spi_pins.h
  20. 4
      Marlin/src/HAL/STM32F1/HAL_SPI.cpp
  21. 20
      Marlin/src/HAL/STM32F1/spi_pins.h
  22. 8
      Marlin/src/HAL/STM32F1/tft/xpt2046.h
  23. 14
      Marlin/src/HAL/TEENSY31_32/HAL_SPI.cpp
  24. 8
      Marlin/src/HAL/TEENSY31_32/spi_pins.h
  25. 14
      Marlin/src/HAL/TEENSY35_36/HAL_SPI.cpp
  26. 8
      Marlin/src/HAL/TEENSY35_36/spi_pins.h
  27. 14
      Marlin/src/HAL/TEENSY40_41/HAL_SPI.cpp
  28. 8
      Marlin/src/HAL/TEENSY40_41/spi_pins.h
  29. 2
      Marlin/src/feature/dac/dac_dac084s085.cpp
  30. 6
      Marlin/src/inc/Conditionals_LCD.h
  31. 6
      Marlin/src/inc/Conditionals_post.h
  32. 4
      Marlin/src/inc/SanityCheck.h
  33. 6
      Marlin/src/lcd/dogm/marlinui_DOGM.h
  34. 2
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/archim2-flash/media_file_reader.cpp
  35. 2
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/basic/spi.cpp
  36. 2
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/media_player_screen.cpp
  37. 8
      Marlin/src/libs/private_spi.h
  38. 4
      Marlin/src/module/temperature.cpp
  39. 6
      Marlin/src/pins/esp32/pins_E4D.h
  40. 6
      Marlin/src/pins/esp32/pins_FYSETC_E4.h
  41. 6
      Marlin/src/pins/esp32/pins_MRR_ESPA.h
  42. 6
      Marlin/src/pins/esp32/pins_MRR_ESPE.h
  43. 16
      Marlin/src/pins/lpc1768/pins_AZSMZ_MINI.h
  44. 10
      Marlin/src/pins/lpc1768/pins_BIQU_B300_V1.0.h
  45. 10
      Marlin/src/pins/lpc1768/pins_BIQU_BQ111_A4.h
  46. 2
      Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_1.h
  47. 2
      Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h
  48. 8
      Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h
  49. 14
      Marlin/src/pins/lpc1768/pins_BTT_SKR_common.h
  50. 16
      Marlin/src/pins/lpc1768/pins_GMARSH_X6_REV1.h
  51. 39
      Marlin/src/pins/lpc1768/pins_MKS_SBASE.h
  52. 10
      Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h
  53. 25
      Marlin/src/pins/lpc1768/pins_RAMPS_RE_ARM.h
  54. 20
      Marlin/src/pins/lpc1769/pins_AZTEEG_X5_MINI.h
  55. 8
      Marlin/src/pins/lpc1769/pins_BTT_SKR_E3_TURBO.h
  56. 21
      Marlin/src/pins/lpc1769/pins_COHESION3D_REMIX.h
  57. 16
      Marlin/src/pins/lpc1769/pins_FLY_CDY.h
  58. 10
      Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h
  59. 8
      Marlin/src/pins/lpc1769/pins_SMOOTHIEBOARD.h
  60. 8
      Marlin/src/pins/lpc1769/pins_TH3D_EZBOARD.h
  61. 8
      Marlin/src/pins/pinsDebug_list.h
  62. 6
      Marlin/src/pins/ramps/pins_DUPLICATOR_I3_PLUS.h
  63. 6
      Marlin/src/pins/sam/pins_ARCHIM1.h
  64. 6
      Marlin/src/pins/sam/pins_ARCHIM2.h
  65. 6
      Marlin/src/pins/sam/pins_CNCONTROLS_15D.h
  66. 6
      Marlin/src/pins/sam/pins_PRINTRBOARD_G2.h
  67. 6
      Marlin/src/pins/sam/pins_ULTRATRONICS_PRO.h
  68. 8
      Marlin/src/pins/sanguino/pins_MELZI_CREALITY.h
  69. 6
      Marlin/src/pins/sanguino/pins_ZMIB_V2.h
  70. 2
      Marlin/src/pins/stm32f0/pins_MALYAN_M300.h
  71. 2
      Marlin/src/pins/stm32f1/pins_BTT_SKR_E3_DIP.h
  72. 2
      Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_E3_common.h
  73. 16
      Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_V1_1.h
  74. 8
      Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h
  75. 8
      Marlin/src/pins/stm32f1/pins_CHITU3D_V5.h
  76. 8
      Marlin/src/pins/stm32f1/pins_CHITU3D_V6.h
  77. 14
      Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h
  78. 10
      Marlin/src/pins/stm32f1/pins_FLY_MINI.h
  79. 18
      Marlin/src/pins/stm32f1/pins_GTM32_MINI.h
  80. 18
      Marlin/src/pins/stm32f1/pins_GTM32_MINI_A30.h
  81. 18
      Marlin/src/pins/stm32f1/pins_GTM32_PRO_VB.h
  82. 18
      Marlin/src/pins/stm32f1/pins_GTM32_REV_B.h
  83. 2
      Marlin/src/pins/stm32f1/pins_MALYAN_M200.h
  84. 14
      Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h
  85. 8
      Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h
  86. 8
      Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE.h
  87. 8
      Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE3.h
  88. 8
      Marlin/src/pins/stm32f1/pins_MKS_ROBIN_PRO.h
  89. 16
      Marlin/src/pins/stm32f1/pins_TRIGORILLA_PRO.h
  90. 6
      Marlin/src/pins/stm32f4/pins_ANET_ET4.h
  91. 6
      Marlin/src/pins/stm32f4/pins_BLACK_STM32F407VE.h
  92. 8
      Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h
  93. 8
      Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h
  94. 6
      Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h
  95. 12
      Marlin/src/pins/stm32f4/pins_FLYF407ZG.h
  96. 6
      Marlin/src/pins/stm32f4/pins_FYSETC_S6.h
  97. 8
      Marlin/src/pins/stm32f4/pins_LERDGE_K.h
  98. 8
      Marlin/src/pins/stm32f4/pins_LERDGE_S.h
  99. 8
      Marlin/src/pins/stm32f4/pins_LERDGE_X.h
  100. 14
      Marlin/src/pins/stm32f4/pins_MKS_ROBIN_NANO_V3.h

10
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
*

10
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.

28
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();
}

16
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

88
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);

2
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)

20
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

6
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) {

8
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

33
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

41
Marlin/src/HAL/LPC1768/HAL_SPI.cpp

@ -55,27 +55,33 @@
#include <lpc17xx_pinsel.h>
#include <lpc17xx_clkpwr.h>
#include "../shared/HAL_SPI.h"
// ------------------------
// Public functions
// ------------------------
#if ENABLED(LPC_SOFTWARE_SPI)
// Software SPI
#include <SoftwareSPI.h>
// Software SPI
#ifndef HAL_SPI_SPEED
#define HAL_SPI_SPEED SPI_FULL_SPEED
#endif
static uint8_t SPI_speed = 0;
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

8
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

6
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

28
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

8
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

16
Marlin/src/HAL/LPC1768/u8g/u8g_com_HAL_LPC1768_hw_spi.cpp

@ -62,10 +62,13 @@
#include <U8glib.h>
#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) */

16
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

26
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();

16
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

4
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
}

20
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

8
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

14
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

8
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

14
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

8
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

14
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

8
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

2
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)

6
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
/**

6
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

4
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)

6
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

2
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);

2
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

2
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.

8
Marlin/src/libs/private_spi.h

@ -35,12 +35,12 @@ class SPIclass {
// Hardware SPI
template<>
class SPIclass<MISO_PIN, MOSI_PIN, SCK_PIN> {
class SPIclass<SD_MISO_PIN, SD_MOSI_PIN, SD_SCK_PIN> {
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__)

4
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<uint8_t MisoPin, uint8_t MosiPin, uint8_t SckPin> SoftSPI<MisoPin, MosiPin, SckPin> SPIclass<MisoPin, MosiPin, SckPin>::softSPI;
SPIclass<MAX6675_DO_PIN, MOSI_PIN, MAX6675_SCK_PIN> max6675_spi;
SPIclass<MAX6675_DO_PIN, SD_MOSI_PIN, MAX6675_SCK_PIN> max6675_spi;
#endif
// Init fans according to whether they're native PWM or Software PWM

6
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

6
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

6
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

6
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

16
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

10
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
/**

10
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

2
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

2
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
/**

8
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

14
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

16
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

39
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)

10
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."

25
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

20
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

8
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

21
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

16
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

10
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."

8
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

8
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

8
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)

6
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

6
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

6
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

6
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

6
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
/**

6
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

8
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

6
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

2
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

2
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

2
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

16
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

8
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

8
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

8
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

14
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

10
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

18
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.

18
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.

18
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.

18
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.

2
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:

14
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

8
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)

8
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

8
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

8
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

16
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

6
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

6
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

8
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
//

8
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)

6
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)

12
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

6
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

8
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

8
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

8
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

14
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

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save