Slow SPI needed for old SD Card module

Status
Not open for further replies.

OldGuy1946

New member
Could someone advise/guide me on how to setup a slow SPI clock using the SPI lib on a Teensy LC for <400kBaud rates?

I wish to use a 'slow' SD Card module (from 2004! :/) on a Teensy LC. (I often like trying stuff out of my old scrap collection)

The spec describes: synchronous 8-bit data transmission, MSB first. For initialization <400KBaud. A clock cycle is also required to read in data from the memory cards, possibly by outputting a dummy byte.

Many thanks

Peter
nb. My first post. Thanks for your patience in advance ;)
 
Have you tried using the existing SD library? I'm pretty sure it does initialization at slow speed for compatibility with these sorts of cards.

But if you *really* want to dive into writing your own SD card access code, to answer your original question, you would use SPI.beginTransaction with SPISettings specifying 400000 for the max clock speed. This same approach is used regardless of the clock speed. There is nothing special about configuring slow speeds. You simply use a smaller number of the max speed in SPISettings.
 
Have you tried using the existing SD library? I'm pretty sure it does initialization at slow speed for compatibility with these sorts of cards.

But if you *really* want to dive into writing your own SD card access code, to answer your original question, you would use SPI.beginTransaction with SPISettings specifying 400000 for the max clock speed. This same approach is used regardless of the clock speed. There is nothing special about configuring slow speeds. You simply use a smaller number of the max speed in SPISettings.

I did try using the ReadWrite (Mellis/Igoe) example form the SD library reference page. Always gave "Initialization failed! ".

Used "as is", viz. same I/O pins numbers (matched the LC). I haven't changed/re-set via an SPISettings() call. I need study this, will re-try and report back.

The SD module's manual is uploaded below - sorry - it is in German - but does provide the circuit diagram along with components list.
p.6 describes; the module's 10-way IDC header, JP1 switches its Vcc for 3V3 or 5V. JP1 pins 1 & 2 are linked and I feed module's 3V3 from a external 3V3 reg (TI LM1117-3.3).
Connectivity became
MOSI0 - LC-pin 11 -> SD-pin 7 (DO)
MISO0 - LC-pin 12 -> SD-pin 3 (DI)
SCK0 - LC-pin 13 -> SD-pin 6 (SCLK)
"CS" - LC-pin 4 -> SD-pin 5 (CS)

Many thanks Paul
Peter
 

Attachments

  • EVBMMCSD01_Manual_V10.pdf
    588.3 KB · Views: 72
Bingo! Thank you WMXZ!!
Sorry my setup error!

Swapped over the MOSI0 and MISO0 links to the SD card module and the original SD ReadWrite example ran responding with "Initializing SD card...initialization done."

Many thanks to WMXZ and Paul and to those who kindly applied their thoughts and thus their time.

Peter
 
Status
Not open for further replies.
Back
Top