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.

SD example by Spectrum Digital

Hi,

 

I am studing/understanding the SD example supplied by Spectrum Digital, but when I run the example the console shows infinitely the bellow messages.

EXBUSSEL = 100

01  Testing SD card...

 

I debugged using Step Into and Step Over and observe that the problem starts when the MMCSD_initCard function calls MMCSD_cardIdentification function which a part of code is bellow.

 

349       /* Send the operating Voltage Range */

350       RESEND_CMD41:

351

352       /* Introduce a delay for slow cards */

353       USBSTK5515_waitusec( 100000 );

354

355       status = MMCSD_appCmd( 0 );     /* Send CMD55 with RCA = 0 */

356

357       if ( status )

358       status = MMC_sendOpCond( MMCSD_VDD_32_34, opTimeout );

359       else

360       {

361                  // Experimenting with the whole supported voltage range

362                  if ( SD_sendOpCond( 0x00ff8000, opTimeout ) )

363                  goto RESEND_CMD41;

364                  mmc = 0;

365       }

366       mmc = 0;

 

In line 355 status is zero, so program go to line 362. In the SD_sendOpCond function (code bellow) during the decrement of opTimeOut the first "if" is not satisfied because MMCSD_sendCmd function does not receive the correct response of SD card. The second "if" is not satisfied too and in the third "if" the MMCSD_appCmd function calls MMCSD_sendCmd but it return is zero, so the SD_sendOpCond function return E_DEVICE and the program goto RESEND_CMD41 according line 363 above, and it happens infinitely.

for ( ; opTimeOut > 0 ; opTimeOut-- )

    {

        /* Format and send cmd: Volt. window is usually 0x00300000( 3.4-3.2v )*/

        if ( status = MMCSD_sendCmd( SD_APP_OP_COND, voltageWindow,1, MMCSD_STAT0_RSPDNE ) )

            return status;

 

        if ( MMCSD_MMCRSP7 & 0x8000 )

            return 0;

 

        /* Send CMD55 with RCA = 0 for the next iteration */

        if ( status = MMCSD_appCmd( 0 ) )

            return status;

   }

 return E_DEVICE;

 

I am using c5515 eZdsp and CCS4 version 4.1.2.

Please, could anybody help me understand what is happening?

 

Regards,

 

 

Andrea

 

  • Andrea,



    The SD card follows a very strict initialization sequence. You can find more information from their website http://www.sdcard.org. In summary, on first power-up the card is in idle state. To move from idle state, a sequence of commands are issued.

     - CMD0: forces a card into idle state

     - CMD8: send information command. If a response is received, this is a version 2.0 card. The response indicates the voltage range supported by the card.

     - ACMD41: Application command that queries operational conditions. The response indicates if this is a standard capacity card or a high capacity card., what voltages it supports and its operating conditions.



    Application commands are sent by two commands: CMD55 followed by the application command number. Thus ACMD41 is basically the sequence of CMD55 followed by CMD41.



    Thus, line 355 is just sending CMD55. Line 358 sends CMD41. Seems the code is failing on CMD55. For this to happen, there is no SD card (MMC card or socket empty) or the SD card is damaged. Try reformatting the card to make sure it is properly formatted.



    Hope this gives you some more insight.

  • Dear Sr. Pedro Gelabert, thank you for attention.

     

    I would like to inform that the SD is working with other CSL examples and I formatted many times using SD Formatter 2.0.

     

    Please, could you give any idea about what is happing? Have you ever seen it?

     

    Thank you very much!

     

    Andrea

  • Hello,

    I'm working on the same problem using a brandnew SanDisk 8GB (Class 2)  microSDHC Card.

    This card works OK when plugged into my Win PC.

    The SD example works fine, when I'm using a Panasonic 2GB (Class 4) microSD card (no HC!).

    It seems that CMD55/41  does not work with HC cards, I try to use the CMD5 command.

    Greetings from Germany

    Holger