I have a 60Mb file on my class 4 SD card. In a 'while' loop I read blocks of size 8kb from that file and write it in another file on the same flash. It takes approximately 3 minutes for a whole loop. Is there any way to speed up the process?
Here is the code:
int blockSize = 4096; while (fread(inputBuffer, sizeof(short), blockSize, f1) == blockSize) { fwrite(inputBuffer, sizeof(short), blockSize, f2); }
That's some pretty sorry performance, worse than 1MBps, what kind of interface are you using? SPI? The 4-bit SDIO+DMA should post some significantly better performance. Do your numbers improve with a 32 KB blocks size, and a better class of card? Low class cards can have some poor write speeds.