High Performance Industrial SD Cards

Many new consumer SD cards have poor file write performance with Arduino SD libraries.

I bought and tested two industrial grade SD cards and compared them with two consumer SD cards. Industrial SD cards cost a great deal more than consumer cards.

The industrial cards are:

Swissbit 1GB card http://www.digikey.com/product-detail/en/SFSD1024L1BN2TO-I-ME-151-STD/1052-1033-ND/2620367.

Wintec 1GB card http://www.digikey.com/product-detail/en/W7SD001G1XA-H60PD-002.02/385-1079-ND/3152960

The consumer cards are:

4GB Amazon class 10 card http://www.amazon.com/AmazonBasics-SDHC-Class-Secure-Digital/dp/B004Q3R9AQ/ref=sr_1_3?ie=UTF8&qid=1345922948&sr=8-3&keywords=4gb+class+10+sdhc

2GB SanDisk class 2 card http://www.amazon.com/SanDisk-Class-Flash-Memory-SDSDB-2048-A11/dp/B0009RGLSE/ref=sr_1_8?s=electronics&rps=1&ie=UTF8&qid=1345923062&sr=1-8&keywords=2gb+sandisk+class+2+sd

I ran the SdFat bench example with two record sizes. First I used the default 100 byte records. Here is a summary of write results.

1GB Wintec: 278.40 KB/sec
1GB Swissbit: Write 265.10 KB/sec
2GB SanDisk class 2: 127.41 KB/sec
4GB Amazon class 10: 165.69 KB/sec

Next I ran the bench example with 512 byte records. In the case of 512 byte records, data is written directly to the SD without being copied to SdFat's internal buffer. Here is a summary of write results.

1GB Wintec: 407.57 KB/sec
1GB Swissbit: 384.92 KB/sec
2GB SanDisk class 2: 152.31 KB/sec
4GB Amazon class 10: 200.62 KB/sec

In this case the industrial cards are about twice as fast as the consumer cards. There is not as much gain for read.

Here are the detailed results.

100 byte records

1GB Wintec card
Write 278.40 KB/sec
Maximum latency: 84916 usec, Minimum Latency: 84 usec, Avg Latency: 354 usec
Read 338.89 KB/sec
Maximum latency: 2164 usec, Minimum Latency: 80 usec, Avg Latency: 289 usec

1GB Swissbit card
Write 265.10 KB/sec
Maximum latency: 72608 usec, Minimum Latency: 84 usec, Avg Latency: 372 usec
Read 338.07 KB/sec
Maximum latency: 2172 usec, Minimum Latency: 80 usec, Avg Latency: 290 usec

2GB Sandisk class 2 card
Write 127.41 KB/sec
Maximum latency: 61372 usec, Minimum Latency: 84 usec, Avg Latency: 778 usec
Read 276.33 KB/sec
Maximum latency: 3180 usec, Minimum Latency: 80 usec, Avg Latency: 356 usec

4GB Amazon class 4 card
Write 165.69 KB/sec
Maximum latency: 191320 usec, Minimum Latency: 84 usec, Avg Latency: 598 usec
Read 290.17 KB/sec
Maximum latency: 3108 usec, Minimum Latency: 80 usec, Avg Latency: 339 usec

512 byte records

1GB Wintec card
Write 407.57 KB/sec
Maximum latency: 85756 usec, Minimum Latency: 1152 usec, Avg Latency: 1250 usec
Read 488.39 KB/sec
Maximum latency: 2088 usec, Minimum Latency: 1032 usec, Avg Latency: 1043 usec

1GB Swissbit card
Write 384.92 KB/sec
Maximum latency: 67700 usec, Minimum Latency: 1160 usec, Avg Latency: 1324 usec
Read 486.68 KB/sec
Maximum latency: 2096 usec, Minimum Latency: 1036 usec, Avg Latency: 1046 usec

2GB SanDisk class 2 card
Write 152.31 KB/sec
Maximum latency: 59452 usec, Minimum Latency: 2132 usec, Avg Latency: 3355 usec
Read 366.17 KB/sec
Maximum latency: 2700 usec, Minimum Latency: 1288 usec, Avg Latency: 1393 usec

4GB Amazon class 10 card
Write 200.62 KB/sec
Maximum latency: 191596 usec, Minimum Latency: 2132 usec, Avg Latency: 2545 usec
Read 391.00 KB/sec
Maximum latency: 3020 usec, Minimum Latency: 1164 usec, Avg Latency: 1304 usec

The next generation of consumer SD cards will be even slower on Arduino.

Here is the result of running bench on a 64GB SDXC card.

Write 116.69 KB/sec
Maximum latency: 192708 usec, Minimum Latency: 84 usec, Avg Latency: 851 usec
Read 296.70 KB/sec
Maximum latency: 2980 usec, Minimum Latency: 80 usec, Avg Latency: 331 usec

The reason is that new cards have very dense TLC (Triple Level Cell) NAND flash. Three bits are stored in the gate of the one transistor cell as eight levels of charge, each level differing by less than 100 electrons.

These chips are designed for very large contiguous writes. The Arduino does not have sufficient buffering to achieve this.

The page size of these chips is much larger than a 512 byte block so in only part of a page is used when a single 512 byte block is written. The rest of the page is "dead" meaning unusable until it is erased.

Eventually the SD controller collect these blocks and rewrites them to a new page. This is a very high overhead process.

In addition TLC flash is very susceptible to wear so the Arduino's inefficient use of the device causes lots of data movement. The Erase Block Size for these flash chips can be 256KB. Moving this much data take a long time.

Even unchanged data gets moved with the wear-leveling algorithms.

Blocks that contain static data with erase counts that begin to lag behind other blocks will be included in the wear-leveling block pool, with the static data being moved to blocks with higher erase counts.

The 64GB SDXC card I tested can have an occasional write latency of almost 200 ms.

If you want to learn more about the internals of SD cards and modern NAND flash here are some links.

http://www.micron.com/~/media/Documents/Products/Technical%20Note/NAND%20Flash/151tn2942_nand_wear_leveling.pdf

http://www.eetindia.co.in/STATIC/PDF/200809/EEIOL_2008SEP22_STOR_AN_01.pdf

Here is a low cost high performance card.

An ATP 1GB Secure Digital SLC Industrial Grade card for $5.75 when I bought it.

http://www.newegg.com/Product/Product.aspx?Item=9SIA12K0CT6829

Here are the SdFat bench results for 100 and 512 byte records.

Buffer size 100 bytes
Write 258.95 KB/sec
Maximum latency: 69400 usec, Minimum Latency: 84 usec, Avg Latency: 380 usec
Read 329.38 KB/sec
Maximum latency: 2240 usec, Minimum Latency: 80 usec, Avg Latency: 298 usec

Buffer size 512 bytes
Write 392.32 KB/sec
Maximum latency: 62500 usec, Minimum Latency: 1184 usec, Avg Latency: 1339 usec
Read 469.41 KB/sec
Maximum latency: 2164 usec, Minimum Latency: 1072 usec, Avg Latency: 1085 usec