Go Down

Topic: replace SD card with USB stick (Read 2157 times) previous topic - next topic

jensvanhoof

Hi all,

I've got a (probably advanced) question, where two collegues of mine argue whether it's doable or not.. :-)
I recently bought this board from sparkfun: www.sparkfun.com/products/12000

What this does is basically reading .wav files from a microSD card and play them. Fair enough, this works great.

What I'd like to do in my project, is replace the microSD card with a USB stick, OR being able to connect that same microSD card to a PC to put new files on it (without having to physically remove the card from the player). Basically I'm looking for a user-friendly way to put files on the card without having to use cardreaders etc. I figured that moving a simple USB stick back and forward is common practice these days. Not so for a microSD card. (at least, not for everyone.)

After reading this thread: http://forum.arduino.cc/index.php?topic=203731.0
I purchased a few VUB300 chips as suggested. I soldered one to a breakout board and am now able to test it. I thought this chip would do the trick, but a colleague of mine very much doubts that. He claims that 'fooling the board into thinking that it's reading from a SD card, while it's actually a USB flash drive', is actually the inverse of what the chip is designed to do.

This might be possible, but then I would think I could do my second suggestion: connect the entire thing through the VUB300 to my PC and access it from there without moving a USB stick. But I'm guessing that would give problems because the SD memory would potentially be accessed by the PC AND the board together..

I'm a bit stuck. Any suggestions are greatly appreciated!

Thanks!
Jens

tsunamy_boy

I had a similar issue, i also bought one of those USB converters but it didn't work out.
So my solution was to create an application that works along with the COM port, then i can upload and download the files that i'm saving on the SD card

CrossRoads

I think you just need to mux the IO signals to the SD card. See Page 11 of the datasheet. Insert some hardware between the VUB300 and the SD socket, and between the '328P SPI/SS signals and the SD socket, and decide which set of signals get control of the SD card.
74HC125 would do it - need 2 for the VUB300 since it access the card with 4-bit interface. Need 1 for the SPI interface (SCK, MISO, MOSI, SS) since it uses serial interface.
Then just need a means to decide who gets control.
Maybe have '328 monitor the CLK pin, allow the switch over only when it does not see activity.

328 can't drive USB stick without a host shield, something with MAX3241E on it. Sparkfun makes such a shield. I designed one into a card, I didn't do the software behind it, don't know how it turned out.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

jensvanhoof

Quote
I think you just need to mux the IO signals to the SD card. See Page 11 of the datasheet. Insert some hardware between the VUB300 and the SD socket, and between the '328P SPI/SS signals and the SD socket, and decide which set of signals get control of the SD card.
74HC125 would do it - need 2 for the VUB300 since it access the card with 4-bit interface. Need 1 for the SPI interface (SCK, MISO, MOSI, SS) since it uses serial interface.
Then just need a means to decide who gets control.
Maybe have '328 monitor the CLK pin, allow the switch over only when it does not see activity.

328 can't drive USB stick without a host shield, something with MAX3241E on it. Sparkfun makes such a shield. I designed one into a card, I didn't do the software behind it, don't know how it turned out.


:) Ehm... I'm not following entirely. I'm lacking some basic knowledge I guess. With the 328P, do you mean the atmega328?

fungus


What I'd like to do in my project, is replace the microSD card with a USB stick


Very difficult. The SD card has a very simple SPI interface, USB is complicated.


What I'd like to do in my project, is replace the microSD card with a USB stick, OR being able to connect that same microSD card to a PC to put new files on it (without having to physically remove the card from the player).


Why can you physically remove the USB stick but not the SD card? That's not fair!

With a cheap adapter the SD card can be plugged into any PC just like a USB stick.
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

CrossRoads

#5
Mar 12, 2014, 06:10 pm Last Edit: Mar 12, 2014, 06:16 pm by CrossRoads Reason: 1
Yes.
Altho, never mind. I thought you were trying to control between Arduino and PC, which one was to access the SD card. That sparkfun card is not arduino at all, it just has inputs that coud be arduino controlled to select a track.

I think you could use my concept tho, pull the SD/uSD signals off the card, and mux between the PC accessing the SD/uSD card, and the sparkfun board accessing the card. Put a toggle switch on and manually select who gets the card.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

jensvanhoof

Quote
Very difficult. The SD card has a very simple SPI interface, USB is complicated.


Well, in Sparkfun's product, the SD card doesn't use the SPI interface. It uses a SDIO interface instead, as SPI wouldn't be fast enough.

