AnsweredAssumed Answered

sdmmc eMMC Decode CID properly

Question asked by JohnU on Jul 3, 2017
Latest reply on Jul 11, 2017 by JohnU

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.

Outcomes