Need help with USB OTG issue - Page 1
Forum section: electronics / projects

author: Chris C
author_rank: Frequent Contributor
timestamp: February 21, 2016, 05:20:08 am
content: I'm making at least 4x of a project, consisting of a tablet computer (HP Stream 7) connected to a USB device (Labjack U3-LV). These will be permanently connected together in a sealed enclosure. I intend for the enclosure to have a single USB jack on the outside, to be used for external power only (never data).When external power is present, it should power both tablet and USB device, and preferably charge the tablet. This requires the USB Sense pin to be connected to ground through a 124K resistor.With no external power, the tablet should power the USB device from its internal battery. This requires the USB Sense pin to be grounded.The tablet should act as a host, and be able to communicate with the Labjack, in both modes. I have tested these modes successfully, by splicing three USB cables together, then manually changing the resistance between Sense and GND.But I need this to be automatic, and I'm not sure how to accomplish that.(EDIT: I'd prefer a solution implementable with discrete components if possible, but a specialized IC is acceptable.)My first thought was to connect the external V+ pin to the tablet/Labjack through a Schottky diode. This would allow me to easily detect the presence of the external supply, and if I can just manage that, I can figure out the rest. However, the 2A OEM external supply drops to 4.8V when powering the tablet and Labjack. Adding in the Schottky's drop, it leaves the voltage too close to USB 2.0's minimum specified 4.4V.Any ideas?I could use a different supply that maintains at least 5.0V, or modify the external USB cable/supply to send a signal on one of the unused data pins to allow detection. But then my design wouldn't work if the user swapped what appears to be a standard part for a different one, so that's not acceptable.Or I could use a barrel jack, and 5V PS with barrel plug, for external power. But then the user might plug in a higher voltage supply by mistake. So add a internal switching regulator, set for 5.3V (to allow for the Schottky drop). And another PS, instead of using the ones provided with the tablet. There's got to be a more elegant solution!(Also, I found that the tablet will not charge its battery when the charger is connected, and the tablet is on. It will not drain the battery when on, but it only charges the battery when the tablet is off. This occurs even with the unmodified OEM charger/cable. With my modified cables and 124K resistor, the tablet additionally doesn't display that external power is present, though it otherwise functions identically. I could not resolve it through the suggestions I found via Google, of changing the screen brightness or reloading the "Microsoft ACPI Compliant Control Method Battery" driver. It would be nice, but not necessary, to fix this as well; though since the issue exists even with OEM charger/cable, I'm not sure it can be fixed.)

author: Kilrah
author_rank: Unknown
timestamp: February 21, 2016, 05:29:29 am
content: Quote from: Chris C on February 21, 2016, 05:20:08 amSurprising that grounding the sense pin doesn't disconnect the USB device.

author: Chris C
author_rank: Frequent Contributor
timestamp: February 21, 2016, 05:54:25 am
content: Quote from: Kilrah on February 21, 2016, 05:29:29 amThe cable I started with has the sense pin floating, not connected to any other pin - or even a wire passing through the cable - at the end where it plugs into the tablet. It was apparently a charge-only cable, and would not allow the tablet to go into host mode, or communicate with any device. As a USB OTG newbie, I scratched my head for hours over this! Multiple references found on Google said Sense is typically grounded to enable host mode. So I whittled away the rubber boot to access the pin's solder pad, and upon grounding it, I was able to access USB devices as expected. Perhaps you've got the meaning of grounded vs. floating swapped? Or if I've missed something, please educate me.

author: Chris C
author_rank: Frequent Contributor
timestamp: February 23, 2016, 12:04:24 am
content: , thinking about this some more, I might have misunderstood you. When switching from 124K to 0K (or vica versa) between Sense/GND, the USB device doestemporarilybecome disconnected. Which isn't ideal, but is acceptable for now. Was that what you were referring to?I'm under some time constraints, so I went ahead and redesigned the best way I knew. Using supplemental external switching PS, 12V @ 2A with 2.1mm barrel plug. The mating 2.1mm barrel jack has a sense pin, which is grounded when the plug isn't inserted; wired between USB Sense and GND in parallel with a 124K resistor, this provides the needed logic. And added an internal switching DC-DC converter, 12V -> 5.3V 3A, with reverse protection Schottkys on input and output.Still, if anyone has other suggestions on this or the two other minor issues (tablet won't charge when on, device temp disconnect during switchover), I'd like to hear them.

author: Kilrah
author_rank: Unknown
timestamp: February 25, 2016, 12:10:35 pm
content: What I meant is that in my experience OTG host mode and charging were always mutually exclusive. When in normal (device) mode the device accepts charging, but in host mode it has to switch its power circuits in the other direction to power the device connected to it, and thus logically can't accept being charged anymore.