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.

Interacing Micro SD with OMAP l138

HI Everyone

 

I am using OMAP L138 on my custom board and using it to access micro sd.I am using CCSv4 to test the micro SD access by using their provided CCS project. I am able to get the RCA from the card but after that read and write fails to the micro sd. I am a new to all these and am still taking time to understand the micro sd protocol. Any help regarding this will be appreciated. As per my understanding since I am able to read CSD and CID properly and get RCA thus my hardware is fine. I think i am not giving the proper command to read or write. In the code they are issuing COM_17 for single block read. Any suggestion on how to debug?

 

Regards

Ayusman

 

  • Hi,

    ayusman mohanty said:

    I am using OMAP L138 on my custom board and using it to access micro sd.I am using CCSv4 to test the micro SD access by using their provided CCS project. I am able to get the RCA from the card but after that read and write fails to the micro sd. I am a new to all these and am still taking time to understand the micro sd protocol. Any help regarding this will be appreciated. As per my understanding since I am able to read CSD and CID properly and get RCA thus my hardware is fine. I think i am not giving the proper command to read or write. In the code they are issuing COM_17 for single block read. Any suggestion on how to debug?

     Regards

    Ayusman

     

    Can you verify whether command to select the card (CMD7) is sent to card after getting CSD from card.

     

    regards

    Gururaja

  • Gururaja

     

    It does give CMD7 after reading the CID information.I have pasted the code below

    uint32_t MMCSD_identifyCard(mmcsd_regs_t *mmcsd, uint32_t *rca, uint32_t in_bus_width)
    {
       uint32_t rtn;
       uint16_t card_reg[8];

       // put cards in idle state.
       rtn = sendCmd(mmcsd, DCLR | MMCSD_CMD_GO_IDLE, 0, 1);
       if (rtn != ERR_NO_ERROR)
          return (rtn);
      
       // add short delay and send voltage range.
       USTIMER_delay(100000);
       sendCmd(mmcsd, MMCSD_CMD_APP, 0, 1);
      
       // TODO: add mmc identify card.
       rtn = sendCmdOpCondSD(mmcsd, 0x00ff8000, MMCSD_OP_TIMEOUT);
      
       // request all the cid info.
       rtn = sendCmd(mmcsd, MMCSD_CMD_ALL_SEND_CID, 0, 1);
       getCardResp(mmcsd, card_reg);

       // ask for suggested relative address.
       rtn = sendRcaSD(mmcsd, rca);
       if (rtn != ERR_NO_ERROR)
          return (rtn);

       // select the card using the selected rca.
       rtn = sendCmd(mmcsd, MMCSD_CMD_SELECT_CARD, *rca, 1);
       if (rtn != ERR_NO_ERROR)
          return (rtn);
      
       // set bus width to 4-bit mode.
       rtn = setBusWidth(mmcsd, *rca, in_bus_width);
       if (rtn != ERR_NO_ERROR)
          return (rtn);

       // config the desired block length.
       rtn = sendCmd(mmcsd, MMCSD_CMD_SET_BLK_LEN, MMCSD_DEFAULT_BLKLEN, 0);
      
       return (rtn);
    }

     

    Can you tell me whether this is the correct procedure for initialization?

     

    Regards

    Ayusman

  • Hi,

    The above code is for SD Card Version 1 Type.

    The micro sd card must be of SD Card version 1.1 and above. hence it reuires a different initialization sequence

    Follow below doc for reference

    http://www.sdcard.org/developers/tech/sdcard/pls/Simplified_Physical_Layer_Spec.pdf  --> page 16 (27)

    Hope this helps.

    Regards

    Gururaja