For a project I would like to do, I asked a question about whether to use SD or EEPROM (see Question

I checked how much memory I would need without any restrictions which is like 2 MB (or more) so a SD card seems the best solution.

However, I'm a bit worried about the speed. In one of the answer comments is mentioned that 20 ms is an eternity for a microcontroller. However, I might need to do the following within 20 ms:

  1. Parse a MIDI event (CPU power only, does not take long)
  2. Read one or two SD pages (1/2 times block of 512 bytes)
  3. Change/add/remove the MIDI event (CPU power only, negligible)
  4. Send out MIDI data (barely no time, mostly hardware)

In worst case I can get like 10-20 MIDI events I need to handle within 20 ms. Especially for step 2 I don't know how much time it will. My plan is to create a big file with a PC program to be stored on the SD card. Than I can let the Arduino read pages of 512 bytes from predefined places (with seek in a file).

I'm intending to keep the file open at all times and use seeks to go to the right place and read 512 bytes every time (assuming it doesn't matter to read 1 or 512 bytes since the page size is 512 bytes anyway).

So my question: is 20 ms enough to read like 50 pages of 512 bytes from an SD card which are located on different (but known) file offsets within a 2+ MB file?

(btw, I want to try first on an Uno, but probably I will later go to a Mega (or add more SRAM to store temporary data).

2 Answers 2


So my question: is 20 ms enough to read like 50 pages of 512 bytes from an SD card which are located on different (but known) file offsets within a 2+ MB file?

Let us do the numbers: 50 * 512 = 25 Kbyte in 20 ms is 1.25 Mbyte/s. As the max speed for SPI is 1 Mbyte/s (on Arduino AVR, 16 MHz) we do not have to go any further. The answer is: No.


  • Thanks for this answer, although the answer is no, still 40 pages per second is feasible which still is ok (but not optimal). Just hope it doesn't matter to read non-contiguous blocks for the max spee of 1 MB/s and the seeks don't take too much time. Commented Mar 10, 2017 at 10:43
  • 2
    No, there is much more going on when accessing an SD. You should count on 200-300 Kbyte/s max substained. The SD SPI protocol requires both synchronization and addressing so the effective bandwidth is lower. High speed SD uses multiple data pins (and additional hardware support). Commented Mar 10, 2017 at 10:48
  • that would mean a page read of 512 bytes would take 2.5 ms? And 512 bytes is the minimum amount to read I read somewhere. Commented Mar 10, 2017 at 11:11
  • @MikaelPatel: would it be possible to use 2 sdcards and 2 SPI buses to (almost) double the throughput?
    – dandavis
    Commented Mar 11, 2017 at 14:05

Just for reference for others:

I received my micro card reader (from Catalex, v1.0, 11/01/2013) today and used a 1GB micrSD card.

The times measured ar at 4 addresses (2000, 120000, 40000 and 12000) again and are a seek to the address, and the reading of the bytes mentioned before the colon and the time after the colon in micros.

Result: Seek is 25..2500 micros depending on the file position, reading below 256 bytes is approx. 2-3 ms, reading 256 bytes 4-6 and 512 bytes 7-8 ms.

Initializing SD card...card initialized.
Address: 2000
seek    : 24
read   1: 2276
read   2: 2308
read   4: 2344
read  10: 2380
read 256: 4780
read 512: 7328
Address: 120000
seek    : 2536
read   1: 5008
read   2: 5040
read   4: 5084
read  10: 5120
read 256: 5312
read 512: 7888
Address: 40000
seek    : 2468
read   1: 4940
read   2: 4972
read   4: 5016
read  10: 5052
read 256: 5252
read 512: 7828
Address: 120000
seek    : 2504
read   1: 4992
read   2: 5024
read   4: 5060
read  10: 5104
read 256: 5296
read 512: 7864

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.