SPI SD Card Speed Reading..

I want to use an SD card as an external RAM, I know I can buy SPI RAMs, but I want the ability to write once and read many (programmed from a PC, read by my AVR)

So, how fast can I read the device ? is it fully dependant on the quality of the card ? I need to use the Peek() command to randomly access the device, is this really slow ? Is a block read (512 bytes) the best/fastest way to get data off the card

Thanks in advance


So, how fast can I read the device ? is it fully dependant on the quality of the card ?

Card class is not very important on Arduino. High end cards are designed to perform well with very large contiguous transfers using the 4-bit SDIO bus. You may see about 10% difference for read speed of 512 byte blocks on an AVR board. The speed difference may not correlate with card class.

Read performance drops with transfer size. Here are tests using SdFat with 8 MHz SPI. SD.h uses an old version of SdFat with 4 MHz SPI so it will be slower for large transfers.

I used a high-end 32 GB SanDisk card.

512 byte block read: 499.5 KB/sec

64 byte block read: 316.3 KB/sec

8 byte block read: 125.4 KB/sec

2 byte block read: 40.4 KB/sec

1 byte reads: 24.0 KB/sec

peek followed by 1 byte read: 12.1 KB/sec

SD is not a good substitute for external SPI RAM for small reads.

Some users read from an SD and store data in non-volatile SPI SRAM of FRAM.

I wrote drivers and a file system for FRAM and battery backed SRAM RamDisk

I attached a chart for FRAM and SRAM performance as a function of transfer size.

FRAM_perf.pdf (167 KB)

SerialRamPerformance.pdf (168 KB)

The results are great! You did a lot of fine-tuning, it seems. In past I did with dspic33 (50Mhz clock, 12.5MHz SPI, 16bitter) in C, writing FR25H20 256kB FRAM (Ramtron, now Cypress) and with 512bytes large blocks (no filesystem however) I achieved only ~1MByte/sec.