WIP
This commit is contained in:
parent
2a2019ea55
commit
72001ffce3
|
@ -62,7 +62,6 @@
|
||||||
#define MAX_BLOCKSIZE 2048 // Maximum BLOCK size
|
#define MAX_BLOCKSIZE 2048 // Maximum BLOCK size
|
||||||
|
|
||||||
// SDFAT
|
// SDFAT
|
||||||
#define SD1_CONFIG SdSpiConfig(PA4, DEDICATED_SPI, SD_SCK_MHZ(SPI_FULL_SPEED), &SPI)
|
|
||||||
SdFs SD;
|
SdFs SD;
|
||||||
|
|
||||||
#if DEBUG == 1
|
#if DEBUG == 1
|
||||||
|
@ -272,7 +271,7 @@ byte SCSI_INFO_BUF[36] = {
|
||||||
void onFalseInit(void);
|
void onFalseInit(void);
|
||||||
void noSDCardFound(void);
|
void noSDCardFound(void);
|
||||||
void onBusReset(void);
|
void onBusReset(void);
|
||||||
void initFileLog(void);
|
void initFileLog(int);
|
||||||
void finalizeFileLog(void);
|
void finalizeFileLog(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -439,14 +438,26 @@ void setup()
|
||||||
|
|
||||||
LED_ON();
|
LED_ON();
|
||||||
|
|
||||||
// clock = 36MHz , about 4Mbytes/sec
|
int mhz = 50;
|
||||||
if(!SD.begin(SD1_CONFIG)) {
|
bool sdReady = false;
|
||||||
|
while (mhz >= 32 && !sdReady)
|
||||||
|
{
|
||||||
|
if(SD.begin(SdSpiConfig(PA4, DEDICATED_SPI, SD_SCK_MHZ(mhz), &SPI))) {
|
||||||
|
sdReady = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mhz--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!sdReady) {
|
||||||
#if DEBUG > 0
|
#if DEBUG > 0
|
||||||
Serial.println("SD initialization failed!");
|
Serial.println("SD initialization failed!");
|
||||||
#endif
|
#endif
|
||||||
noSDCardFound();
|
noSDCardFound();
|
||||||
}
|
}
|
||||||
initFileLog();
|
initFileLog(mhz);
|
||||||
|
|
||||||
readSCSIDeviceConfig();
|
readSCSIDeviceConfig();
|
||||||
readSDCardInfo();
|
readSDCardInfo();
|
||||||
|
|
||||||
|
@ -544,7 +555,7 @@ void setup()
|
||||||
/*
|
/*
|
||||||
* Setup initialization logfile
|
* Setup initialization logfile
|
||||||
*/
|
*/
|
||||||
void initFileLog() {
|
void initFileLog(int mhz) {
|
||||||
LOG_FILE = SD.open(LOG_FILENAME, O_WRONLY | O_CREAT | O_TRUNC);
|
LOG_FILE = SD.open(LOG_FILENAME, O_WRONLY | O_CREAT | O_TRUNC);
|
||||||
LOG_FILE.println("BlueSCSI <-> SD - https://github.com/erichelgeson/BlueSCSI");
|
LOG_FILE.println("BlueSCSI <-> SD - https://github.com/erichelgeson/BlueSCSI");
|
||||||
LOG_FILE.print("VERSION: ");
|
LOG_FILE.print("VERSION: ");
|
||||||
|
@ -559,6 +570,10 @@ void initFileLog() {
|
||||||
LOG_FILE.println(SD_FAT_VERSION_STR);
|
LOG_FILE.println(SD_FAT_VERSION_STR);
|
||||||
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.print("SD1_Config: ");
|
||||||
|
LOG_FILE.print(mhz);
|
||||||
|
LOG_FILE.println(" Mhz");
|
||||||
|
LOG_FILE.sync();
|
||||||
LOG_FILE.println("Initialized SD Card - lets go!");
|
LOG_FILE.println("Initialized SD Card - lets go!");
|
||||||
LOG_FILE.sync();
|
LOG_FILE.sync();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue