I'm designing a device that have will play mp3 files either from an internal usb flash drive (not physically accessible to end user) or from an usb flash drive plugged on an external usb port

Also, there will be times where the external usb port will be used to access the internal usb drive Basically there are three situations: 1. Playing from internal drive 2. Playing from external drive 3. Using external port to access internal drive

In other words, there are two switches that must be done: The mp3 engine to switch between internal and external drives The external port to switch between mp3 engine and internal drive

Any ideas on how to do this switching? I know of ts3usb30 that can implement one switch to two possible routes. I thought of arrange three of them so that I could achieve the three ways but don't know if it would work.

Any other idea?

  • \$\begingroup\$ You don't need a switch. You need a microcontroller which can switch between host mode and peripheral mode on-the-fly (and obviously is capable of MP3 playback). Fortunately these are available ... many micros have USB-OTG. \$\endgroup\$
    – brhans
    Jan 30, 2015 at 18:52
  • \$\begingroup\$ Ok, but I still must be able to enable a connection between the external usb port and the internal usb drive. Do you suggest I use the mcu like a bridge in this case too? In this case the mcu would have to implement two ports, one in host mode and the other in peripheral. I was thinking in a way of not involving the mcu in this specific use case \$\endgroup\$
    – magnomp
    Feb 2, 2015 at 12:48

1 Answer 1


The idea I suggested in my comment looks something like this:


simulate this circuit – Schematic created using CircuitLab

The internal memory is not connected to USB at all. Its connected to the micro and it could be an SD-Card (removable or embedded) or a big NAND-flash IC or whatever.
In stand-alone mode the micro just reads from this internal memory.
The USB port is a 2-way OTG port. So if you plug a USB memory stick in then the micro runs in USB host mode and reads the memory stick (either exclusively or in addition to the internal memory).
If you plug the USB port into a PC, then the micro switches to peripheral mode and turns itself into a USB memory stick - exposing its internal SD-Card/NAND-flash/whatever to the PC for reading & writing.

This way you avoid having to do any interesting 3-way USB switching as the micro handles all of the USB traffic in and out and directs data to and from the internal memory as required.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.