<p dir="ltr">yes, that is doable</p>
<div class="gmail_quote">On Sep 23, 2015 7:08 PM, "Tim Ressel" <<a href="mailto:timr@circuitabbey.com">timr@circuitabbey.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This will be for USB Midi, so the host connector needs to be powered and the device connector does not. But I should be able to sense power on the device connector and switch accordingly?  Default to host and switch to device upon power on the device connector?<br>
<br>
--TimR<br>
<br>
On 9/23/2015 9:56 AM, <a href="mailto:rsdio@audiobanshee.com" target="_blank">rsdio@audiobanshee.com</a> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
One correction to my comments: Whether your Device mode is self-powered or not, you always need to be able to read the power coming from the USB B connector to ensure that your CPU does not enable or drive the data lines unless power is present. That's one of the basic rules of USB. So, this means that your source for USB power over the A connector cannot connect to the power on the B connector, otherwise you'll never know.<br>
<br>
The only thing missing from the EK-TM4C1294 LaunchPad is an example circuit for a system with both A and B connectors, so that's where we're getting into new territory. If anyone knows of an evaluation board that does have both A and B - especially with schematics freely available - then please share with the list.<br>
<br>
B<br>
<br>
<br>
On Sep 23, 2015, at 9:47 AM, <a href="mailto:rsdio@audiobanshee.com" target="_blank">rsdio@audiobanshee.com</a> wrote:<br>
On Sep 22, 2015, at 11:28 PM, Vladimir Pantelic <<a href="mailto:vladoman@gmail.com" target="_blank">vladoman@gmail.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 23.09.2015 08:10, Tim Ressel wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I need to design a usb interface that does both host and device, but not<br>
at the same time. There will be an A and B connector on the front<br>
panel.  All of the procs I've looked at only have one USB interface.<br>
I'm guessing the thing to do here is to use a USB switch.  Anyone have<br>
some insights?<br>
</blockquote>
many CPU'S have a so called USB-OTG (on the go) interface that allows to<br>
switch roles between host and device.<br>
<br>
normally switching to host mode is done by inserting a cable that has<br>
the ID pin (the 5th pin on a USB mini/micro connector) grounded, but it<br>
can of course also be done under SW control.<br>
<br>
look at e.g. the STM32F105, it has a: "USB 2.0 full-speed<br>
device/host/OTG controller with on-chip PHY that supports HNP/SRP/ID"<br>
</blockquote>
Check out the Texas Instruments EK-TM4C1294XL LaunchPad (about US$20).<br>
<br>
It has an ARM Cortex-M4 with USB OTG and good source code examples. They have examples of Host firmware and examples of Device firmware. The documentation makes a big deal of the fact that none of the examples will switch between Host and Device for you, so I imagine the solution is to read the OTG input pin and then "reboot" into the other mode when it changes. It doesn't seem like it will be too difficult. I've tested their USB Audio Class Host firmware example, and it works fine. I assume that the USB Device firmware is even simpler, and also functional.<br>
<br>
The EK-TM4C1294XL LaunchPad is also a good example of the circuit needed. The technical manual for that LaunchPad has the full schematic. One interesting component on the board is a chip that controls the current being fed to the Host port to power the external Device. You'll need to keep the power on the A and B connectors separate. It will be challenging if you want to power your board entirely from USB when acting as a Device, and probably much easier if your board is always self-powered. You'll need to be able to read the B connector power on a 5-Volt-tolerant GPIO pin to detect external power unless you're always self-powered. I think that the ground and differential USB data can be shared between the A and B.<br>
<br>
I'm sure there are other options, but I wanted to point out that the TM4C1294 has good examples for the circuits and source for the firmware.<br>
<br>
Brian Willoughby<br>
Sound Consulting<br>
<br>
_______________________________________________<br>
Synth-diy mailing list<br>
<a href="mailto:Synth-diy@dropmix.xs4all.nl" target="_blank">Synth-diy@dropmix.xs4all.nl</a><br>
<a href="http://dropmix.xs4all.nl/mailman/listinfo/synth-diy" rel="noreferrer" target="_blank">http://dropmix.xs4all.nl/mailman/listinfo/synth-diy</a><br>
<br>
</blockquote>
<br>
-- <br>
--Tim Ressel<br>
Circuit Abbey<br>
<a href="mailto:timr@circuitabbey.com" target="_blank">timr@circuitabbey.com</a><br>
<br>
_______________________________________________<br>
Synth-diy mailing list<br>
<a href="mailto:Synth-diy@dropmix.xs4all.nl" target="_blank">Synth-diy@dropmix.xs4all.nl</a><br>
<a href="http://dropmix.xs4all.nl/mailman/listinfo/synth-diy" rel="noreferrer" target="_blank">http://dropmix.xs4all.nl/mailman/listinfo/synth-diy</a><br>
</blockquote></div>