Wednesday 15 February 2017

Salvaging non-working SD cards

A little while back we were playing about with lots of different SD cards to use in a number of WTV020 sound modules. Frustratingly, from 45 SD cards, we had about a 50% failure rate.

There was no explanation - no reason why they didn't work; they just didn't. The SD cards were all formatted exactly the same way (FAT 16kb clusters) off the same machine, the files were copied on to them using the same method, and some worked and some simply didn't.


Ulrich Bien suggested trying to make a disk image of a working card, and trying to burn that onto a non-working card, to see if that worked. At first, it seemed like it shouldn't make much difference. Then, looking over our code from a few years back, when we created our own audio player and SD card FAT16 reader, something about boot sectors and zero-vectors came to mind.

It's quite possible that there's a difference in different cards - some may have to boot sector are sector zero, some may have an offset (this rang a few bells between a few of us who had been involved with the original SD card project, back in the day). Or maybe it's something entirely different.

But we downloaded Win32DiskImager and created an image of a working SD card. Without formatting the cards or any other further processing, we simply burned the image onto another SD card.

Sometimes we got an error.


It would seem that not all 512Mb SD cards are the same! Some have fewer sectors than others. So we found our smallest (working) SD card, formatted it (FAT, 16kb clusters), copied some files onto it and made an image of the disk.

We then burned that disk image onto our collection of SD cards.
Even though the image was taken from a 512Mb card, it burned onto a 1Gb card without a problem. Sure we're not getting access to the full capacity of the card. But then again, we're not writing to it either - we're wanting to read one of a selection of files. The extra card space isn't going to get used anyway, so it's no loss.

Surprisingly, we found that from about 60 SD cards (that were 512Mb or larger) we got 47 of them working. Some - the Nokia branded 512Mb cards for example - stubbornly refused to work; but many of the cards we'd written off as not working suddenly booted up and starting playing our wav files (ok, .ad4 files but it's the same thing).

So if - like us - you need to read data from multiple SD cards, there's always a chance that burning a "good image" onto them, rather than clean-formatting and copying files across could work for you too!





No comments:

Post a Comment