Go Down

Topic: Using arduino to recover data from corrupt sd card (Read 3950 times) previous topic - next topic



I got a sdhc 32G sd-card on which were my last holiday pictures.

We just looked at them on my friend's computer, and now it seems there's only rubbish on the card.
I suspect it comes from the card, not a virus.

Do you think it is worth trying to read the card in spi mode instead of the internal reader of a computer (sdio mode, I guess) ?
maybe the data is still here...

Thanks for your advice.


Your going to fine bigger and better SD card recovery options on a PC. I'm not sure if SD library for Arduino even allows low level reading. I would suggest using PC software to create a 1:1 image of the SD card then try recovering the data from the card. If it fails you can always restore the image and try again.
Don't PM me for help as I will ignore it.


Thank you for the advice, but if it was such a simple software problem (e.g accidental write in some critical sectors such as the partition table) my problem would be solved by now. I regularly use photorec and the like to recover data for friends and family.
Long story short, I know the card suddenly stopped working but I only noticed it when I tried to put it back in my camera. It said «card error» and I was immediately like «uh-oh».
I put the card in my computer and looked at hexdump -C and saw «MSDOS 5.0» somewhere at the beginning. At that point I was pretty confident that it was a minor problem since the partition tables seemed to be still there -- in part at least. I immediately launched a copy with dd, only to find hours later that the data I copied was completely garbled, with no trace of the first sectors I saw previously.

A closer examination through different card readers lead me to think that something is really fried in the card (slightly different output depending on the readers, the card seems to output the same block repeatedly, and dmesg reports an error about a missing function in the card).

I know it is possible to desolder the nand chip to read it raw with specialized hardware and software, but before doing this I thougt that maybe using SPI mode wold go through different circuitry and work around the problem.


   I had a same problem with an "almost" dead SD card. My computer or camera wouldn't read it and it was not responding. Although I managed to read it with an UNO plus an SD shield and now I'm trying to figure out how I 'll get the photos since they are 10-15mb each and console freezes. I followed the instructions and code from this site http://tech.tiefpunkt.com/2013/08/sd-card-recovery-using-an-arduino/ although I modified some parts of the code. To be sure that this works I tried it with some photos from another SD card that were only 100kb and it worked! My problem now is how I'll get the other ones that are 10-15mb...


Apr 27, 2017, 05:20 am Last Edit: May 02, 2017, 07:24 am by jasdaller
For SD card data recovery, there are many tools can fix SD card problems, and you can recover SD card files easily.

Go Up