Writing to an SD Card

18 Jun 2011

I'm trying to write to an micro SD card within a 10ms window. Until now I've been trying to use the FATFile System using:
fopen();
fprinf();
fclose();
However the write time is too slow, around 40ms I was reading that CHAN_FATFS was the best solution to increase write time, however the function keeps timing out at:

    f_open(&MyFile,"TextFile.txt",FA_WRITE|FA_OPEN_ALWAYS);

Any suggestions?
I'm using the same card and the same pin config in both systems.
If you have any other suggestions on how to improve the write time to the micro SD, they'd be great too.

Thanks,
Andrew

18 Jun 2011

The SD driver code is buggy. That is why you got timeout. you need to flush BUSY token send by the card at the end of the write by reading the data. Busy toke is 0. Those tokens are sent right after the card send back the accept respond