Page 1 of 1

SD card in SPI mode

Posted: Sat 2017-04-15 22:08
by YuryShatz
Hi everyone

I have a micro-SD adapter working in SPI mode. Is there a driver for this, or should I forget it and buy proper SD adapters? I want to use it to store small audio-files.

In this thread viewtopic.php?f=13&t=1615&p=9443&hilit= ... mosi#p9443 Panu mentioned that you can do this with SPI driver and SD-SPI driver, but I can't see these drivers anywhere.

Is this worth doing?

Re: SD card in SPI mode

Posted: Sun 2017-04-16 22:48
by Panu

The SDSPI driver was built into the kernel until about version 2.50. I'm not sure if I've ever made it into a loadable DL3 file, but it shouldn't be much more than extracting the devHwSpi.c and devSdSpi.c files from the old kernel and tinkering around a bit. I'll look into it, it's a useful feature. I've used it on several occasions and also together with the devSwSpi.c driver, which allows any GPIO pins to be used as a software (bit-bang) SPI bus. As an example, I soldered a microSD adaptor into the JTAG header one customer brought out on his board so that I was able to easily load and run custom programs on his board from a MicroSD... :lol:


Re: SD card in SPI mode

Posted: Mon 2017-04-17 11:17
by YuryShatz
Thank you, Panu, I understand.

On the other hand, I've just read about SD cards, and it seems to me that I was mistaken. Even though my module is marked with SPI pin names, it should still work in (1-bit) SD mode.

So, according to SD and VS1005 schematics,
- MISO is the same pin as DAT0 (and goes to GPOI2_6)
- MOSI is the same as CMD (goes to GPIO2_10)
- SCLK is CLK (goes to GPIO2_5)
- CS is DAT3 (GPIO2_9)
- I have to load SDSD driver with '1' option
- that's it.

Sorry if this all sounds obvious, but it is not obvious for me...and perhaps for someone else like me.

Re: SD card in SPI mode

Posted: Mon 2017-04-17 16:14
by YuryShatz
However, this does not seem to be working. Driver reports "SD Card not found".

As far as I understand, SD card itself when inserted should be pulling up its CS/DAT3 leg. On my SD module it does not. I guess that after all this module can only be used in SPI mode. It's "SPI micro SD storage module for Arduino" and I guess it has some SPI-specific or Arduino-specific electronics.