SD card became unrecognized by card readers

as I said before I tried it with any device I have including my laptop and camera.

thanks anyway:)

Guess your card failed.

It is rare for a card to fail, and your card is the first I have seen that responds to CMD1, set SPI mode, and doesn't respond to ACMD41.

ACMD41 is the command that switched the card from card identification mode to data transfer mode. Your card just stays busy and times out.

Your card just stays busy and times out.

And you don't think that has anything to do with removing the power in the middle of writing to it?

No mike, SD cards don't fail due to removal while powered on. Billions have been made and people pull them from powered on devices all the time.

Look at the pins. Power and ground are a bit longer than the signal pins so first the signal pins disconnect then power.

Here is the quote from the spec:

Hot Insertion
Support for hot insertion will be required on the host but will be supported through the
connector. Connector manufacturers will provide connectors that have power-pins long
enough to be powered before contact is made with the other pins. This approach is similar
to that used in PCMCIA and MMCA devices to allow for hot insertion.

The SD buffers the entire block internally before writing to flash. It does the flash programming in a fail safe way. It either completes correctly or the block is not marked as written if power fails.

Pulling a card can cause the file system to become corrupt but does not damage the card.

Yes but hot insertion is not the same as hot removal.
Anyway I am not sure if the card removed with the power on or the power was removed with it still being written to.

That is a scenario that is not duplicated by billions of people. It is very difficult to time that right in a piece of consumer equipment if you wanted to duplicate it. By constantly opening, writing and closing a file the chances of hitting a critical spot in the internal process increases dramatically. This is something that you would not expect to see in the field because that sort of cycling is not done in with consumer equipment.

I know you can kill flash memory by trying to write to it with lower than the required voltage. I used to design power detection circuits in set top boxes to file away channel information in the case of a power outage and I know if you didn't get it right you could damage the flash memory.

you are right,

I didn't remove the SD card while running
I shut the power off during run - apparently it was worse

No! Here is more detail. Please read the Spec and manufacture's data sheets. SD cards were designed to be foolproof.

Physical Layer Specification Version 3.00

6.1 Hot Insertion and Removal

To guarantee the proper sequence of card pin connection during hot insertion, the use of either a special hot-insertion capable card connector or an auto-detect loop on the host side (or some similar mechanism) is mandatory (Refer to the Mechanical Addenda).

No card shall be damaged by inserting or removing a card into the SD Memory Card bus even when the power (VDD) is up. Data transfer operations are protected by CRC codes, therefore any bit changes induced by card insertion and removal can be detected by the host.

The inserted card shall be properly reset also when CLK carries a clock frequency Each card shall have power protection to prevent card (and host) damage. Data transfer failures induced by removal/insertion are detected by the host. They should be corrected by the application, which may repeat the issued command.

Card connectors and cards conform to this spec.

Here is info from a typical datasheet for a SanDisk card:

Hot Insertion/Removal

Hot insertion and removal are allowed. The SanDisk SD Card will not be damaged by inserting or removing it into the SD bus even when the power is up:

• The inserted card will be properly reset also when CLK carries a clock frequency fPP.

• Data transfer failures induced by removal/insertion should be detected by the bus master using the CRC codes that suffix every bus transaction.

3.2.1. Power Protection

Cards can be inserted into or removed from the bus without damage. If one of the supply pins (VDD or VSS) is not connected properly, then the current is drawn through a data line to supply the card.

Data transfer operations are protected by CRC codes; therefore, any bit changes induced by card insertion and removal can be detected by the SD bus master. The inserted card must be properly reset also when CLK carries a clock frequency fpp. If the hot insertion feature is implemented in the host, than the host has to withstand a shortcut between VDD and VSS without damage.

You seem to be missing the fact that this was not a hot insertion or removal. It was the removal of power during an operation on the flash. That is not covered in any of the specifications.

Mike give up. The spec says the card will not be damaged. That means during write. They have power controllers and caps to insure this.

Some SD controllers even have enough caps to insure the data block is saved.

New Panasonic cards say this:

Even if you mistakenly remove the SD card or turn off the power while data is being written to it, all of the saved data will be retrieved to ensure that you don't lose it.

Edit: The file or file system may be bad but the card is not damaged if power is removed during write. You can reformat it and it will be OK.

