[sdiy] USB Question
rsdio at audiobanshee.com
rsdio at audiobanshee.com
Wed Sep 23 18:56:10 CEST 2015
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.
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.
B
On Sep 23, 2015, at 9:47 AM, rsdio at audiobanshee.com wrote:
On Sep 22, 2015, at 11:28 PM, Vladimir Pantelic <vladoman at gmail.com> wrote:
> On 23.09.2015 08:10, Tim Ressel wrote:
>> I need to design a usb interface that does both host and device, but not
>> at the same time. There will be an A and B connector on the front
>> panel. All of the procs I've looked at only have one USB interface.
>> I'm guessing the thing to do here is to use a USB switch. Anyone have
>> some insights?
>
> many CPU'S have a so called USB-OTG (on the go) interface that allows to
> switch roles between host and device.
>
> normally switching to host mode is done by inserting a cable that has
> the ID pin (the 5th pin on a USB mini/micro connector) grounded, but it
> can of course also be done under SW control.
>
> look at e.g. the STM32F105, it has a: "USB 2.0 full-speed
> device/host/OTG controller with on-chip PHY that supports HNP/SRP/ID"
Check out the Texas Instruments EK-TM4C1294XL LaunchPad (about US$20).
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.
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.
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.
Brian Willoughby
Sound Consulting
More information about the Synth-diy
mailing list