# replace SD card with USB stick

**URL:** <https://forum.arduino.cc/t/replace-sd-card-with-usb-stick/219232>\
**Category:** General Electronics\
**Created:** [March 12, 2014, 3:53pm UTC](https://forum.arduino.cc/t/replace-sd-card-with-usb-stick/219232 "2014-03-12T15:53:46Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![jensvanhoof](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/jensvanhoof/32/783275_2.png) [@jensvanhoof](https://forum.arduino.cc/u/jensvanhoof)\
**Post date:** [March 12, 2014, 3:53pm UTC](https://forum.arduino.cc/t/replace-sd-card-with-usb-stick/219232/1 "2014-03-12T15:53:46Z")

</div>

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](http://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: [DIY USB SD Card Reader for PC/Mac possible? - Project Guidance - Arduino Forum](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

---

<div class="post-metadata">

**Author:** ![tsunamy\_boy](https://avatars.discourse-cdn.com/v4/letter/t/b5e925/32.png) [@tsunamy\_boy](https://forum.arduino.cc/u/tsunamy_boy)\
**Post date:** [March 12, 2014, 4:23pm UTC](https://forum.arduino.cc/t/replace-sd-card-with-usb-stick/219232/2 "2014-03-12T16:23:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![CrossRoads](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/crossroads/32/214033_2.png) [@CrossRoads](https://forum.arduino.cc/u/CrossRoads)\
**Post date:** [March 12, 2014, 4:38pm UTC](https://forum.arduino.cc/t/replace-sd-card-with-usb-stick/219232/3 "2014-03-12T16:38:45Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jensvanhoof](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/jensvanhoof/32/783275_2.png) [@jensvanhoof](https://forum.arduino.cc/u/jensvanhoof)\
**Post date:** [March 12, 2014, 4:57pm UTC](https://forum.arduino.cc/t/replace-sd-card-with-usb-stick/219232/4 "2014-03-12T16:57:42Z")

</div>

> 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?

---

<div class="post-metadata">

**Author:** ![fungus](https://avatars.discourse-cdn.com/v4/letter/f/c6cbf5/32.png) [@fungus](https://forum.arduino.cc/u/fungus)\
**Post date:** [March 12, 2014, 5:02pm UTC](https://forum.arduino.cc/t/replace-sd-card-with-usb-stick/219232/5 "2014-03-12T17:02:54Z")

</div>

> jensvanhoof:  
> 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.

> jensvanhoof:  
> 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.

---

<div class="post-metadata">

**Author:** ![CrossRoads](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/crossroads/32/214033_2.png) [@CrossRoads](https://forum.arduino.cc/u/CrossRoads)\
**Post date:** [March 12, 2014, 5:10pm UTC](https://forum.arduino.cc/t/replace-sd-card-with-usb-stick/219232/6 "2014-03-12T17:10:36Z")

</div>

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.

 ![SDcard_muxing.jpg](https://europe1.discourse-cdn.com/arduino/original/4X/f/2/c/f2c967dd49733fe6d8172afaa6cb47cc877bf15e.jpeg)

---

<div class="post-metadata">

**Author:** ![jensvanhoof](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/jensvanhoof/32/783275_2.png) [@jensvanhoof](https://forum.arduino.cc/u/jensvanhoof)\
**Post date:** [March 12, 2014, 5:13pm UTC](https://forum.arduino.cc/t/replace-sd-card-with-usb-stick/219232/7 "2014-03-12T17:13:02Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![jensvanhoof](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/jensvanhoof/32/783275_2.png) [@jensvanhoof](https://forum.arduino.cc/u/jensvanhoof)\
**Post date:** [March 12, 2014, 5:20pm UTC](https://forum.arduino.cc/t/replace-sd-card-with-usb-stick/219232/8 "2014-03-12T17:20:01Z")

</div>

> 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. 🙂

> 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?

---

<div class="post-metadata">

**Author:** ![fungus](https://avatars.discourse-cdn.com/v4/letter/f/c6cbf5/32.png) [@fungus](https://forum.arduino.cc/u/fungus)\
**Post date:** [March 12, 2014, 5:20pm UTC](https://forum.arduino.cc/t/replace-sd-card-with-usb-stick/219232/9 "2014-03-12T17:20:33Z")

</div>

> jensvanhoof:
> 
> > 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.

---

<div class="post-metadata">

**Author:** ![jensvanhoof](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/jensvanhoof/32/783275_2.png) [@jensvanhoof](https://forum.arduino.cc/u/jensvanhoof)\
**Post date:** [March 12, 2014, 5:29pm UTC](https://forum.arduino.cc/t/replace-sd-card-with-usb-stick/219232/10 "2014-03-12T17:29:02Z")

</div>

> 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 🙂

---

<div class="post-metadata">

**Author:** ![CrossRoads](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/crossroads/32/214033_2.png) [@CrossRoads](https://forum.arduino.cc/u/CrossRoads)\
**Post date:** [March 12, 2014, 5:42pm UTC](https://forum.arduino.cc/t/replace-sd-card-with-usb-stick/219232/11 "2014-03-12T17:42:42Z")

</div>

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.

> **[sn74hc125.pdf](https://www.ti.com/lit/ds/symlink/sn74hc125.pdf)**
>
> 1777.52 KB

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.

---

<div class="post-metadata">

**Author:** ![fungus](https://avatars.discourse-cdn.com/v4/letter/f/c6cbf5/32.png) [@fungus](https://forum.arduino.cc/u/fungus)\
**Post date:** [March 12, 2014, 5:45pm UTC](https://forum.arduino.cc/t/replace-sd-card-with-usb-stick/219232/12 "2014-03-12T17:45:00Z")

</div>

> jensvanhoof:
> 
> > 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.

---

<div class="post-metadata">

**Author:** ![jensvanhoof](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/jensvanhoof/32/783275_2.png) [@jensvanhoof](https://forum.arduino.cc/u/jensvanhoof)\
**Post date:** [March 12, 2014, 6:14pm UTC](https://forum.arduino.cc/t/replace-sd-card-with-usb-stick/219232/13 "2014-03-12T18:14:04Z")

</div>

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

> 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

---

<div class="post-metadata">

**Author:** ![CrossRoads](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/crossroads/32/214033_2.png) [@CrossRoads](https://forum.arduino.cc/u/CrossRoads)\
**Post date:** [March 12, 2014, 7:40pm UTC](https://forum.arduino.cc/t/replace-sd-card-with-usb-stick/219232/14 "2014-03-12T19:40:50Z")

</div>

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](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.intersil.com/content/dam/Intersil/documents/isl8/isl8499.pdf)

> **[ISL8499IVZ | Digi-Key Electronics](https://www.digikey.com/en/products/detail/ISL8499IVZ/ISL8499IVZ-ND/1034830)**
>
> Order today, ships today. ISL8499IVZ – 4 Circuit IC Switch 2:1 250mOhm 16-TSSOP from Renesas Electronics America Inc. Pricing and Availability on millions of electronic components from Digi-Key Electronics.

---

<div class="post-metadata">

**Author:** ![CrossRoads](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/crossroads/32/214033_2.png) [@CrossRoads](https://forum.arduino.cc/u/CrossRoads)\
**Post date:** [March 12, 2014, 7:42pm UTC](https://forum.arduino.cc/t/replace-sd-card-with-usb-stick/219232/15 "2014-03-12T19:42:41Z")

</div>

(I'd say a quad and a dual, for 6 total, but the duals don't seem to be available).

---

<div class="post-metadata">

**Author:** ![jensvanhoof](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/jensvanhoof/32/783275_2.png) [@jensvanhoof](https://forum.arduino.cc/u/jensvanhoof)\
**Post date:** [March 12, 2014, 8:15pm UTC](https://forum.arduino.cc/t/replace-sd-card-with-usb-stick/219232/16 "2014-03-12T20:15:13Z")

</div>

> Ooh - two of these per master would be good.

What do you mean by 'master'? PC and 'Sparkfun'?

---

<div class="post-metadata">

**Author:** ![CrossRoads](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/crossroads/32/214033_2.png) [@CrossRoads](https://forum.arduino.cc/u/CrossRoads)\
**Post date:** [March 12, 2014, 8:19pm UTC](https://forum.arduino.cc/t/replace-sd-card-with-usb-stick/219232/17 "2014-03-12T20:19:54Z")

</div>

VUB300 and sparkfun, the guys that actually interface with the card.

---

<div class="post-metadata">

**Author:** ![jensvanhoof](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/jensvanhoof/32/783275_2.png) [@jensvanhoof](https://forum.arduino.cc/u/jensvanhoof)\
**Post date:** [March 12, 2014, 8:33pm UTC](https://forum.arduino.cc/t/replace-sd-card-with-usb-stick/219232/18 "2014-03-12T20:33:14Z")

</div>

> VUB300 and sparkfun, the guys that actually interface with the card.

Excellent. Well understood!

So, I'd need two ISL8499 chips for each master, and then connect  
VUB300\_D0, VUB300\_D1, VUB300\_D2, VUB300\_D3 to ISL8499#1  
VUB300\_CMD, VUB300\_CLK to ISL8499#2  
spark\_D0, spark\_D1, spark\_D2, spark\_D3 to ISL8499#3  
spark\_CMD, spark\_CLK to ISL8499#4.

On which pins would I have to connect them on the ISL8499's? I suppose either the NO or NC contacts?  
Which pins would have to go the SD socket?

---

<div class="post-metadata">

**Author:** ![CrossRoads](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/crossroads/32/214033_2.png) [@CrossRoads](https://forum.arduino.cc/u/CrossRoads)\
**Post date:** [March 13, 2014, 3:19am UTC](https://forum.arduino.cc/t/replace-sd-card-with-usb-stick/219232/19 "2014-03-13T03:19:45Z")

</div>

A little messy, but you get the idea?

 ![SD_muxing.jpg](https://europe1.discourse-cdn.com/arduino/original/4X/2/1/b/21bfd43df6195267f10f47c401af3a43c8401d0c.jpeg)

---

<div class="post-metadata">

**Author:** ![jensvanhoof](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/jensvanhoof/32/783275_2.png) [@jensvanhoof](https://forum.arduino.cc/u/jensvanhoof)\
**Post date:** [March 13, 2014, 6:30am UTC](https://forum.arduino.cc/t/replace-sd-card-with-usb-stick/219232/20 "2014-03-13T06:30:38Z")

</div>

Got it!

> Ooh - two of these per master would be good.

Confused me a bit, I understood I'd need 2x2 chips, but got it now'.

How would you switch between the 2 masters in this configuration? As I don't see enable contacts on the chip as suggested with the previous suggestion? 🙂

[Next page](https://forum.arduino.cc/t/replace-sd-card-with-usb-stick/219232.md?page=2)
