This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Micro-SD support

Other Parts Discussed in Thread: OMAP-L138

Hello,

I'm currently investigating a micro-SD issue with a custom board, which uses the OMAP-L138 SOM-M1 module. I modified the UBL to properly configure the pin mux controls, and I don't think any other changes are required. I'm also assuming (at this point) the U-Boot version 2009.11 (Feb 08 2011 - 11:29:52) supports micro-SD non-high capacity devices. It is my understanding that a micro-SD device is equivalent to SD device for a given class, and should be supported by the OMAP-L138 for cards that supports 2GBytes or less.

I'm using the u-boot command  "mmcinfo 0" to get status from the device, which returns the following:

Card did not respond to voltage select!
Device: davinci
Manufacturer ID: 0
OEM: 0
Name: Tran Speed: 0
Rd Block Len: 0
MMC version 0.0
High Capacity: No
Capacity: 0
Bus Width: 1-bit

I purchased an micro-SD extender board for debugging and suddenly it's working, and reports the following information:

Device: davinci
Manufacturer ID: 2
OEM: 544d
Name: SA02G
Tran Speed: 25000000
Rd Block Len: 512
SD version 2.0
High Capacity: No
Capacity: 1973420032
Bus Width: 4-bit

This information looks like it is compatible with SD specifications v1.1. The TMS320C674x/OMAP-L1x Processor Multimedia Card (MMC)/Secure Digital (SD) Card Controller user guide states the following are supported(pg 10):


The MMC/SD card controller supports the following industry standards (with the exception noted below):
• MMC (Multimedia Card) Specification V3.31
• SD (Secure Digital) Physical Layer Specification V1.1
• SDIO (Secure Digital Input Output) Specification V1.0
The information in this document assumes that you are familiar with these standards.
The MMC/SD controller does not support the SPI mode of operation.

Again, I do suspect a hardware issue, but hopefully somone can provide additional information.

