SDK Bug in MMC code with DDR device

cancel
Showing results for 
Search instead for 
Did you mean: 

SDK Bug in MMC code with DDR device

Jump to solution
263 Views
padraig_fogarty
Contributor III

I'm using a LPC54608 with an external IS21ES04G eMMC memory device (which supports DDR) and I believe there is a bug in the SDK code (see fragment below) which causes the incorrect eMMC bus interface to be selected.

When setting up an eMMC/MMC device the default card->busWidth value is kMMC_DataBusWidth1bit, therefore the switch statement below will always attempt to firstly select a DDR interface and because the eMMC device flags indicate that it does support DDR this configuration is selected. The subsequent MMC_TestDataBuswidth() and MMC_SetDataBusWidth() functions succeed and the interface is consequently set for DDR.

However, to the best of my knowledge the LPC546xx does not support DDR on the SD/MMC and SDIO interface, therefore data access to the external device will not function beyond this point.

The same problem arises for both 8-bit and 4-bit interfaces.

One work-around for this problem is to set the card->busWidth before calling the MMC_SetMaxDataBusWidth() function thereby forcing the switch/case statement to bypass the offending code and set the bus correctly to non-DDR mode.

BUT I would expect that the code should not allow an unsupported option to be selected in the first place.

Regards,

Padraig

static status_t MMC_SetMaxDataBusWidth(mmc_card_t *card, mmc_high_speed_timing_t targetTiming)
{
    assert(card);

    status_t error = kStatus_Fail;
    switch (card->busWidth)
    {
        case kMMC_DataBusWidth1bit:
        case kMMC_DataBusWidth8bitDDR:
            /* Test and set the data bus width for card. */
            if ((SDMMCHOST_NOT_SUPPORT != kSDMMCHOST_Support8BitBusWidth) &&
                (card->flags & (kMMC_SupportHighSpeedDDR52MHZ180V300VFlag | kMMC_SupportHighSpeedDDR52MHZ120VFlag)) &&
                ((targetTiming == kMMC_HighSpeedTiming) || (targetTiming == kMMC_HighSpeed400Timing)))
            {
                SDMMCHOST_SET_CARD_BUS_WIDTH(card->host.base, kSDMMCHOST_DATABUSWIDTH8BIT);
                if ((kStatus_Success == MMC_TestDataBusWidth(card, kMMC_DataBusWidth8bitDDR)) &&
                    (kStatus_Success == MMC_SetDataBusWidth(card, kMMC_DataBusWidth8bitDDR)))
                {
                    error = kStatus_Success;
                    card->busWidth = kMMC_DataBusWidth8bitDDR;
                    break;
                }
                /* HS400 mode only support 8bit data bus */
                else if (card->busTiming == kMMC_HighSpeed400Timing)
                {
                    return kStatus_SDMMC_SetDataBusWidthFailed;
                }
            }

Labels (2)
0 Kudos
1 Solution
121 Views
soledad
NXP Employee
NXP Employee

Hi, 

Thank you very much for the valuable information, I agree with you that this is a bug in the SDK code,  your recommendation seems fine to me,  I am going to pass down your feedback to our developers, so they can take care in the next release of the SDK. Again thank you for your collaboration.


Have a great day,
Sol

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

View solution in original post

0 Kudos
1 Reply
122 Views
soledad
NXP Employee
NXP Employee

Hi, 

Thank you very much for the valuable information, I agree with you that this is a bug in the SDK code,  your recommendation seems fine to me,  I am going to pass down your feedback to our developers, so they can take care in the next release of the SDK. Again thank you for your collaboration.


Have a great day,
Sol

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

View solution in original post

0 Kudos