Because of the holidays, TI E2E™ design support forum responses will be delayed from Dec. 25 through Jan. 2. Thank you for your patience.

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.

SDHC code with SPI works on kingston card but not on Sony card

I have made SDHC interface code with SPI for kingston card, C4 4gb card. It works fine, card gets initialized properly & I can read write without any problem.

But same code doesn't work for Sony C4,4Gb card. Card don't get initialized. I have tried many times. Card doesn't get initialized. When I send first command to CMD_GO_IDLE_STATE, it returns nack.  

I don't understand what is the problem. I can attach code if someone want to check my code. Or its hardware related problem?. Hardware is simple, card is connected via SPI port & CS pin is GPIO. 

Kingston card work fine on same card but not Sony card?

  • Check your timeouts, or, more to the point, experiment with them.

    I've seen different cards (manufacturers) take vastly different amounts of time to do some of the initialization sequences. SDHCs also generally seem to take longer than smaller SDs.

  • I have checked it, problem occurs in below highlighted part of code.

    I have commented the part where I got wrong response from sony card while sandisk card send correct response

    Error at that point means there card caanot go into idle state, & also response returned i.e R1 is 0xC0. But according to card spcs, MSB should be zero of R1, but here I got 1 MSB.

    Also Bit 6 represent parameter error in R1. Why it is occuring in sony card

    static uint8_t SD_init(void)
    {
      uint16_t count;
      uint8_t response;
        
      delay_us(1000000);   /*  1 sec delay */
    
      SD_CS_DISABLE();   
      SD_INIT_SETTING(KHZ234);               /* initialize with 234Khz */
      SD_CS_DISABLE();                       /* disable chip select */
    	
      for(count=10;count>0;count--)          /* send 80 bit long cycle to establish link with SD card */
      {  
        unsigned_sd_spi_byte(0xff);        /* fulfills minimum 74 clocl cycle requirement */
      }
    	
      SD_CS_ENABLE();                        /* enable card */
     
      count = 0xfffe;                    
      do 
      {
        response = SD_Command( CMD0_GO_IDLE_STATE, 0,0x95 ); 
      } while((response != 0x01) && (--count));
    
                                                 /* here response send from sony card is 0xc0  */
      if( !count )
        return( SDHC_ERR_TIMEOUT);
    
    
      *****other part of initializing sdhc code
    }
  • Aamir Ali said:
    sponse returned i.e R1 is 0xC0. But according to card spcs, MSB should be zero of R1, but here I got 1 MSB.

    Are you sure the card supports the serial interface at all? Some SDHC cards don't. After all, speed is limited and capacity is high, so some manufacturers considered the serial mode obsolete.

    My own MMC/SD card code de-asserts CS when getting a non-0x01 response on the GO_IDLE_STATE command, and retries on next timer interrupt. (it runs in interrupt, so cards can be inserted and removed any time)
    Maybe the card needs more time to fire up.
    Retrying of course doesn't help if the serial mode isn't supported at all :)

  • Hi Ali,

    I am working on the SDHC interface as well, and only able to find AppNote for SD/MMC interface. I believe that you have been working on this for a while and there are quite a few active discussions on this by you. Do you think if it is possible to share some codes for working with SDHC with MSP430?

    Appreciate!

  • Try a different SPI mode for communication, it worked for me .  

  • I used the TI appnote just as base for own development. Once I got it working with a plain vanilla MMC card, I improved/changed the code to support mode.
    IIRC, there is no full-featured SDHC code available yet.
    My own code belongs to my employer, so I cannot give it away, sorry.

**Attention** This is a public forum