| |
|
TIPS
AND HINTS FOR SD CARDS IN SPI MODE |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Home |
|
|
- If you're having trouble getting a proper response from the
card, try pulling DAT1 and DAT2 (normally unused) to the card's supply
via resistors.

|
|
|
|
|
| |
| |
| |
| |
| |
| |
| |
| |
|
|
|
- Use the slowest SPI speed for the intialisation process and
then change the SPI speed to a faster speed for reads, writes etc.
|
|
|
|
|
| |
|
|
|
- I was using a Freescale 9S08GB60. My SPI settings were: SPI
enabled and master set for SPI1C1. SPI1C2 register was kept clear.
|
|
|
|
|
| |
|
|
|
If you are bit bashing
your own SPI -
- MSB (most significant bit - bit 7) gets clocked out first.
- Clock and data is non inverted. A data bit of 1in your firmware goes
out to the pin of the SD as the high voltage (3.3v or whatever you have
it set to)
- Set a data bit to its required state
- Set clock high
- Wait a tiny bit
- Read an incoming bit. The first incoming bit is MSB of incoming
byte.
- Set Clock low
- Wait a little bity
- Go around again until 8 bits of the byte are done.
|
|
|
|
|
| |
|
|
|
- Chip Enable (chip select/card enable/card select -whatever you want
to call it) should be used. I'm not sure that you can get away with
leaving it high.
|
|
|
|
|
| |
|
|
|
- Part of the initialisation process is sending a bunch of clocks
with Chip Enable inactive. The product manual recommends 74 clocks.
80 makes more sense for SPI sending 8 bit bytes so send 10 bytes of
$FF (hex) out the SPI.
|
|
|
|
|
| |
|
|
|
- I use four commands to initialise. Technically i think you only
need three of them but the fourth is useful anyway. They are CMD0, CMD55,
ACMD41, CMD58.
|
|
|
|
|
| |
|
|
|
- CMD0 tells the card to go into an IDLE STATE
|
|
|
|
|
| |
|
|
|
- CMD55 is to indicate that an APPLICATION SPECIFIC command will follow
|
|
|
|
|
| |
|
|
|
- ACMD41 is listed as the SEND OPERATING CONDITIONS command. The argument
for this command can be blank however. If the resonse from this command
is OK then you should be able to do all other SPI commands.
|
|
|
|
|
| |
|
|
|
- CMD58, the fourth command is the READ OPERATING CONDITIONS command.
Here you can check if the voltage you are supplying is within the range
the card will accept.
|
|
|
|
|
| |
|
|
|
- CMD0 should come first. CMD55 and ACMD41 are a command pair. ACMD41
is the actual command. CMD55 just has to preceed it. If you dont get
the correct reply and you want to retry the command, CMD55 has to preceed
ACMD41 for the retry again. After you get the correct response from
ACMD41 you can do the CMD58 if you want to.
|
|
|
|
|
| |
|
|
|
|
|
|
|
|
| |
|
|
|
- SOME REALLY USEFUL LINKS RIPPED FROM WIKIPEDIA:
|
|
|
|
|
| |
|
|
|
- OTHER RESOURCES ON THIS SITE:
|
|
|
|
|
| |
|
|
|
|
|
|
|
| |
|
|
|
|
|
|
|
| |
|
|
|
|
|
|
|