Response from SD card vs MMC card during entering SPI mode

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi
I have a project which is intended to support both SD and MMC cards and i need to detect which type that is inserted.

According to sandisk app.note for systems supporting both MMC and SD cards it is said that when sending the SD initalization code first (i assumes it must be after entering the SPI mode) an MMC card will respond with an error providing me a way to identificate the card type. However, for me it looks like the register set for both types are equal and thus would respond equaly, atleast when it comes to initializing the cards. Has any of you been able to understand wath they are meaning here, I am a bitt slow today (also).

From the SD and MMC specs i find that the response of the CMD0 and CMD1 are identical. I first thought that maybe the MMC card always had atleast one 0xff before transmitting the response and that the SD card always responded immediate with valid response but i belive this is not true, i.e. its false, since the "Timing values" table says that time Ncr (time befor command respons) for MMC cards is between 1-8 Byte-time long and for SD it is said to be between 0-8 Byte-time long (1 Byte-time is 8 clk pulses). Thus I cant trust this information to detect the card type. Anyone had experience in detecting card types?

I have also thought aboute using the CID register, but i belive this information is to unreliable in content to be used in such a manner.

Thanks for any help provided...

Links:
http://www.sandisk.com/pdf/oem/AppNoteMMC_SDv1.0.pdf

Regards
Vidar (Z)

----------------------------------------------------------

"The fool wonders, the wise man asks"

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am doing the same stuff right now. I was under the impression that in SPI, and in non-secure modes the SD and MMC cards were functionally identical, though not necessarily with identical timings.

I have an SD card that I am trying to treat like an MMC card. I get the initialization all done, and I can set the block size. But I am failing reading the CID and CSD.

Maybe this is because the SD is different in its responses to those commands?

I will have to look at your appnote you linked to.

You might want to check out the code I posted which shows all the SD/MMC interface code I am currently working on.

-Tony

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

According to my SD spec there should be no large diffenties between MMC and SD cards except that the SD card has more functionality. When it comes to CID and CSD, they should work equal to MMC by first sending the R1 responsebyte and then the datablock containing CID/CSD info.. (the response R1 byte has equal format as in MMC). Try reading the status register (CMD13 for both MMC and SD) to see if you have any error conditions. Status register is chapter 3.5.4 in sandisk MMC spec. This should be equal to SD status register except for some unused bits in the MMC spec. The used bits for MMC cards have the same bit names in the SD spec.

According to my own question about detecting card type, I can use the application spesific command ACMD51 for SD cards which provides me with the SD register SCR (Sd Configuration Register) which again provides me the built in features in the SD card like security algorithm version. I belive that MMC cards will respond with R1 with illegal command bit set. (havn't been able to test this yet).

Regards
Vidar (Z)

----------------------------------------------------------

"The fool wonders, the wise man asks"

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Spamiam wrote:

I have an SD card that I am trying to treat like an MMC card. I get the initialization all done, and I can set the block size. But I am failing reading the CID and CSD.

Maybe this is because the SD is different in its responses to those commands?
-Tony

Tony, I have been compared the two card type specs. and there is indeed a differnce between the two cards when it comes to CSD structure (size is the same) and therefor, depending on the information you need to extract from CSD, you ought to detect which card type u use. Reading CSD could also give the necessary info required to detect card type correctly. I belive that bit 125:122 will always be differnt from 0 for MMC cards but always 0 for SD cards. please correct me if proven wrong. In the SD spec there is also some bits confusing me like the R2W_FACTOR which is allocated from bit 1:16 according to spec, but these bits are also allocated by otthers. Do u know anything aboute these bits??

EDIT: It was missing a ] in the quote

Regards
Vidar (Z)

----------------------------------------------------------

"The fool wonders, the wise man asks"

Last Edited: Fri. Mar 7, 2008 - 09:51 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It looks like you are right, although I haven't been able to test it. CMD51 is listed as "Reserved" in the MMC spec, so I would expect it tor return an illegal command response.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am also writing code to communicate with an SD card, and since I can't find SD documentation I am using the MMC documentation.

I have been able to initiate SPI mode, read the OCR, CID and CSD registers, and they look OK, although I have not verified it all. This has worked both for a SD and a microSD card, although there are still some issues. For example, the microSD card will not talk the first time after inserting it, but if I reset the AVR and run the code again, it works fine!