Browse Source

Fix "SD init fail" problem for STM32F1 (#11579)

Fix "SD init fail" problem for STM32F1 caused by incorrect SS pin state and incorrect SPI mode. Issue #11225
pull/1/head
jmz52 6 years ago
committed by Scott Lahteine
parent
commit
0b2d686160
  1. 4
      Marlin/src/HAL/HAL_STM32F1/HAL_spi_Stm32f1.cpp

4
Marlin/src/HAL/HAL_STM32F1/HAL_spi_Stm32f1.cpp

@ -81,8 +81,8 @@ void spiBegin() {
#if !PIN_EXISTS(SS)
#error "SS_PIN not defined!"
#endif
WRITE(SS_PIN, HIGH);
SET_OUTPUT(SS_PIN);
WRITE(SS_PIN, HIGH);
}
/**
@ -104,7 +104,7 @@ void spiInit(uint8_t spiRate) {
case SPI_SPEED_6: clock = SPI_CLOCK_DIV64; break;
default: clock = SPI_CLOCK_DIV2; // Default from the SPI library
}
spiConfig = SPISettings(clock, MSBFIRST, SPI_MODE0);
spiConfig = SPISettings(clock, MSBFIRST, SPI_MODE3);
SPI.begin();
}

Loading…
Cancel
Save