Also cards have a large number of spare blocks and during the life of an SD many blocks become bad and are retired to a bad block list. So even if a block were damaged by power failure, the card survives.

Data blocks have ECC so when a read has a correctable ECC error, the block is rewritten by modern cards.

fat16lib - you are talking like so many software engineers I have known. You can't change the laws of physics by writing a spec that says it should not be so.

Clearly something happened for the card to fail, it could be:-

  1. A random fail unconnected with anything he was doing.
  2. Something he did that caused the fail or made it more likely.

You seem to be saying it is 1) because it couldn't be 2) {as an aside have you ever read Catch 22?, the bit where the plane crashed and he was on the passenger list}

So if you are so sure of yourself, take four SD cards from different manufacturers. Run that same code, and plug and unplug the arduino say twenty to thirty times with about 20 seconds between plugs. Then if you get a fail you will know you are wrong. If you don't get a fail you will either be right or the OP was particularly unlucky.

Mike, you are a grumpy old guy. Kind of funny/amusing too.

I am a PhD physicist. I taught solid state physics to EEs.

I spent most of my career at large world class research labs working with advanced electronics. LBNL, CERN, Fermilab, and others.

Now that I am retired, I amuse myself with programming since I didn't have time for that while I was working. I had a large staff of electrical engineers and programmers.

It is about probability and it is extremely unlikely that pulling the card during a write damaged it since it was designed to be pulled during write with power on it.

I have tried to damage SD cards by pulling them during write. I wrote a program to do the fastest possible raw write to an SD card to see what would happen. I never damaged any.

Well your career almost matches mine, PhD, Physics lecturer at a University for 21 years taught graduate and undergraduate EE and Physics students and then in industry for 15 years.

However what I can't understand is you keep saying:-

It is about probability and it is extremely unlikely that pulling the card during a write damaged it

I know he didn't damage it by pulling it out of the socket,
He removed the power from the arduino he did not pull out the SD card from its socket!
That is what you have to test!

I can only assume that your time in academia robbed you of some vital fault finding ability. Something happened, I have never known any academic so starved of data that he will not formulate a hypothesis, so what is yours?
All you keep saying is it could not be this. No alternative explanation?

I know he didn't damage it by pulling it out of the socket.

How do you know this? Static on a signal pin could do it.

Wow, you put me in my place.

I can only assume that your time in academia robbed you of some vital fault finding ability. Something happened, I have never known any academic so starved of data that he will not formulate a hypothesis, so what is yours?
All you keep saying is it could not be this. No alternative explanation?

Static on a signal pin could do it.

You can't get static on a pin on a removal, think about it.
It is also hard to get static on any conducting surface, but you know that. :wink:

Why do manufactures say this?

Do not touch the terminals with your hands or metal objects. The card may get corrupted or erased by electrical noise, static electricity.

Is Sony wrong?

To avoid losing stored data, keep SD memory cards away from static electricity or electrical noise that may interfere with the card.

When carrying SD memory cards, be sure to put them in their case to avoid static electricity damage.

al_ra,

Mike has me a bit curious about your failed card. I have never seen a true SD card lockup on ACMD41. I have seen it with MMC cards and is to be expected since they they don't support ACMD41.

Could you provide a little more info?

How did you acquire it? There are many counterfeit cards on ebay that have modified firmware and often lockup. These cards are small but are reprogrammed to appear much larger and lockup after some use.

What is the brand?

What is the size in MB or GB?

What is the model for example SanDisk has Ultra, Extreme, etc. Other manufactures have other model names.

What is the class number? 2, 4, 6, 10 are common.

Add anything else you think might be helpful.

it is a genuine sandisk SD card, 1GB, I don't know the model (I added 2 photos)

Where and when did you buy that card.

The SanDisk 1GB card is one of the most counterfeited cards.

Your card has the correct notch at the bottom but the write protect tab doesn't look like quite right, and the label look suspicious.

Could you download my Fat16 library Google Code Archive - Long-term storage for Google Code Project Hosting. and run the fat16info example.

Post the output. It's a long shot but it might give more info.

I think it was 5 years ago , i got it with my canon camera - I bought it from a distinguished photography shop

the test result are:

Fat16 version: 20111205
FreeRam: 1264

type any character to start
card.init failed
SD error
errorCode: 2
errorData: 1

type any character to start