2

I'm using FTDI C232HM USB->SPI cable using Windows10

The issue is: once I send CMD41 to SanDisk 4GB microSD card, it replay with "1" then doesn't replay to any other command

the init commands are the

  1. Set CS pin HIGH (deselects the slave)
  2. Toggle clock 80 times
  3. Set CS pin LOW (selects the slave)
  4. Send CMD0: 0x40,0x00,0x00,0x00,0x00,0x95 (response: 0x01)
  5. Send CMD8: 0x48,0x00,0x00,0x01,0xAA,0x87 (response is 0x01; 0x000001AA)
  6. Send CMD55: 0x77,0x00,0x00,0x00,0x00,0x00 (response: 0x01)
  7. Send ACMD41:0x69,0x40,0x00,0x00,0x00,0x00 (response: 0x01)
  8. Send CMD55: 0x77,0x00,0x00,0x00,0x00,0x00 (response: 0xFF) loop forever

Any ideas ?

Thanks, Roy

Added DUMMY 0XFF before any Send SPI command
Added DUMMY 0XFF + 0xFF before any Send SPI command

SD_PowerOn();
Sleep(100);
SD_SendCmd(CMD0, 0);

if (SD_SendCmd(CMD0, 0) == 1) 
{ 
    Timer1 = 100;

    if (SD_SendCmd(CMD8, 0x1AA) == 1) 
    { 
        do {
            if (SD_SendCmd(CMD55, 0) <= 1)
            {
                n = SD_SendCmd(CMD41, 1UL << 30);
                if(n == 0)
                    break; /* ACMD41 with HCS bit */
             }
         } while (Timer1--);

         if (Timer1 && SD_SendCmd(CMD58, 0) == 0) 
         { 
             for (n = 0; n < 4; n++)
             {
                 ocr[n] = SPI_RxByte();
             }
             type = (ocr[0] & 0x40) ? 6 : 2;
         }
    }
barbsan
  • 3,418
  • 11
  • 21
  • 28
Roy
  • 21
  • 1

0 Answers0