Go to previous topic
Go to next topic
Last Post 21 Mar 2012 02:02 AM by  rohit.jain@cgglobal.com
MMCSD example fails test
 1 Replies
Author Messages
rohit.jain@cgglobal.com
New Member
New Member
Posts:


--
19 Mar 2012 04:33 AM
    Hi,
    When we build and run "AM1808eXp MMCSD Test" BSL example code with SD card provided with the kit, the code hangs after printing the following:

    --- identify card ---

    On debugging with breakpoints, we found out that the code gets stuck inside sendCmd() function in following while loop.

    if (check_status)
    {
    while (1)
    {
    stat_reg = mmcsd->MMCST0;
    stat1_reg = mmcsd->MMCST1;

    if (CHKBIT(stat_reg, RSPDNE))
    {
    rtn = ERR_NO_ERROR;
    break;
    }
    else if (CHKBIT(stat_reg, TOUTRS))
    {
    rtn = ERR_MMCSD_TIMEOUT;
    break;
    }
    }
    }

    This sendCmd() is in-turn invoked by MMCSD_identifyCard() function found inside the same file evmam1808_mmcsd.c. On close observation we found that code hangs after calling :-

    sendCmd(mmcsd, MMCSD_CMD_APP, 0, 1);

    That implies two things :-
    1. A response time-out event has not occurred
    2. No receiving response is done

    Strangely, the debugger shows the value of MMCST0 as 0x00 and MMCST1 as 0x30 for this state. Furthermore, when we remove the card after first sendCmd() inside MMCSD_identifyCard() (using breakpoint and run), we get time-out flag set in MMCST0.

    Is it required to have initialization clock and operational (read/write) clock to be different, say 400kHz and 20MHz respectively?

    Regards,
    Rohit
    rohit.jain@cgglobal.com
    New Member
    New Member
    Posts:


    --
    21 Mar 2012 02:02 AM
    Hi,

    An update regarding this issue. We went through the technical reference manual of AM1808 and found out that the MMC/SD clock speed has to be below or equal to 400KHz during initialization procedure as mentioned below:-

    NOTE: The MMC/SD cards require a clock frequency of 400 KHz or less for the card initialization
    procedure. Make sure that the memory clock confirms this requirement. Once card
    initialization completes, you can adjust the memory clock up to the lower of the card
    capabilities or the maximum frequency that is supported.

    To our surprise we found out that the BSL code supplied with our AM1808 Zoom eXperimenter board fails to do so.

    Also the am1808_peripheral_overview.pdf document clearly mentions that MMC/SD card controller supports a maximum 25 MHz clock to SD (specification v1.1). But when we go through the calculations of AM1808eXp MMCSD Test source files we find that the clock is initialised to 37.5MHz which is way beyond the mentioned maximum value.

    In the file evam1808_mmcsd.c found in AM1808 BSL, under the MMCSD_init() function its mmcsd->MMCCLK = 0x0101 which in turn means that CLKRT is set to 1 i.e. memory clock frequency = function clock frequency/(2 × (CLKRT + 1) ) = 150 MHz /4 = 37.5MHz

    Further when we change the value of mmcsd->MMCCLK to 0x01BB which makes the memory clock frequency just below 400KHz the code then successfully comes out of above mentioned while loop with NO_ERROR status. Later when sendCmdOpCondSD() function under MMCSD_identifyCard() function is called the OCR response from the card is 0x00FF8000 which means the 'Ready' bit in OCR response is not set. This is not changing for repeated attempts (2048 retries in the code). We expect 0x80FF8000. Again there is ambiguity regarding the second argument passed to sendCmdOpCondSD() function which is MMCARGHL = 0x00ff8000. Since the MSB is 00 it implies that the card is of the type SDSC. We are not sure of the card type supplied to us with the LogicPD AM1808 Zoom eXp kit. We tried changing this to SDHC (MMCARGHL = 0x40ff8000) for one of our SDHC 4GB SDHC card. But the result is same ie the OCR response is 0x00FF8000 instead is 0x80FF8000.

    All this points to one obvious thing that the code supplied to us is incorrect and may not be for AM1808 per say. Has any one of you been able to test is successfully on your Logic PD Zoom AM808 eXp kits ??

    Thanks and Regards,
    Rohit


    ---