views:

7117

answers:

5

I'm using a micro-SD card in an embedded design. The card is connected to a microcontroller using the SPI interface. It worked fine for all cards I've used before, but now my new card will not initialize. The card is a Transcend 2GB micro-SD card (TS2GUSD).

After sending the initial clock train to switch to SPI mode I do the following:

1) CMD0 (Argument 0, CRC 0x95) -> Response 0x01 -> OK

2) CMD8 (Argument 0x000001AA, CRC 0x87) -> Response 0x01 0x000001AA -> Means it's SDC V2+ card, the Voltage range 2.7V~3.6V is supported -> OK

Then I should send the ACMD41 command, but when sending the CMD55 (argument 0, CRC 0) that must precede CMD41, I get response 0x05 -> Illegal Command. I've also tried to send CMD1 (for MMC cards), but it gives a similar Illegal Command response. The code works fine with my Sandisk 2GB micro-SD card.

Does anyone have any idea?

Thanks,

-Ron-

+1  A: 

It's normal, it's likely the internal charge-pump used to make erase voltage that takes longer than usual to be ready... you have to insist on the CMD55+ACMD41 combo until initialization finishes.

The CMD58 could also help you to check if you're supplying correct voltage levels (sometimes sockets have contact problems).

jpinto3912
The card loops indefinitely on the CMD55 with result 0x05. I've waited more then long enough and nothing changes. CMD58 has the same result 0x05. In the meantime I've pinpointed the issue, see answer below.
Ron
+9  A: 

I seem to have found the issue. When I calculate the correct CRC for CMD55 and send that instead of a dummy CRC the command is accepted (result 0x01). If you look at the physical layer specification at sdcard.org (http://www.sdcard.org/developers/tech/sdcard/pls/Simplified_Physical_Layer_Spec.pdf) in section 7.2.2 is it explicitly said that: "The SPI interface is initialized in the CRC OFF mode in default." (except for commands CMD0 and CMD8). This doesn't seem to be the case with this series of Transcend cards, thus violating the specification. Also in case of CRC error the reply should be 0x09 instead of 0x05. I've tried to explicitly turn off CRC checking with CMD59 but that doesn't seem to help.

=> Calculating the correct CRC for (all?) commands makes the card work.

I'm in contact with Transcend support about this. If i learn something useful I'll you know here.

Note that I used other 2GB Transcend cards before, but they were made in Taiwan, while the new one is made in Korea (and seems to be a Samsung card (MMAGR02GUDCA)).

Ron
nice! good you dig the issue up!... I'm just stunned because that seams to point that the USB card readers don't use combo commands. You can/should mark your answer as the correct one.BTW, sandisk, transcent, etc do not have semiconductor foundries... they do controllers and digital design services for their products (they just don't actually fabricate the chips)
jpinto3912
I had to wait 48 hours to mark my answer as correct for some reason.I think USB card readers will use the "real" SD Memory Card protocol" interface (has higher speeds). In that mode you have to use CRC and there's likely no issue.
Ron
A: 

Hi, I think I have same problem with some Kingston MicroSD cards, can you post the Checksum used on the CMD55 ?

Also any comment on how to detect if the card does not support SPI mode at all? I heard SPI is not mandatory on microsd cards so I want a way to detect (and refuse the use) of a card if dont support SPI mode. I know if I run the initialization for those no-spi card it will fail, but I would like to detect in simple way and not wait till initialization fail.

Best Regards

  • Francisco -
I used this application to calculate the CRC7: http://i.cmpnet.com/pldesignline/2008/07/crc7expl.zip It includes source code, so I made the CRC7 automatic in my code. I'm not sure if only CMD55 needs to have a CRC7 or all subsequent as well. I got info from Transcend and they told me my cards have Samsung controller. They also have the same product with SMI controller (probably the type I had at first). AFAIK all cards should support SPI mode. Have a look here for initialization sequence: http://www.sdcard.org/developers/tech/sdcard/pls/Simplified_Physical_Layer_Spec.pdf (page 106).
Ron
A: 

I'm using a Dane-Elec 1GB SDCard and I'm stuck with a similar, but not equal, problem. After the card receives the CMD0 command and enters in IDLE STATE I can't make it initialize. Almost every command is rejected with a ILLEGAL_COMMAND & IDLE_STATE. It rejects CMD1 and ACMD41. I tried CMD8 (in some webpages says that an ILLEGAL_COMMAND answering to that particular command may mean that the card is V1.X). I followed the CMD8 with a CMD58 to retrieve de OCR and once the card answered that the voltages were fine. I tried resetting the program but I keep getting 0xFF.

I can't initialize the card. I don't know if the messages need any special delay between the CS or the CLK.

Could anyone please help?

Thanks in advance

Cristian

Cristian
For a follow-up question like this it would be better to ask it as a new question ("Ask Question" button in the top right of the page), not post it here in an old thread. More people would see it and try to solve your problem.
sth
Have a look at the physical layer specification at sdcard.org (http://www.sdcard.org/developers/tech/sdcard/pls/Simplified_Physical_Layer_Spec.pdf) section 7.2.1, page 95. You end up in the left "leg". Please try to poll the ACMD41 after the CMD8 and CMD58 until the card is ready.
Ron
A: 

when I send the CMD55 (argument 0, CRC 0) I get response 0x05 -> Illegal Command,and I send the CMD55 (argument 0, CRC 0x65),the response is still 0x05,Could anyone please help?

Lance