Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

The SD/MMC memory card of doom! :(

Status
Not open for further replies.

Mr RB

Well-Known Member
I thought you might like to hear a story about my recent fight with a SD card!

It is a 4Gb normal sized SD card, used from new in a camera for a few months. The camera battery got low and there was a "card error" message. No new files (photos) could be written to the card.

OK, easy enough, diagnosed it in Windows scandisk and re-format. After reformat, scandisk says card is now ok. Check card in Windows, there are still 6 folders and hundreds of photos, all readable! Card is still faulty, trying to write files to it.

OK, then "format" and "low level format" using the camera. Both times camera says "format completed ok", both times folders and photos are still on the card! :eek: What the??? This is a card straight from the twilight zone!

OK, downloaded a plethora of SD card low level diagnosis and formatting programs from the internet. Some say "card fault" some say "card formatted ok" some format and diagnose the card, then say it is ok, then the *&^*$ folders and photos are still on the card and the card has the same fault! Windows XP tricks also say it has re-formatted ok, but to no avail. The card is now upgraded from "twilight zone" to official "demon card" status.

OK, so me being a smartypants I get my PIC18 development board out, the one with the SD card socket built in... Can you guess what is coming? I write a PIC program, that directly writes 0xFF over EVERY sector (every 512byte block in the cards ROM) at the lowest addrssing level. No subservience to the FAT, nothing can go wrong. :) The PIC code writes 0xFF to all 512 bytes in the sector, then checks the card gives a "write was ok" message, then writes over every subsequent sector on the 3.89gB card... There are 7.7 million sectors! I add a LCD display and a message to show what sector it is up to (every 30 seconds or so).

Now writing to a SD card is a little slow as the card has an internal eeprom write cycle. So the process to manually overwrite (erase) EVERY sector on the card takes 45 hours. I plug in a wallwart and leave it running for 2 days, secure in the smug feeling that NOW every damn sector on the card will be manually erased whether the card likes it or not. I feel like a conquering hero. ;)

45 hours later... LCD message shows all 3.98Gb overwritten with no faults. I plug the card into Windows, and huh????? The folder and photos all still there!! NOOOOOO! This is ElDiablo the SD card of DOOM!

I re-write my PIC code to write 0xFF to each sector, then manually read the whole sector back, and compare every single byte to make sure it wrote ok. Guess what? Sector 0 = FAIL. Sector 1 = FAIL. Sector 2 = FAIL, every damn sector write->read = FAIL. Every byte = FAIL.

The moral of the story. Well, sometimes you just get beat. :(

At this point I know the card is going through the write cycle normally, writing normally, and issuing "write was ok" message normally. Which is why all the programs (inlcuding my own) said it was reformatted or erased ok. But there must be a hardware fail inside the card write electronics, so even though the card itself *thinks it wrote ok* the write does not happen at all. Never. Possibly the charge pump that makes the Vpp programming voltage inside the card.

Well, I learned a bit more about FAT16, FAT32 and the utilities you can use to save (some) dead cards, but you can't save the ElDiablo SD card of DOOM!

(update) My woman rang the place we bought the camera from. "Sure! No problem!" The happy lady replied. "We'll replace the faulty card under warranty!".
Roman says AAARRRGGGGH! ;)
 
Last edited:
Great story! Thanks for all the detail. While I've never gone to such extremes to verify a potentially bad card (especially since they are only a few bucks) i have used some of those programs to pull damaged pictures off.
 
Mr RB... you went way over board... After the second time the 'ghost' contents showed up you should have junked the card, it's obviously something with the controller portion of the card went bad.
 
Thanks guys! I didn't really spend that many hours in total on it, but it was over days which definitely added to the frustration.

And of course it was not a price issue, just a stubborn old guy who got more and more committed after each failed "fixit" attempt. I did a lot of years in TV and VCR repair and had a reputation for being able to fix things other shops couldn't. ;)
 
