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
This commit is contained in:
jmz52 2018-08-18 07:27:10 +03:00 committed by Scott Lahteine
parent a98f21ec5e
commit 0b2d686160

View file

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