Wednesday 22 November 2017

USB Host vs. Device Detection


Here is a problem to which the obvious answer is "use a switch," but that is not permitted in the design. ;)


I am writing software for a USB audio application that is supposed to be able to play audio from iP{od,ad,hone}s, Android devices, and also Samsung Audio from Samsung devices.


(quick note: USB Device with capital D = USB Peripheral = device with B-Connector)


I wouldn't have to ask this question if all these devices played nice and were just USB Devices. iPxx and Android devices are USB Devcies, but Samsung devices playing Samsung Audio act as USB Hosts (but they can also be USB Devices not playing Samsung Audio but as regular Android devices).



All devices have to connect to a single Type Standard-A connector on our embedded system running on a PIC32. Yeah, I know that's not USB-legal, but that's what the requirements are.


Since both USB Hosts and Devices have to connect to our embedded device, I need a way to detect when a device is plugged-in if it is a USB Host or a USB Device, so that my USB system shuts/brings itself up with the correct role depending on the attached device.


I have read the On-The-Go and Embedded Host Supplement to the USB Revision 2.0 Spec. The closest thing I got was Attach Detection Protocol. That helps with the general detection of attached devices but doesn't help detect the role of the device (Host or Device). Our hardware design is not final yet, so I am able to consider any hardware solutions that help that aren't... well... a switch. ;)


Look forward to the community's insight.




No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...