sdmmc eMMC Decode CID properly

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

sdmmc eMMC Decode CID properly

3,024 Views
JohnU
Contributor III

Hi,

Patch proposal for SDK 2.2.0 (LPCXpresso54608):

Date:   Fri Jun 30 13:37:31 2017 +0200

    sdmmc: fix MMC_DecodeCid() according to MMC spec (not SD spec)

    JSED84-B45 and Physical Layer Simplified Specification Version 2.00
    define a little different CID fields structure.

diff --git a/sdmmc/src/fsl_mmc.c b/sdmmc/src/fsl_mmc.c
index e980aa4..770930d 100755
--- a/sdmmc/src/fsl_mmc.c
+++ b/sdmmc/src/fsl_mmc.c
@@ -1497,13 +1497,14 @@ static void MMC_DecodeCid(mmc_card_t *card, uint32_t *rawCid)
     cid->productName[2U] = (uint8_t)((rawCid[2U] & 0xFF0000U) >> 16U);
     cid->productName[3U] = (uint8_t)((rawCid[2U] & 0xFF00U) >> 8U);
     cid->productName[4U] = (uint8_t)((rawCid[2U] & 0xFFU));
+    cid->productName[5U] = (uint8_t)((rawCid[1U] & 0xFF000000U) >> 24U);

-    cid->productVersion = (uint8_t)((rawCid[1U] & 0xFF000000U) >> 24U);
+    cid->productVersion = (uint8_t)((rawCid[1U] & 0xFF0000U) >> 16U);

-    cid->productSerialNumber = (uint32_t)((rawCid[1U] & 0xFFFFFFU) << 8U);
-    cid->productSerialNumber |= (uint32_t)((rawCid[0U] & 0xFF000000U) >> 24U);
+    cid->productSerialNumber = (uint32_t)((rawCid[1U] & 0xFFFFU) << 16U);
+    cid->productSerialNumber |= (uint32_t)((rawCid[0U] & 0xFFFF0000U) >> 16U);

-    cid->manufacturerData = (uint16_t)((rawCid[0U] & 0xFFF00U) >> 8U);
+    cid->manufacturerData = (uint16_t)((rawCid[0U] & 0xFF00U) >> 8U);
 }

 static status_t MMC_AllSendCid(mmc_card_t *card)

best regards

J.

Tags (1)
0 Kudos
Reply
2 Replies

1,874 Views
soledad
NXP Employee
NXP Employee

Hi,

 Is this thread related to the below threads?

sdmmc SD_Write()/SD_Read() failed with ATP card 

https://community.nxp.com/thread/454708 

Regards

Soledad

0 Kudos
Reply

1,873 Views
JohnU
Contributor III

Hi,

no, each of the issues is separate.

The patch concerns MMC chip and the links concerns different SD cards (different initialization problems).

Common things are only library name (sdmmc) and SDIF hardware.

best regards

J.

0 Kudos
Reply