Ответы нужно искать на Figure 7-2: SPI Mode Initialization Flow документа Physical Layer Simplified Specification Version 3.01 - там CMD1 нет.
Если память мне не изменяет то CMD1 актуальна для MMC.
Я инициализирую карточки так (правда, uSD, т.е. >=ver2.00):
CODE
//-----------------------------------------------------------------------------
// BYTE sd_init(void)
//-----------------------------------------------------------------------------
BYTE sd_init(void)
{
volatile int i;
BYTE response = 0xFF;
DWORD data;
sCSD_V1 *csd_v1;
sCSD_V2 *csd_v2;
sd_size_mb = 0;
// POWER OFF
SD_PWR_bit = 1;
delay_sd_tim(100);
SD_PWR_bit = 0;
delay_sd_tim(200);
SD_CS_bit = 1;
sd_set_mode(SD_MODE_INIT);
delay_sd_tim(10);
for(i = 0; i < 74; i++) sd_send_byte(0xFF);
delay_sd_tim(1);
SD_CS_bit = 0;
sd_send_cmd(CMD0_GO_IDLE_STATE, 0, 0x95);
response = sd_get_response();
SD_CS_bit = 1;
sd_send_byte(0xFF);
#ifdef SD_DEBUG_INIT
con_str("r_CMD0=");
con_byte(response);
con_str("\n\r");
con_start();
#endif
if(response == SD_RESP_IDLE)
{
i = 0;
#ifdef SD_DEBUG_INIT
con_str("Send CMD8\n\r");
con_start();
#endif // SD_DEBUG_INIT
SD_CS_bit = 0;
sd_send_cmd(CMD8_SEND_IF_COND, CARD_COND, 0x86);
response = sd_get_response();
data = sd_get_dword();
SD_CS_bit = 1;
sd_send_byte(0xFF);
#ifdef SD_DEBUG_INIT
con_str("r_CMD8=");
con_byte(response);
con_str(" - ");
con_dword(data);
con_str("\n\r");
con_start();
#endif // SD_DEBUG_INIT
if(response == SD_RESP_IDLE)
{
sd_type = SD_TYPE_V2;
#ifdef SD_DEBUG_INIT
con_str("SD ver2.00 or later.\n\r");
con_start();
#endif // SD_DEBUG_INIT
if(data != CARD_COND) return SD_INIT_ERROR;
#ifdef SD_DEBUG_INIT
con_str("Valid voltage range\n\r");
con_str("Send ACMD41\n\r");
con_start();
#endif // SD_DEBUG_INIT
do
{
SD_CS_bit = 0;
con_str("cmd55->");
con_start();
sd_send_cmd(CMD55_APP_CMD, 0, 0xFF);
response = sd_get_response();
SD_CS_bit = 1;
sd_send_byte(0xFF);
if(response == SD_RESP_IDLE)
{
SD_CS_bit = 0;
con_str("acmd41->");
con_start();
sd_send_cmd(CMD41_SEND_APP_OP_COND, SDIO_CARD_CCS | OCR_INDEX, 0xFF);
response = sd_get_response();
SD_CS_bit = 1;
sd_send_byte(0xFF);
}
else response = SD_RESP_IDLE;
while(con.tx_t != con.tx_b);
} while(response == SD_RESP_IDLE);
#ifdef SD_DEBUG_INIT
con_str("Card ready\n\r");
con_str("Send CMD58\n\r");
con_start();
#endif // SD_DEBUG_INIT
SD_CS_bit = 0;
sd_send_cmd(CMD58_READ_OCR, 0, 0xFF);
response = sd_get_response();
data = sd_get_dword();
SD_CS_bit = 1;
sd_send_byte(0xFF);
#ifdef SD_DEBUG_INIT
con_str("r_CMD58=");
con_byte(response);
con_str(" - ");
con_dword(data);
con_str("\n\r");
con_start();
#endif // SD_DEBUG_INIT
if(data & SDIO_CARD_CCS)
{
#ifdef SD_DEBUG_INIT
con_str("CCS = 1\n\r");
con_start();
#endif // SD_DEBUG_INIT
sd_type = SD_TYPE_SDHC;
}
else
{
#ifdef SD_DEBUG_INIT
con_str("CCS = 0\n\r");
con_start();
#endif // SD_DEBUG_INIT
sd_type = SD_TYPE_NORMAL;
}
}
else
{
sd_type = SD_TYPE_UNDEF;
return SD_INIT_ERROR;
}
while(response != SD_RESP_SUCCESS)
{
SD_CS_bit = 0;
sd_send_cmd(CMD1_SEND_OP_COND, 0, 0xFF);
response = sd_get_response();
SD_CS_bit = 1;
sd_send_byte(0xFF);
i++;
if(i == 0x100000)
{
#ifdef SD_DEBUG_INIT
con_str("r_CMD1=");
con_byte(response);
con_str(", i=");
con_dword(i);
con_str("\n\r");
con_start();
#endif
return SD_TIMEOUT_ERROR;
}
}
#ifdef SD_DEBUG_INIT
con_str("r_CMD1=");
con_byte(response);
con_str(", i=");
con_dword(i);
con_str("\n\r");
con_start();
#endif
}
else
{
#ifdef SD_DEBUG_INIT
con_str("INIT_ERROR\n\rr_CMD0=");
con_byte(response);
con_str("\n\r");
con_start();
#endif
return SD_INIT_ERROR;
}
// CMD9 Read CSD
con_str("CMD9\n\r");
con_start();
SD_CS_bit = 0;
sd_send_cmd(CMD9_SEND_CSD, 0, 0xFF);
response = sd_get_response();
if(response == SD_RESP_SUCCESS)
{
response = sd_get_xx_response(SD_START_DATA_BLOCK_TOKEN);
for(i = 0; i < 16; i++) sd_buf[15 - i] = sd_send_byte(0xFF);
SD_CS_bit = 1;
sd_send_byte(0xFF);
csd_v1 = (sCSD_V1 *)sd_buf;
con_str("[CSD SOURCE: ");
for(i = 0; i < 16; i++) con_byte(((BYTE *)sd_buf)[i]);
con_str("]\n\r");
con_start();
if(csd_v1->csd_structure == 0)
{
sd_size_mb = ((csd_v1->c_size + 1) * (1 << csd_v1->read_bl_len) * (1 << (csd_v1->c_size_mult + 2))) >> 20;
con_str("\n\n\rTotal Size: ");
con_dec(sd_size_mb);
con_str(" MB\n\n\r");
con_start();
}
else if(csd_v1->csd_structure == 1)
{
csd_v2 = (sCSD_V2 *)sd_buf;
sd_size_mb = (csd_v2->c_size + 1) >> 1;
con_str("\n\n\rTotal Size: ");
con_dec(sd_size_mb);
con_str(" MB\n\n\r");
con_start();
}
}
else
{
SD_CS_bit = 1;
sd_send_byte(0xFF);
}
sd_set_mode(SD_MODE_DATA);
sd_send_byte(0xff);
sd_send_byte(0xff);
return sd_set_block_length(512);
}
Устойчиво работают карты разных производителей, объемом 2Gb, 4GB, 8Gb, 16GB и 32GB.