Information Technology Reference
In-Depth Information
if (index == 0)
// The write timed out.
status = sdcCardTimeout;
}
// The write was successful.
// Generate 8 clock cycles to complete the command.
mSend8ClkCycles();
}
// Deselect the card.
SDC_CS = 1;
return(status);
}
Initializing Communications
Before accessing a card's media. the card's host must initialize communica-
tions by sending a sequence of commands. Initializing a card consists of the
following actions by the host:
1. Configure the SPI port with a clock frequency of 400 kHz or less.
2. Enable the SPI port.
3. With CS high and DataIn high, generate clock cycles for the maxi-
mum of the power-supply ramp-up time, 1 millisecond, or 74 clock
cycles. With a 400-kHz clock, 1 millisecond requires 400 clock cycles.
The power-supply ramp-up time is the time required for the supply to
rise from the minimum valid supply voltage to the supply voltage the
card will use.
4. Issue the GO_IDLE_STATE command to select SPI mode.
5. Issue the SEND_OP_COND command repeatedly until the card
responds or a timeout.
6. Issue the SEND_CSD command to read the CSD register.
Search WWH ::




Custom Search