Revert "We only need to test 50 and 25 as the rest are just divided and rounded to full and half."
This reverts commit 1cfaf00594
.
This commit is contained in:
parent
5bb2dee71f
commit
dc0bce859c
|
@ -450,20 +450,21 @@ void setup()
|
||||||
//Occurs when the RST pin state changes from HIGH to LOW
|
//Occurs when the RST pin state changes from HIGH to LOW
|
||||||
//attachInterrupt(RST, onBusReset, FALLING);
|
//attachInterrupt(RST, onBusReset, FALLING);
|
||||||
|
|
||||||
// Try Full and half clock speeds.
|
// Try different clock speeds till we find one that is stable.
|
||||||
LED_ON();
|
LED_ON();
|
||||||
int mhz = 0;
|
int mhz = 50;
|
||||||
if (SD.begin(SdSpiConfig(PA4, DEDICATED_SPI, SD_SCK_MHZ(50), &SPI)))
|
bool sd_ready = false;
|
||||||
{
|
while (mhz > 25 && !sd_ready) {
|
||||||
mhz = 50;
|
if(SD.begin(SdSpiConfig(PA4, DEDICATED_SPI, SD_SCK_MHZ(mhz), &SPI))) {
|
||||||
}
|
sd_ready = true;
|
||||||
else if (SD.begin(SdSpiConfig(PA4, DEDICATED_SPI, SD_SCK_MHZ(25), &SPI)))
|
}
|
||||||
{
|
else {
|
||||||
mhz = 25;
|
mhz--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
LED_OFF();
|
LED_OFF();
|
||||||
|
|
||||||
if(mhz == 0) {
|
if(!sd_ready) {
|
||||||
#if DEBUG > 0
|
#if DEBUG > 0
|
||||||
Serial.println("SD initialization failed!");
|
Serial.println("SD initialization failed!");
|
||||||
#endif
|
#endif
|
||||||
|
@ -669,9 +670,6 @@ void initFileLog(int success_mhz) {
|
||||||
LOG_FILE.print("SPI speed: ");
|
LOG_FILE.print("SPI speed: ");
|
||||||
LOG_FILE.print(success_mhz);
|
LOG_FILE.print(success_mhz);
|
||||||
LOG_FILE.println("Mhz");
|
LOG_FILE.println("Mhz");
|
||||||
if(success_mhz == 25) {
|
|
||||||
LOG_FILE.println("SPI running at half speed - read https://github.com/erichelgeson/BlueSCSI/wiki/Slow-SPI");
|
|
||||||
}
|
|
||||||
LOG_FILE.print("SdFat Max FileName Length: ");
|
LOG_FILE.print("SdFat Max FileName Length: ");
|
||||||
LOG_FILE.println(MAX_FILE_PATH);
|
LOG_FILE.println(MAX_FILE_PATH);
|
||||||
LOG_FILE.println("Initialized SD Card - let's go!");
|
LOG_FILE.println("Initialized SD Card - let's go!");
|
||||||
|
|
Loading…
Reference in New Issue