SD cards and DATA_STAT_AFTER_ERASE

Daniel Drake dsd at laptop.org
Thu Apr 14 12:00:07 EDT 2011


Hi Arnd,

As you've obviously been working with a large range of SD cards, I
wonder if you have any comments/knowledge on erase behaviour.

The SD card spec says that CMD32/CMD33 erase can leave the data as
either all-zero or all-one, depending on bit 55
(DATA_STAT_AFTER_ERASE) of the SCR.

Do you have any comments on the general trend is for
DATA_STAT_AFTER_ERASE? Do most vendors erase as 0 or erase as 1?
I've seen the discussions around badly manufactured SD cards; do you
know how reliably this bit is set by the vendors? If they set it
incorrectly it would be quite inconvenient for my plans.

Currently, when installing software, OLPC firmware erases the entire
disk then writes the entire disk contents, even if most of that is
zeroes. I am looking at an optimization where we can simply avoid
writing those 0 blocks, greatly speeding up the flashing process. In
my test case of 1 SD card, DATA_STAT_AFTER_ERASE=0 and the vendor is
not lying about this, so I managed to cut down the time needed to
install an OS image by more than 50%. Hopefully this can apply on a
wider basis...

Daniel



More information about the Devel mailing list