Thanks

  • Michael,

    I am going to move this post to the Linux support forum so the right experts can clarify about what the UBL supports etc..

    regards,

    miguel

     

  • The same problem with DM365 !!!

    I have two boards:
    * DM365EVM
    * our custom DM365 board (microSD on SDMMC0 controller)

    Both UBL are the almost same (differences only the settings of DDR and NAND-flash in 'DM36x/Common/src/device.c').
    Both are OSCIN=24Mhz and Both are PPL1.SYSCLK8=486MHz/4= 121 500 000 Hz
    I.e. ubl is not a problem. I believe it is almost 100%

    There are problems in u-boot.

    U-Boot is v2010.12_DAVINCIPSP_03.21.00.04

    microSD is QUMO 2Gb

    If I insert THIS microSD card via SD-Adapter into DM365EVM (SDMMC0 controller) top slot.

    uboot # mmcinfo

    Device: davinci
    Manufacturer ID: 0
    OEM: 0
    Name: SD2GB
    Tran Speed: 25000000
    Rd Block Len: 512
    SD version 2.0
    High Capacity: No
    Capacity: 2038431744
    Bus Width: 4-bit


    If I insert THIS microSD card to custom board (into microSD connector).

    uboot # mmcinfo

    [ ST0 ERROR 80]
    Status 401 Timeout ST0:0 ST1:31
    Status 401 Timeout ST0:0 ST1:31
    Status 401 Timeout ST0:0 ST1:31
    Status 401 Timeout ST0:0 ST1:31
    Device: davinci
    Manufacturer ID: 0
    OEM: 0
    Name: SD2GB
    Tran Speed: 0
    Rd Block Len: 1
    SD version 2.0
    High Capacity: No
    Capacity: 4
    Bus Width: 1-bit


    Hmmmmmmm.......
    At first I thought that nothing works.
    But then I began to understand what was going on and saw that the card is still responding.

    I can see something strange "step-up" (start at 1bit@200kHz) card init sequence in u-boot.
    At first...

    Our custom brd has only SDMMC0, and I turned off the SDMMC1.

    In include 'include/configs/davinci_dm365evm.h ' I commented out line '#define CONFIG_DAVINCI_MMC_SD1' as ''//#define CONFIG_DAVINCI_MMC_SD1'.

    Ok. U-Boot prints that only 'davinci:0' is exist.

    Look at:

    "drivers/mmc/mmc.c"

    "drivers/mmc/davinci_mmc.c"

    At first 'mmc_initialize()' from "drivers/mmc/mmc.c". It prints 'davinci:0'. All is good.

    At second. If I type 'mmcinfo'...

    mmc_init() called from "drivers/mmc/mmc.c"

    mmc_set_bus_width(mmc, 1);
    mmc_set_clock(mmc, 1);

    As a result, we see at "drivers/mmc/davinci_mmc.c" ('dmmc_set_ios' and 'dmmc_set_clock')

    Bus width = 1 bit

    Clock = 237305 Hz (? see below)

    Ok... clock=200000 (input arg 'clock' = 200kHz)

    sysclk2 = host->input_clk = 121500000

    clkrt = (sysclk2 / (2 * clock)) - 1 = 121500000 / 400000 = 303.75

    act_clock = (sysclk2 / (2 * (clkrt + 1))) = 200495

      55         /* Adjust divider if actual clock exceeds the required clock */
      56         if (act_clock > clock)
      57                 clkrt++;

    clkrt=304?


      58
      59         /* check clock divider boundary and correct it */
      60         if (clkrt > 0xFF)
      61                 clkrt = 0xFF;
      62

    clkrt=255 (!!)

    real_act_clock = (sysclk2 / (2 * (clkrt + 1))) = 121500000/(2*256) = 237305 Hz

    But this is all nonsense !

    As a result, the functions of mmc_init () is invoked the following sequence:

    "drivers/mmc/mmc.c" mmc_go_idle

    "drivers/mmc/mmc.c" mmc_send_if_cond

    "drivers/mmc/mmc.c" sd_send_op_cond

    "drivers/mmc/mmc.c" mmc_startup

    As a result .. the next sequece of SD COMMANDS are invoked...

    I print table... with microSD card into SD-adapter and microSD card into microSD slot.

    SD Commands SEQUENCE

    microSD via SD-adapter

    native microSD

    MMC_CMD_GO_IDLE_STATE (CmdIdx=0, Arg=0)

    OK (no respose)

    OK (no respose)

    SD_CMD_SEND_IF_COND (CmdIdx=8, Arg=0x1AA)

    OK (resp=0x1AA)

    OK (resp=0x1AA)

    Cycle until '(cmd.response[0] & OCR_BUSY)' or 'timeout'

    MMC_CMD_APP_CMD (CmdIdx=55, Arg=0)

    OK (resp=0x00000120)

    OK (resp=0x00000120)

    SD_CMD_APP_SEND_OP_COND (CmdIdx=41, Arg=0x40300000)

    OK (resp=0x00FF8000)

    OK (resp=0x00FF8000)

    *** if (cmd.response[0] & OCR_BUSY) = TRUE !!! after 2-3 cycles.

    MMC_CMD_ALL_SEND_CID (CmdIdx=2, Arg=0)

    response[0]=0x00000053

    response[0]=0x00000053

     

    response[1]=0x44324742

    response[1]=0x44324742

     

    response[2]=0x00000010

    response[2]=0x00000010

     

    response[3]=0xA000B775

    response[3]=0xA000B775

     

    this means:

    this means:

     

    oem=0, manuf=0

    oem=0, manuf=0

     

    Name=SD2GB

    Name=SD2GB

     

    s/n: 10A0

    s/n: 10A0

     

    date: 07 (7) /2011 (b)

    date: 07 (7) /2011 (b)

    At this point I can see that all cases are GOOD! Both cards are responding!

    SD_CMD_SEND_RELATIVE_ADDR (CmdIdx=3, Args=(mmc->rca << 16)

    OK

    FAIL!! (no response!)

    FAIL POINT!

    etc... etc... etc...

    OK, OK.. OK...

    FAIL.. all responses are 0x00000000

     

    I can see coments in mmc_startup ( "drivers/mmc/mmc.c") before "cmd.cmdidx = SD_CMD_SEND_RELATIVE_ADDR;".

     628         /*
     629          * For MMC cards, set the Relative Address.
     630          * For SD cards, get the Relatvie Address.
     631          * This also puts the cards into Standby State
     632          */

    ???

    What does this mean?

    What is the difference between microSD and microSD-through adapter? (8pins vs 9 pins)

    Why these results?

    May be microSD in SD-adapter looks like MMC sometimes, but native microSD is never be MMC ? :-)

    What to do? What to do?
    Switch off the CMD3?

    The U-Boot supports microSD cards?

    Another sequence? At first... 4-bit... at 25Mhz (not need to do 1-bit at 200kHz) ?

    Where to get the correct sequence to make it work?

     


    Dear, You have solved the problem?

    Please help!

  • The root problem was a hardware issue that caused signal conflicts with the micro-SD card during initialization. The part number that caused this issue is FXL2SD106, which is Low-Voltage Dual-Supply 6-Bit Voltage Translator with Auto-Direction Sensing. We later realized that this part is obsolete and defective, and all of my SD issues were resolved after removing this chip. The OMAP-L138 and micro-SD casing are now directly connected.

    I did not have to modify u-boot or any board-specific architecture files in the Linux Kernel.

  • Thank you very much for fast reply!!!

    Our DM365 chip (SDMMC0 controller) connected directly to the microSD connector pins. Both sides are 3.3V.


    Nothing remains for me, but I need to be dig up in the U-Boot      :-(


  • Do you have pullups on the SD Card lines?

  • Good question!
    No! They are not present.
    Do you think that the problem lies in that point?

  • YES! Thank you very much!

    Problem solved. Pull-up resistors needed. Now it works in U-Boot.

  • That's great. Just one other note. U-Boot does not check the Card Detect and Read Only signals. Linux does. Yoy may lose or move these pins in moving to a custom board and/or micro-SD. You may need to modify the kernel.

  • Hi, Norman !
    Thank you for your comment.

    As I can see WriteProtect and CardInsert signals routed into Altera on DM365EVM.
    We don't use WP and INSERT signals. These signals are unconnected in our custom board.
    But if I reinsert card, the Linux notify a response to this event :-)
    I do not know why this is happening, but I suspect that maybe there is another mechanism to detect the card.
    Can be DAT lines are monitored? Maybe DAT3? I do not understand this now yet.

    In the meantime, I a little bit improve U-Boot.
    My U-Boot now can tell me about Serial Number, Revision and Manuf Date of card.

    Here is examples for two cards.

    QUMO 2Gb microSD
    ----
    Device: davinci
    Manufacturer ID       : 0x00
    OEM/Application ID    : 0x0000
    Product name          : SD2GB
    Product revision      : 0x00
    Product serial number : 0x000010A0
    Manufacturing date    : 7/2011
    Tran Speed    : 25000000
    Rd Block Len  : 512
    SD version 2.0
    High Capacity : No
    Capacity      : 2038431744
    Bus Width     : 4-bit


    SanDisk 32Gb microSDHC
    ----
    Device: davinci
    Manufacturer ID       : 0x03
    OEM/Application ID    : 0x5344
    Product name          : SU32G
    Product revision      : 0x80
    Product serial number : 0x71983B52
    Manufacturing date    : 8/2011
    Tran Speed    : 25000000
    Rd Block Len  : 512
    SD version 2.0
    High Capacity : Yes
    Capacity      : 31914983424
    Bus Width     : 4-bit




    Here is the PATCH :-)

    ---
    diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
    index f4cbdc2..32f041c 100644
    --- a/common/cmd_mmc.c
    +++ b/common/cmd_mmc.c
    @@ -90,23 +90,83 @@ U_BOOT_CMD(
     
     static void print_mmcinfo(struct mmc *mmc)
     {
    +/*
    +Manufacturer ID         MID     8     [127:120]
    +OEM/Application ID         OID     16     [119:104]
    +Product name             PNM     40     [103:64]
    +Product revision         PRV     8     [63:56]
    +Product serial number     PSN     32     [55:24]
    +reserved                 --         4     [23:20]
    +Manufacturing date         MDT     12     [19:8]
    +CRC7 checksum             CRC     7     [7:1]
    +not used, always 1         -         1     [0:0]
    +
    +MID:
    +CID0=xx000000
    +CID1=00000000
    +CID2=00000000
    +CID3=00000000
    +
    +OID:
    +CID0=00xxxx00
    +CID1=00000000
    +CID2=00000000
    +CID3=00000000
    +
    +PNM:
    +CID0=000000xx
    +CID1=xxxxxxxx
    +CID2=00000000
    +CID3=00000000
    +
    +PRV:
    +CID0=00000000
    +CID1=00000000
    +CID2=xx000000
    +CID3=00000000
    +
    +PSN:
    +CID0=00000000
    +CID1=00000000
    +CID2=00xxxxxx
    +CID3=xx000000
    +
    +MDT:
    +CID0=00000000
    +CID1=00000000
    +CID2=00000000
    +CID3=000yym00
    +
    +*/   
    +    unsigned int r,rh,rl;
         printf("Device: %s\n", mmc->name);
    -    printf("Manufacturer ID: %x\n", mmc->cid[0] >> 24);
    -    printf("OEM: %x\n", (mmc->cid[0] >> 8) & 0xffff);
    -    printf("Name: %c%c%c%c%c \n", mmc->cid[0] & 0xff,
    +    printf("Manufacturer ID       : 0x%02X\n", mmc->cid[0] >> 24);
    +    printf("OEM/Application ID    : 0x%04X\n", (mmc->cid[0] >> 8) & 0xffff);
    +    printf("Product name          : %c%c%c%c%c \n", mmc->cid[0] & 0xff,
                 (mmc->cid[1] >> 24), (mmc->cid[1] >> 16) & 0xff,
                 (mmc->cid[1] >> 8) & 0xff, mmc->cid[1] & 0xff);
    +    printf("Product revision      : 0x%02X\n", mmc->cid[2] >> 24);
    +
    +    rh=(mmc->cid[2] & 0x00ffffff)<<8;
    +    rl=(mmc->cid[3] & 0xff000000)>>24;
    +    r = rh | rl;
    +    printf("Product serial number : 0x%08X\n", r);
    +   
    +    rh=(mmc->cid[3] & 0x000ff000)>>12; //year
    +    rl=(mmc->cid[3] & 0x00000f00)>>8;  //month
    +   
    +    printf("Manufacturing date    : %d/%d\n", rl,rh+2000);
     
    -    printf("Tran Speed: %d\n", mmc->tran_speed);
    -    printf("Rd Block Len: %d\n", mmc->read_bl_len);
    +    printf("Tran Speed    : %d\n", mmc->tran_speed);
    +    printf("Rd Block Len  : %d\n", mmc->read_bl_len);
     
         printf("%s version %d.%d\n", IS_SD(mmc) ? "SD" : "MMC",
                 (mmc->version >> 4) & 0xf, mmc->version & 0xf);
     
    -    printf("High Capacity: %s\n", mmc->high_capacity ? "Yes" : "No");
    -    printf("Capacity: %lld\n", mmc->capacity);
    +    printf("High Capacity : %s\n", mmc->high_capacity ? "Yes" : "No");
    +    printf("Capacity      : %lld\n", mmc->capacity);
     
    -    printf("Bus Width: %d-bit\n", mmc->bus_width);
    +    printf("Bus Width     : %d-bit\n", mmc->bus_width);
     }
     
     int do_mmcinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])

    --