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

Thread Starter

aamirali

Joined Feb 2, 2012
412
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?
 

Thread Starter

aamirali

Joined Feb 2, 2012
412
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


Rich (BB code):
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
}
 
Last edited by a moderator:

Thread Starter

aamirali

Joined Feb 2, 2012
412
I have tried that also but even that didn't work.
I now suspect that if sony card support SPI in their card or not. I am attaching image of both card in zip file.

Also I have a memory card reader , in that sony card gets read fine. I think the memory cards works on SDIO interface that's why.
 

Attachments

nsaspook

Joined Aug 27, 2009
13,272
Check the voltage to the card to be sure it's exactly 3.3 volts, some cards are very picky about supply voltages under SPI. SANDISK cards are very robust but others can be picky.
 
Top