Author Topic: SD Card writing speed  (Read 7596 times)

0 Members and 1 Guest are viewing this topic.

Offline @rt

  • Super Contributor
  • ***
  • Posts: 1061
Re: SD Card writing speed
« Reply #25 on: March 23, 2018, 03:34:47 pm »
It’s SDSC(SD) and SDHC that have different registers, and a lot of the initialisation is different,
such that an SDHC card won’t work in a host written prior to SDHC.

SDHC and SDXC I’ve found no difference in. You can format an SDXC card with FAT32, and it’s just the same.
The fastest SDHC cards are faster than the slowest SDXC cards, so it’s really only capacity that absolutely sets them apart,
but again, that’s arbitrary.
 

Offline mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 13790
  • Country: gb
    • Mike's Electric Stuff
Re: SD Card writing speed
« Reply #26 on: March 23, 2018, 07:43:00 pm »
Whan I was doing the SD card stuff for the hackaday badge (PIC32MX170 using Microchip's library with a few tweaks to use 32-bit transfers for speed), we found huge differences in write speeds between different types of card, like factors of over 3x
 
We found that smaller cards 128M and most 256M were substantially faster, larger cards 1G and above were always substantially slower. From memory I think the rates ranged from around  100 to 350KBytes/sec writing fairly large blocks ( tens of K) 

My gut feeling, not bourne out by any actual tests or detailed understanding of the low-level protocols, is that the Microchip library always writes in 512 byte blocks, and the larger cards have a larger native block size, and are internally doing some kind of read/modify/write cycle, or block reassign+erase when writing 512 byte blocks in SPI mode.

Read speeds were also rather variable between card types, but only by about 2x - I put this down to them not caring about efficiently implementing SPI mode.
 

Mike

You could well be correct about your suspicions I had similar variable results with Compact Flash cards.

For SD cards there was a big change in the spec to support big capacities around 2007. At the time the biggest card that could be supported was about 2G (I think).
In the original SD spec the card address was in bytes but to support bigger sizes the card address changed to be block addresses. This actually allows for up to 4Tbyte but the spec only says up to 32GB, I don't know why.
All cards power up in Byte Address SPI mode to be backward compatible and then need an extra step in the initialisation to put then in Block Mode or parallel bus mode.

Possibly around this time the internal architecture started changing as well resulting in all the variations of speed of access.

My own findings with compact flash might be helpful.
I don't support the high speed UDMA mode, I only use the basic start up mode but even so I have seen huge differences across manufacturers in my application. And even big changes from one version to the next of the SAME card.

For large writes they are mostly consistent around 6 Mbyte/s but one or two won't go faster then 3 Mbyte/S.

For small writes things are really variable. This is typically around 1 Mbyte/S but I have some cards that only do 100Kbytes/s.
I had 1 card that only did 10Kbytes/S  :o .We sent those back to the manufacturer.

If you rely on the card speed it is worth evaluating lots of different cards to find one that meets your requirements but be aware that if you are buying commercial cards you may not get the same firmware next time you order them.
If you buy industrial cards they may cost more but you will get a part number to order against and you are guaranteed the same firmware for the life of the product.
Product lifetime seems to be about 18 months so you end up having to re-qualify every 18 months but at least you can plan for that.
As SPI mode is a small niche market, I suspect that some cards only implement a bare minimum and/or some bodges/workarounds to keep it just-about working over changes to the architecture, with little consideration to speed. 
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf