SD card in SPI mode

Discussion about writing software for VS1005 and the VSOS Operating System. Also posts about VS1005-related hardware design and device drivers should be posted here.
Post Reply
YuryShatz
Senior User
Posts: 25
Joined: Sat 2016-11-05 19:36

SD card in SPI mode

Post 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?
User avatar
Panu
VSDSP Expert
Posts: 2829
Joined: Tue 2010-06-22 13:43

Re: SD card in SPI mode

Post by Panu »

Hi!

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:

-Panu
YuryShatz
Senior User
Posts: 25
Joined: Sat 2016-11-05 19:36

Re: SD card in SPI mode

Post 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)
- VCC to AVDD, GND to GND
- 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.
YuryShatz
Senior User
Posts: 25
Joined: Sat 2016-11-05 19:36

Re: SD card in SPI mode

Post 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.
Post Reply