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!
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.
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?
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.
"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.
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.
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?