CS на карточке должен быть активным при пересылке всех байт команды, без "дерганий" между байтами.
У меня так работает и с MMC и с SD
if (send_cmd(CMD0, 0) != 1) unsucc();
while (send_cmd(CMD1, 0) !=0 );
while (send_cmd(CMD16,512) !=0);
Вот собственно функция отсылки:
//-----------------------------------------------------------------------------
/* Send a command packet to MMC */
/* Command byte */
/* Argument */
static BYTE send_cmd ( BYTE cmd, DWORD arg )
{
volatile BYTE n, res;
LastCmd=cmd;
DESELECT();
rcvr_spi();
SELECT();
if (wait_ready() != 0xFF) return 0xFF;
/* Send command packet */
n=xmit_spi(cmd); /* Command */
n=xmit_spi((BYTE)(arg >> 24)); /* Argument[31..24] */
n=xmit_spi((BYTE)(arg >> 16)); /* Argument[23..16] */
n=xmit_spi((BYTE)(arg >> 8)); /* Argument[15..8] */
n=xmit_spi((BYTE)arg); /* Argument[7..0] */
xmit_spi(0x95); // CRC (valid for only CMD0)
/* Receive command response */
if (cmd == CMD12) rcvr_spi(); /* Skip a stuff byte when stop reading */
n = 25; /* Wait for a valid response in timeout of 10 attempts */
do
res = rcvr_spi();
while ((res & 0x80) && --n);
return res; /* Return with the response value */
}