PDA

View Full Version : SD Read Throughput Worse on Sandisk Ultra



jessecrossen
05-30-2016, 02:25 PM
I just ran SdCardTest with Teensy 3.2 and the Audio Adaptor on two Sandisk SD cards, both 16gb. One is a brand new Ultra, and the other is an older version that's all black, apparently a Class 4 from the markings. The odd thing is that the non-ultra card is actually getting better performance and I'm not sure why. Also I'm seeing less variation in the performance between sequential and non-sequential rates than I would expect, which makes me think there might be some other bottleneck. Can anyone verify whether this is normal, and if not give some suggestions as to what I can do to improve it?

Class 4 results:
================================================== ====

SD Card Test
------------
SD card is connected :-)
Card type is SDHC
File system space is 15911.79 Mbytes.
SD library is able to access the filesystem

Reading SDTEST1.WAV:
Overall speed = 1.03 Mbyte/sec
Worst block time = 0.92 ms
31.74% of audio frame time

Reading SDTEST1.WAV & SDTEST2.WAV:
Overall speed = 0.98 Mbyte/sec
Worst block time = 1.89 ms
65.18% of audio frame time

Reading SDTEST1.WAV & SDTEST2.WAV staggered:
Overall speed = 0.98 Mbyte/sec
Worst block time = 1.46 ms
50.29% of audio frame time

Reading SDTEST1.WAV, SDTEST2.WAV, SDTEST3.WAV:
Overall speed = 1.02 Mbyte/sec
Worst block time = 2.77 ms
95.37% of audio frame time

Reading SDTEST1.WAV, SDTEST2.WAV, SDTEST3.WAV staggered:
Overall speed = 1.02 Mbyte/sec
Worst block time = 1.90 ms
65.45% of audio frame time

Reading SDTEST1.WAV, SDTEST2.WAV, SDTEST3.WAV, SDTEST4.WAV:
Overall speed = 1.04 Mbyte/sec
Worst block time = 3.62 ms
124.91% of audio frame time

Reading SDTEST1.WAV, SDTEST2.WAV, SDTEST3.WAV, SDTEST4.WAV staggered:
Overall speed = 1.04 Mbyte/sec
Worst block time = 2.34 ms
80.69% of audio frame time


Class 10 Ultra results:
================================================== ====

SD Card Test
------------
SD card is connected :-)
Card type is SDHC
File system space is 15506.91 Mbytes.
SD library is able to access the filesystem

Reading SDTEST1.WAV:
Overall speed = 0.62 Mbyte/sec
Worst block time = 1.42 ms
49.05% of audio frame time

Reading SDTEST1.WAV & SDTEST2.WAV:
Overall speed = 0.56 Mbyte/sec
Worst block time = 3.12 ms
107.57% of audio frame time

Reading SDTEST1.WAV & SDTEST2.WAV staggered:
Overall speed = 0.56 Mbyte/sec
Worst block time = 2.56 ms
88.27% of audio frame time

Reading SDTEST1.WAV, SDTEST2.WAV, SDTEST3.WAV:
Overall speed = 0.57 Mbyte/sec
Worst block time = 4.58 ms
157.89% of audio frame time

Reading SDTEST1.WAV, SDTEST2.WAV, SDTEST3.WAV staggered:
Overall speed = 0.57 Mbyte/sec
Worst block time = 3.46 ms
119.26% of audio frame time

Reading SDTEST1.WAV, SDTEST2.WAV, SDTEST3.WAV, SDTEST4.WAV:
Overall speed = 0.59 Mbyte/sec
Worst block time = 5.95 ms
205.22% of audio frame time

Reading SDTEST1.WAV, SDTEST2.WAV, SDTEST3.WAV, SDTEST4.WAV staggered:
Overall speed = 0.59 Mbyte/sec
Worst block time = 4.15 ms
143.00% of audio frame time

stevech
05-30-2016, 06:41 PM
There are several manufacturers of the NAND Flash controller chip (die) within SD cards. Some are better than others, esp. at error correction code (ECC) processing which is the Achilles heel of MLC NAND flash. COmputations for ECC for 16GB and up are rather complex. The retail brand names generally don't suggest what vendor's flash controller chip is used, except for some line San Disk (now WD) who retail their own.

You can get and display the card type detail info to get the manufacturer IDs for the controller and flash chips. And look them up on a web site that sometimes does not hide the names for those IDs. That done, it's moot

If the driver is using 1 bit SDIO to talk to the card, you might get faster I/O by having a driver that uses 2 or 4 bit SDIO. Takes more pins, and an MCU with SDIO support.
If the driver is using SPI rather than SDIO, it will be much slower. All consumer gear uses SDIO mode.

Phison in Taiwan is a controller vendor I've worked with. Some prominent names in flash chips and SD cards use them. The controller is very complex.

This doesn't help you, I know. But the average speeds needs use SPI or SDIO in such a way that the speeds are much higher than what your app needs for glitchless audio. And you want a driver that uses DMA rather than a programmed loop of function calls.

jessecrossen
05-30-2016, 06:53 PM
There are several manufacturers of the NAND Flash controller chip (die) within SD cards. Some are better than others, esp. at error correction code (ECC) processing which is the Achilles heel of MLC NAND flash. COmputations for ECC for 16GB and up are rather complex. The retail brand names generally don't suggest what vendor's flash controller chip is used, except for some line San Disk (now WD) who retail their own.

You can get and display the card type detail info to get the manufacturer IDs for the controller and flash chips. And look them up on a web site that sometimes does not hide the names for those IDs. That done, it's moot


That makes sense. I'm using the Sandisk Ultra, which looks exactly like the picture here: http://www.pjrc.com/store/teensy3_audio.html so I'm curious as to whether whoever wrote that page (I'm assuming Paul), is seeing better throughput than what I'm seeing. Should I expect chipset variations among identically branded Sandisk cards?



If the driver is using 1 bit SDIO to talk to the card, you might get faster I/O by having a driver that uses 2 or 4 bit SDIO. Takes more pins, and an MCU with SDIO support.
If the driver is using SPI rather than SDIO, it will be much slower. All consumer gear uses SDIO mode.

Phison in Taiwan is a controller vendor I've worked with. Some prominent names in flash chips and SD cards use them. The controller is very complex.

Okay, so I'm using the controller on the PJRC Audio Adapter. I'm assuming that's an SPI interface like other components on the board, but I'm not 100% sure. Can anyone enlighten me?

This is more a matter of curiousity since I can just use the older card, and even the Ultra could probably be made to work for my application. FWIW I'm making a 4+ channel loop-station, so all it needs to do at minimum is simultaneously read four channels of mono and write one, which should cost around 0.353 MB/s read and 0.088 MB/s write by my calculations.

Frank B
05-30-2016, 07:40 PM
My fastest card (for random access) is a very old one with 512MB

PaulStoffregen
06-01-2016, 10:46 PM
Should I expect chipset variations among identically branded Sandisk cards?

Maybe. Perhaps Sandisk changed something, but kept the product markings the same?



Okay, so I'm using the controller on the PJRC Audio Adapter. I'm assuming that's an SPI interface like other components on the board, but I'm not 100% sure. Can anyone enlighten me?


Yes, SPI.


We're currently still using the original Arduino SD library, which only caches a single 512 byte sector. Modern cards appear to be optimized for larger block (multi sector) transfers.

You might try editing SD_t3.h to enable the optimized read. That's still single sector, but it caches more. The optimized code can not (yet) write to the card at all. Yet another ambitious project of mine... only partially completed.....