SD Card SPI write time

21 Jun 2011

What's the SPI frequency for the FATFileSystem library?
Is it possible to increase it similar to the function spi.frequency(xxx);

If I was wanting to increase the write speed to an SD card, would this be the best way to do it?

21 Dec 2011

Uh, this just popped up when searching, maybe it's a byte late, but I'll give it a shot:

Yes.

I've increased the speed of my SD card from 1 MHz to 10 MHz, and it works.

Lerche

21 Dec 2011

Hi Lerche,

Could you provide some details? Interested in seeing how it's done just in case I run into a situation like this in the future.

Sebastian

21 Dec 2011

In the SDFileSystem files, there a Disk_initialize(). In the bottom of this, spi.frequency() is found. Add an extra zero to this, that'll force it up to 10 MHz. THis could possibly be changed to 12.5 MHz, as the max transfer rate of SPI on LPC1768 is 12.5 mbit/s. This is just a theory, but I will check it out, after Christmas.

I would like to see what files on the SD-card I can play through WavPlayer, as the sample-rate increases.

Lerche

21 Dec 2011

int SDFileSystem::disk_initialize() {

    int i = initialise_card();
//    printf("init card = %d\n", i);
//    printf("OK\n");

    _sectors = _sd_sectors();

    // Set block length to 512 (CMD16)
    if(_cmd(16, 512) != 0) {
        fprintf(stderr, "Set 512-byte block timed out\n");
        return 1;
    }
        
    _spi.frequency(1000000); // Set to 1MHz for data transfer
    return 0;
}

The second last line in the code, sets the spi frequency. In SDFileSystem.cpp.

22 Dec 2011

Thanks for the info, I'll def remember that for future use. I'll also experiment to see what the max speed is.

Sebastian