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:
parent
a98f21ec5e
commit
0b2d686160
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user