Author Topic: clocking SPI for SD cards  (Read 693 times)

0 Members and 1 Guest are viewing this topic.

Offline Dan MoosTopic starter

  • Frequent Contributor
  • **
  • Posts: 357
  • Country: us
clocking SPI for SD cards
« on: August 09, 2020, 01:37:00 am »
A lot of the tutorials on using SPI to talk to SD cards seem to show code that sends a 8 or so "reads" to the device before writing data.

Almost always anyway. I have gotten the beginnings of an explanation here and there, but nothing really descriptive.

The best I can gather is that you need to do some fake reads just to get the device a look at the clock so it can be ready when the writes come in.

First, is that about right?

Second, should I precede EVERY write operation with some of these pretend reads?

Third, 8 reads seems  common. Is that a good rule of thumb?

Finally, if I'm completely wrong about the whole thing, care to set me straight?

 

Online fchk

  • Regular Contributor
  • *
  • Posts: 245
  • Country: de
Re: clocking SPI for SD cards
« Reply #1 on: August 09, 2020, 03:41:20 pm »
Just get the official standard document and look it up for yourself:

https://www.sdcard.org/downloads/pls/

You will need the first document "Physical Layer Simplified Specification", and SPI mode is described in section 7.

fchk
 

Offline Dan MoosTopic starter

  • Frequent Contributor
  • **
  • Posts: 357
  • Country: us
Re: clocking SPI for SD cards
« Reply #2 on: August 09, 2020, 04:14:11 pm »
Already have, and have been reading said doc. Maybe it's in there, but I can't find it. I thought maybe it was an SPI thing rather than just an SD card specific thing, but who knows.

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf