Go Down

Topic: Sd card file transferring using 8bit Vs 32bit processing? (Read 386 times) previous topic - next topic


Hello Everyone i was wondering Would i see a big different in speed if i was to use a Sd card on a arduino zero board compare to if i was using a arduino Uno board?


I don't know how "big", nevertheless there is actually a difference. Not because of the CPU's width, but because of the clock's frequency.

The maximum clock (SCK) frequency for a SD card in SPI mode is 20 MHz, and the maximum for a microcontroller is usually half of the CPU's one.
Since the Arduino Uno works at 16 MHz, it operates the SD card at less than half of its maximum clock frequency. But with the Arduino Zero and its 48 MHz... I think you get what I mean.


Sep 03, 2018, 12:04 am Last Edit: Sep 03, 2018, 12:06 am by josephchrzempiec
Hello Lucario yes Talking about speed bandwidth and whatnot. Just trying to put into layman's term i can understand. Trying to see the difference what is the advantage of using a SD card module on a uno and Zero board.  The project I'm researching on will be a Hid device  Storage. Yes i can just use a SD card reader. But in time i will be adding more to the project like a second SD card module. Or maybe as it's own Ethernet or WIFI who know's Not sure yet just trying to figure this all out.

Because of the file sizes of these files i would like to store on it is slightly bigger then most file. I'm worried about it slowing down. Okay i did forget i can use a NAS storage box But cost is high and I'm not learning anything from it. So this is what i would like to do.


The project I'm researching on will be a Hid device  Storage.
Via USB, it would be easy to use if the board can emulate a "Mass Storage Device class" (like a pendrive). A "Human Interface Device class" is usually a one-way communcation, since most of such devices are inputs only (like a mouse). The only exceptions may be keyboards (light indicators for caps and num lock) and joystick controllers (the vibration feature).

The Arduino boards normally gets identified as a serial UART port emulator; although you can still interact with the inserted SD card this way, but you'll need to find/write a specialized program for that.
You may consider ditch out USB for file transfers directly to your Arduino, because I don't see it can emulate a mass storage device, and because serial ports aren't fast enough for that purpose (115200 bps with 8N1 frames transfers data at 10 KB/s).

On the other hand, Ethernet/Wi-Fi is actually the way to go in this case, making the SD card access the only bottleneck. Arduino as a NAS you'll probably have to stick to a TFTP or FTP server; other protocols like the used by Windows (SMB, not iSCSI) might be a headache and too much for an Arduino anyway.

The only thing left is about the SD card acces. Without using its native SDIO protocol, you may not go far away with the speed; remember that you have to stick to the "legacy protocol" (which is SPI) for compatibility with the Arduino.

To give you a frame of reference, an Arduino Nano (same thing as the Uno in this example) topped up to approx. 53 KB/s in writting speed, according to a test I've made long ago under these conditions:

  • SPI bus not shared.
  • SPI at "full speed" (8 MHz clock).
  • Timer0 overflow interrupt enabled (for millis()).
  • Using the IDE's SD library (SdFat ended up being slower for some reason).
  • No extra overhead except the usual "for loop" procedures.
  • File was created from zero.
  • File grew up to 4 MB by writting 512 bytes at a time.

Then I performed a read test in that file, and I think it resulted in something around 70 KB/s.

This behavior is normal in flash memories: reading is faster than writting.

Now with a microcontroller where the SPI's clock signal can reach 20 MHz, I will expect more than double (but less than triple) the speeds of our frame of reference (in theory).
But if the Ethernet/Wi-Fi has to share the same SPI bus, effective data rate gets cut in half (unless somehow module and SD card can talk directly to each other); and it further decreases with the overhead inside your own code.

In a nutshell: you can use an Arduino as a SD card reader or NAS, but at most expect speeds of USB 1.0.

Go Up