Hi All,
Redirected here by greiman of SDFat.
I build a custom board of which allows for an SD card to be connected to the T 4.0. I am getting odd results when it comes to writing to the SD card.
If I write to the SD once every 800ms, this works, but anything quicker than 800ms and the SD becomes unformatted.
Quick example as code is massive:
Code:
char newTextToAdd[500];
String testCode = "This is a test";
testCode.toCharArray(newTextToAdd, sizeof(newTextToAdd));
file.open(csFileName, FILE_WRITE);
file.write(newTextToAdd, tt.length());
file.close();
delay(800);
So I was thinking there was an issue with my code, however I ran the SDIO demo by greiman and I yield the following results:
Code:
FIFO SDIO mode.
size,write,read
bytes,KB/sec,KB/sec
512,11018.91,11716.91
1024,10819.65,11723.24
2048,11083.92,11726.17
4096,11071.23,11754.79
8192,10952.82,11765.29
16384,Error: write failed
SD_CARD_ERROR_CMD12, ErrorData: 0X0
Again, the SD becomes unformatted. Greiman suggest that I alter the drive strength https://github.com/greiman/SdFat/blo...eensy.cpp#L339 and frequency https://github.com/greiman/SdFat/blo...eensy.cpp#L730 in the teensy source code.
I now suspect the SD is becoming unformatted because the card is too far away from the T4.0 on the PCB.
Can anyone please advise what frequency/drive strength should be selected to (boost the signal)?
NB: The SD either becomes unformatted or unresponsive, until power is cycled (or I call sd.begin(SD_CONFIG) again). I am using multiple SanDisk SDHC/SDXC (v30)s purchased from different sources and am confident they are all genuine.
Many Thanks