... and weren't afraid to ask.

There have been a number of questions about SD memory cards.  This is a big topic, so I'll cover what I can and then see what questions come back.  I'll either answer those questions in the comments or I'll do a second entry.


What's in a name?

Originally SD stood for "Secure Digital," but no one ever did anything with the "Secure" part.  The name stuck, even if the meaning didn't.  All types of SD cards are based on nand flash memory and are used for storing data.  Think of them as very small, very low power hard drives with no moving parts.  SD, MiniSD, and MicroSD (aka TransFlash) are all the exact same thing, just in different packaging.  Smaller packaging means less space taken on your phone, which enables smaller phones. 

Yes, it annoys me too that every new phone I get seems to need a new, smaller version of SD.  The good news is that I don't think we can get much smaller.  You practically need tweezers to insert a MicroSD already.  If they get any smaller, we're going to need a magnifying glass to even see them.


Does capacity matter?

Up to 2G, the only negative to larger storage cards is that they cost more.  They don't burn any more power than smaller ones and they're not inherently any slower than smaller ones.  I've used 2G cards in my Windows Mobile devices, and they work fine.  Unfortunately, 4G and larger cards aren't likely to work yet.

Most cards and card readers out there follow the 1.1 version of the SD specification.  That spec maxed out with 2G cards.  There's a new 2.0 version of the spec that allows for larger cards, but Windows Mobile currently doesn't support SD 2.0.  Even though we don't explicitly support SD 2.0, it's possible for our OEMs to add support themselves (I don't know if any have).  So if you've got a Windows Mobile device that's able to read 4G SD cards, you don't have to call me a liar.  Ignorant, yes.  Liar, no. 


How about speed?

SD cards have all sorts of marketing names--Ultra, 133x, High Speed, etc.  There's no standard for what these terms mean, so I can't tell you if an "Ultra" card is faster or slower than a "133x" one.  But I can tell you that there are huge speed differences in different SD cards.  A few years ago I did a simple test where I plugged an SD card into a desktop SD reader, copied 30M of files to it, timed the copy with a stopwatch, and then repeated the procedure with different cards.  I literally found some cards that finished in 30 seconds while others took 80. 

A faster card can have a number of benefits.  It could show up faster when you plug it in, files could be written to it faster, and files could be read from it faster.  Whether or not you'll be able to actually notice these differences will depend on how much faster the card is and how large the files you're transferring are. 

There's a small chance to save a bit of power with faster cards, too.  The SD card is only powered while it's transferring data.  If you can transfer the data more quickly, it'll be powered for less time.  I've never done tests myself, but I don't expect this effect to be very significant.


How does it work?

Every SD card has a small microcontroller on it.  (Think of a microcontroller as a simplified CPU.)  That microcontroller handles communicating with the phone the card is plugged into, getting data from the flash, and putting data into the flash.  It also handles flash-specific tasks like wear leveling and compaction.  The trick, though, is that the microcontroller only runs while data is being sent to or read from the card.  All CPUs and microcontrollers run off of a "clock" signal, and the SD card's clock is controlled by the phone it is plugged into.  When the clock isn't running, neither is the microcontroller.  The phone only runs the clock when it wants to transfer data to or from the card.

The first way one card can be faster than another is that it can have a faster clock speed.  The phone asks the card how fast a clock it can handle, and then uses that speed.  The faster the clock, the more data sent every second.  This is similar to the reason a 3GHz Pentium is faster than a 2GHz Pentium.  The GHz number is the Pentium’s clock speed.

The second way one card can be faster than another involves the way communications work.  The phone sends a command to the card and runs the clock while it waits for the card to respond.  The command might be, "store this data," to which the eventual response is, "done, give me more."  Or the command might be "fetch this data," to which the eventual response might be, "here it is."  The thing is, because the clock only runs during one of these commands, they are the only time a card has the opportunity to do any bookkeeping work.  So a card might get a "store this data" command, do it, but then do some other work before he says that he's done.  The longer those other operations take, the slower the overall transfer is.  Some cards will be more efficient than others, resulting in overall faster transfer times.


Why don't we do more with SD cards?

A frequent question is why we don't support putting more things on storage cards.  For instance, we don't allow you to store your contacts, calendar entries, or email on storage cards.  (We do allow you to store attachments there, though.)  The general problem is that storage cards can, by their nature, be removed from the device.  Some types of data don't lend themselves to being there one second and gone the next.  Sync would get very confused if it saw 300 contacts on one sync, and then only saw 10 on the next.  It would certainly be possible to work out some sort of interface to allow this, but it would be pretty complicated, both to code and to use. 

Things that already have the concept of sometimes being there and sometimes not, like email attachments and temporary internet files, are easier to handle on an SD card. 

As with any potential feature, allowing someone to put their contacts on a storage card would require that we not do some other feature.  On prioritizing SD changes, we take a lot of factors into consideration, one of which is where we see internal flash going.  We've already seen phones with multiple gigabytes of internal storage.  As things like that become more common, the value of doing new things on storage cards goes down.  There's still value in working on SD, it's just that it's not as valuable as other things are.


Why do things on SD stop working after a suspend/resume?

When a PocketPC suspends, it powers off most of the hardware in the system, including the part of the SD slot that tells whether or not a card is there.  While the system is suspended, you could potentially eject the card and stick a different one in.  If you did that, any apps that have files open on the card would get very confused.  This almost never happens, but it's something we need to guard against.  So, when we power the system back on, we check to see if there's a card there.  If it is, we check with it to see if it's the same one as was there before.  If it doesn't respond, or responds differently than we expect, we unload it and close any files that were open before.

The trouble is, we can't wait forever for the card to respond to us.  There are programs trying to communicate with that card, and we're stalling them.  So we've set an amount of time that we'll wait for the card before unloading it (we call it the "PnPUnloadDelay").  Importantly, some phones can power on their SD system quickly and some take more time.  Because of this, the OEM chooses the correct PnPUnloadDelay for his hardware, and we rely on his setting.  If something happens that makes the SD card not respond in the time specified by the PnPUnloadDelay, we assume it's a new card. 

A lot of things could cause this to happen.  The card you have might be a lot slower than the OEM expected you to use.  This is a place where buying a faster card can help.  Or some application might be running out of control and causing the system to run slower than normal, making everything take longer.  Or, maybe, the OEM made a mistake and set a delay that's just too low. 

The PnPUnloadDelay is shown in the registry, but unfortunately changing the registry doesn't affect the value.  Only the OEM can change the value.

Note that Smartphones don't ever suspend, so they don't have these sorts of issues.


Questions?

I think that covers the majority of the questions I've seen asked about SD cards.  If you have more, ask away.

Mike Calligaro