Electrical – the bottleneck of a SD Card to USB transfer via microcontroller

picsdspiusb

I am using a microcontroller (PIC32MZ) to transfer the data from an SD Card to USB, with this configuration:

schematic

simulate this circuit – Schematic created using CircuitLab

I managed to have everything working using Harmony v1.09 framework, and I could get a transfer rate of about 1.5MBytes/s, which is pretty good, but…when using SD Cards with large memory, this rate still looks to slow. For example, it requires 6h to transfer 32GB!!!!

Looking at the components one by one, I can't see why the transfer rate is not higher:

  • The actual card I am using for my test reached the speed of 20MBytes/s when plugged into my computer. It probably used 4 wires, but then it would be around 5MBytes/s on each wire
  • The PIC can support High Speed USB, which has a transfer rate of 60MBytes/s (480Mbits/s)
  • The SPI bus between the card and the micro is running at 50MHz, which corresponds to a maximum rate of 6.25MBytes/s

Why can't I get at least something closer to 5MBytes/s, which seems to be the lowest rate of the system? What is the bottleneck here? Is it possible to improve it?

Datasheets:

Best Answer

The SPI bus between the card and the micro is running at 50MHz, which corresponds to a maximum rate of 6.25MBytes/s

The SD card spec only allows up to 25 MHz in SPI mode - I would not risk higher speeds in case one uses different cards.

But this could yield about 3MByte/sec. Note that you may need to use multi block transfers for maximum throughput as there would be gaps for command activies otherwise. Most MCU example code only use single block transfers for simplicity.