Quote
Why can you physically remove the USB stick but not the SD card? That's not fair!


I know about the adapters, but it seems more accessible to people with less technical skills if there's an actual USB stick to be swapped. It would be more elegant, too.

jensvanhoof

Quote
That sparkfun card is not arduino at all, it just has inputs that coud be arduino controlled to select a track.


I realized indeed that I might not have asked my question at the right forum. As you say, my AVR is only used to control the sparkfun board, while my question is not in that.  :)

Quote
I think you could use my concept tho, pull the SD/uSD signals off the card, and mux between the PC accessing the SD/uSD card, and the sparkfun board accessing the card. Put a toggle switch on and manually select who gets the card.


That seems like a reasonable approach. I'm not sure about how the multiplexing should work. (Never done it before) Could you point me to a tutorial or anything that would be applicable? I'd like to readup on that.

Regarding the toggle switch, what dataline do you have to switch then? Or are there multiple contacts that need to be toggled?

fungus


Quote
Very difficult. The SD card has a very simple SPI interface, USB is complicated.


Well, in Sparkfun's product, the SD card doesn't use the SPI interface. It uses a SDIO interface instead, as SPI wouldn't be fast enough.


OK, but the point stands: SD cards have very simple interfaces, USB sticks do not.

The two things aren't interchangeable just because they both store data and they both use flash memory.

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

jensvanhoof

Quote
The two things aren't interchangeable just because they both store data and they both use flash memory.


I thought the VUB300 was designed to do just that, but it seems it's more complicated than that :)

CrossRoads

The muxing is simple. The 74HC125 has 4 gates, each has an output enable line.
So have a simple switch that either enables one set of gates, or the other, by connecting the enable pins to Gnd. The ones not connected just get pulled high with a pullup resistor.
http://www.ti.com/lit/ds/symlink/sn74hc125.pdf
There might be a hex or octal version of the chip with a single enable line that work just as well, I haven't looked.

The sparkfun board is not a USB Host controller and can't be made to be, so let's just drop the USB stick idea from the discussion going forward if you are planning to use that  board.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

fungus


Quote
The two things aren't interchangeable just because they both store data and they both use flash memory.


I thought the VUB300 was designed to do just that


Looks like it, but it hardly seems a simple solution.
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

jensvanhoof

#12
Mar 12, 2014, 07:14 pm Last Edit: Mar 12, 2014, 07:19 pm by jensvanhoof Reason: 1
Quote
The sparkfun board is not a USB Host controller and can't be made to be, so let's just drop the USB stick idea from the discussion going forward if you are planning to use that  board.


Understood!  8)

So, the SN74HC125 approach then. Forgive me if I'm asking stupid question, I'm still well on the elektronics learning curve.

For what I understood about the 4 gates in the chip, they simply offer the means to put 4 certain contacts into a high-impedance mode (so..off? :)). In this setup, I'd have to tie all the enable pins together so that they all get disabled/enabled at the same time.
So, using this setup I'd connect the SD card either to the PC (through the VUB300), or to the Sparkfun board.

So far so good?  :)

What isn't clear to me at the moment, are which lines need to go over the gates.
Quote
need 2 for the VUB300 since it access the card with 4-bit interface. Need 1 for the SPI interface (SCK, MISO, MOSI, SS) since it uses serial interface.


So, on the VUB300 I'm guessing pins SD_D0, SD_D1, SD_D2 and SD_D3? So that could be done by a single SN74HC125 then?
On the Sparkfun board the SD is not accessed through the SPI interface but over the SDIO interface. What would that mean?

I'm sorry, obviously I'm a electronics beginner. :)

Jens


CrossRoads

I hadn't looked that close at the sparkfun schematic (too small). The VUB300 shows 6 or may 8 control lines - all would need to be muxed.
Some are output only - card detect, write protect - so just pass those along. The other 6 - 4 data lines, command, clock - would all need muxing.
https://www.sdcard.org/downloads/pls/simplified_specs/archive/partE1_100.pdf
Hmm, 5 of the 6 lines look to be 2-way signals. So maybe simple Mux is not the correct part, perhaps a low Rds analog switch that looks like a transparent connection would be better.
Ooh - two of these per master would be good.
http://www.intersil.com/content/dam/Intersil/documents/isl8/isl8499.pdf
http://www.digikey.com/product-detail/en/ISL8499IVZ/ISL8499IVZ-ND/1034830

Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

CrossRoads

(I'd say a quad and a dual, for 6 total, but the duals don't seem to be available).
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Go Up