actualy i know why you did it. sometimes you just wanna see if you can fix it!! great attempt tho lol. have you tried a large static charge to exorcise the demon?? ok subject will probaly die as well but demons must not be left!! :D other less dramatic solutions include sticking the card into a clove of garlic? not sure if it works on electronic demons but worth a try.
2 weeks submerged in holy water? ask the local God botherer to say a few over it. failing that burn the blighter at the stake
 
Last edited:
Nice work, Mr RB. I've had weird problems with SD cards, never spent the time and effort to find an exact answer like this.
 
He doesn't have an exact answer though! From here it's off the a reverse engineering lab to find out what part of the controller went bad that still allowed it to otherwise function perfectly fine.
 
...
...failing that burn the blighter at the stake

Actually it's going to have a little handshake with my 50v 6A bench PSU, if it wants to be a defective card, well then I feel obliged to support its decision... ;)


Scaedwian said:
He doesn't have an exact answer though! From here it's off the a reverse engineering lab to find out what part of the controller went bad that still allowed it to otherwise function perfectly fine.

Yeah it's annoying not to know the exact failure mechanism. The card read fine, so I was able to save all the family photos ok before all the fixit attempts. The fault was that actual writes to eeprom did not occur, but the card internal controller reported "write was ok". So as I see it the fault was either;
1. The card controller does not read back the data after writing, it just writes blind, then always signals "write was ok" after the full write time cycle. And the Vpp power section fo the card had failed.
2. The card controller was writing and then reading the data, but some logic gates etc in the controller after the read process had failed?

I think 1 is much more likely, as it seems logical the Vpp generator (a power section of the hardware) might have failed during low battery fault in the camera, than a failure of some very specific gates in exactly the error detect circuit of the card logic.

It was a Sandisk barnd card, so it should not be a worse design than typical cards. This means that cards write blind and don;t check the written data, that is left up to the host device. The camera was saying "card fault" after a photo, obviously it was writing the photo file then reading the photo file back (trying), and seeing an error, which would have been that the file did not exist.

But in Windows, I could erase the files, and even reformat, and Windows relied entirely on the card saying "write was ok" so Windows (and most of the utilities) did not have a clue the write failed as they did not manually read the files etc after they wrote.

I think the moral of the story is to always read back what you wrote to a card, especially if writing software or designing an embedded app that uses cards!
 
Last edited:
you make a very good point RB with verifying by read back! is a bit unsettling to think that a fault like that isnt always correctly detected. as for the bench supply you must first get replacement card and take pics of it death throws!! please check the pics have been saved tho :D:D
 
sounds like the bulk erase cycle on the chip is effed. Trouble with flash is, as it cn only erase/write in bulk, most transactions are done purely in on-board ram. If the connection between the flash sectors and ram aren't perfect, you're just dealing with a small sector-wide area of SRAM rather than flash, with the occassional read-back being corrupt when the flash contents *does* make it into the sram. A single flash chip has some pretty complex logic in there, even if the huge flash array is perfect, the complicated interface (be it parallel out, or serial out) can make it go batsh*t when a controller device expects it to behave.

I'd frame it if I were you. Best halloween accessory for any geek!

Good call on doing it the 'plug it into a micro' way :)
 
Haha nothing special on the family pics.

Actually the lengths I went to was to get the card working again in the camera, it is the only card I have for the camera. :(

The shop lady rang back and said she would mail us a new card express courier, no charge, and not bother to return the dead one. How's that for customer service! :D

Blueteeth- Thanks for the info. It was weird that reads were always 100% perfect and writes were always nothing written. There was no other evidence of card fault in any way.

What really opened my eyes was that I remember writing files to the card in WinXP and in Win98, and both windows thought the files were written ok. So if you back up stuff onto cards, don't trust windows to ensure it is actually correct ON the card!

R.I.P. ElDiablo Card!
ElDiablo card got connected to my 50v PSU, in lots of combinations onto his pins. I didn't see the 6A ammeter needle move at any time, but there were a couple of tiny "kapop" sounds in the card. No melted plastic, no fire and brimstone, sigh, card not living up to his name. ;)
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top