Information Technology Reference
In-Depth Information
// Generate clock cycles for 1 millisecond as required by the MultiMediaCard spec.
for (timeout = 0; timeout < 50; timeout++)
mSend8ClkCycles();
// Select the card.
SDC_CS = 0;
Delayms(1);
// Issue the GO_IDLE_STATE command to select SPI mode.
response = SendSDCCmd(GO_IDLE_STATE, 0x0);
if (response.r1._byte == SDC_BAD_RESPONSE)
{
status = sdcCardInitCommFailure;
goto InitError;
}
// A response of 01h means the card is in the idle state and is initializing.
if (response.r1._byte != 0x01)
{
status = sdcCardNotInitFailure;
goto InitError;
}
// Issue the SEND_OP_COND command until the card responds or a timeout.
timeout = 0xFFF;
do
{
response = SendSDCCmd(SEND_OP_COND, 0x0);
timeout--;
} while (response.r1._byte != 0x00 && timeout != 0);
if (timeout == 0)
{
status = sdcCardInitTimeout;
goto InitError;
}
Search WWH ::




Custom Search