Share SD card between Arduino and PC

Hi,

I have some .wav files stored on a SD card and played back by the Arduino with WaveShield.
These files are created by a PC. Does anybody know how it is possible to access the card from both devices (PC and Arduino)? Is it even possible?
I tried to use a serial connection to transfer the files, but I just can't get it working fast enough. I get transfer times of several minutes for a few KBs.
Maybe someone has an idea? Thanks in advance!

frsc

Do you need simultaneous access from both? Would a physical switch be acceptable?

daveg360:
Do you need simultaneous access from both? Would a physical switch be acceptable?

I would be interested in the switch idea if you could explain how to do it.

Simultaneous access would be great but I guess that's not possible.
I thought about a physical switch too (relais) but I had hope that there's an easier solution.
I'm currently trying to use the SD card on the WaveShield to be read by a usb card reader via a homebrew adaptor cable, but I did not get it working by now. I guess the connection from the Arduino SPI to the SD slot interferes with the connection to the card reader, even when the Arduino is powered down.

By the way: Maybe someone has a totally different approach for my problem. I'm generating audio files on a pc. They need to be played back immediatly on button press (no time to power up the pc, 24h operation of the pc not acceptable). Arduino would be no problem with the WaveShield, but how to access the files?

I guess you would have to have a dip switch in the circuit. It would have to be a 2 pole 4 throw... 4 channels with 2 positions is what I am trying to say.

Mark

Why 4 channels? What are the 4 signals you would switch? I've got 9 pins in total on the card.

It might be 5 signals but, here is my guesses.

DO : Serial Data Out
CLK : Serial Clock
VCC : 3.3V Power/or 5v which ever applies.
DI : Serial Data In
CS : Chip Select

The others being Card Detect, Write Protect, and 2 Gnds typically.

I am trying to think of the minimum amount of pins that would have to be isolated from the Arduino or the computer in order to make a read or write to the card. I am not certain what that minimum would be.

Then, the next issue would be what chip or part would be required to read it from the PC while leaving the card in the Arduino socket.

Using a Sparkfun SD breakout board BOB-00204 for pin info. here is the pins they list.

COM : Common - Connects to the housing
WP : Write Protect Detect Switch
CD : Card Detect Switch
P9 : Not used in SPI Mode (Pin 9 on SD Card)
IRQ : Not used in SPI mode (Pin 8 on SD Card)
DO : Serial Data Out
GND : Ground - Connect this to COM to ground the housing
CLK : Serial Clock
VCC : 3.3V Power
DI : Serial Data In
CS : Chip Select

Be aware that when the PC accesses the card it uses the fast native SD access method, not SPI. Arduino can only do SPI mode. In native mode the clock rate is much higher (25MHz or 50MHz) and data is transfered synchronously in 4-bit chunks.

I can't believe you will be able to avoid signal integrity issues trying to run those lines from a shield or similar into the contacts on a PC somehow.

If you a PC with a card socket, why aren't you just moving the card back & forth?

I was was think of something like a MAX4999 to control what is connected.

CrossRoads:
I can't believe you will be able to avoid signal integrity issues trying to run those lines from a shield or similar into the contacts on a PC somehow.

If you a PC with a card socket, why aren't you just moving the card back & forth?

For my own use, I have no problem moving the card back and forth as that would be far more simple. However, I if I were to make a device for the general public, I would prefer to send the information from the Arduino SD card through USB in the most simple way as possible.

daveg360:
I was was think of something like a MAX4999 to control what is connected.

That chip is for 8 USB channels to share 1 USB device. I don't know if it could be made to work but, here is another chip with just 2 USB channels and it is cheaper. Mixed-signal and digital signal processing ICs | Analog Devices

"I would prefer to send the information from the Arduino SD card through USB in the most simple way as possible."

The Arduino can only do one thing at a time - read the card via SPI, or do a UART xfer to the PC.
The Arduino can read ~250-280Kbyte/second doing large blocks (512 bytes?)
Then you lose time writing that to the UART registers, so the speed to the PC will slower.

The problem is that the switching has to be automated in my case.
The PC generates files and sends the arduino a message via serial that it has finished.
Arduino then switches the SD card for the PC to write the files to it and switches back after it has finished.
The files are then available for the Arduino to read.

Ok, so what you need is to have a USB to SD card adapter coming from the PC, and the 5v/3.3V SD card adapter coming from the arduino, with the control signals switched.
I would get a USB to SD card adapter like this
http://www.amazon.com/Datafab-KESD-USBA-Reader-Extension-Cable/dp/B002ZVE4HC

open the case, and wire from that connector to a buffer chip that does 3.3V signals, and wire the OE/ signal so its under Arduino control.

Then wire the Arduino SPI lines thru a 5V to 3.3V level converter like this, and wire the OE/ signal so its under Arduino control.
I have used 74AC125D, not the HC that is shown here, this is just what I happened to find first.

Thank you CrossRoads for the help. It took me a few minutes to get your idea and to understand the schematic but now I got how it works.
I'll look for a buffer chip and have a try.

Great idea CrossRoads! I had thought of using a USB to SD card adapter but, I had no idea how it could be used. I already have an USB adapter at home so, I will definitely take a look at it and see if can use your idea.

Way to go!

Hi CrossRoads...

before anything, thanks for the nice idea!! exactly what I'm looking for too!!

I tried to do your circuit with a SN74HC244 to simplify it even more, trying to get everything into just one chip, but for some reason I can't get it to work.

As my electronics background is not that great I can't figure this one out... so maybe you could shine some light on it for me?

SN74HC244 datasheet: http://www.ti.com/lit/ds/symlink/sn74hc244.pdf

It's weird because the SN74HC244 is exactly what the circuit needs... 2 sets of 4 bit gates!

any help would be greatly appreciated... I really wan't to understand and learn!! :slight_smile:

cheers...
-H