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!
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.![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
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.![Frown :( :(](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
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!![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
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!
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.
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: