I'm designing a USB battery charger, and I'm trying to use simple hardware (ICs are fine, just nothing that I have to upload firmware onto preferrably) to detect whether or not the USB socket I'm plugging the device into is USB3.0 or USB2.0, so I can safely determine how much current I can draw. I'm using a BQ2439RSER chip to determine if the socket I'm plugged into is a Standard Downstream Port, Charging Downstream Port, or a Dedicated Charging port. However, I'm running into trouble coming up with a simple way to check whether or not the host port is USB3.0 or USB2.0.

My initial thought was to check for pullups/pulldowns on any of the extra USB3 pins not present on a USB2 socket, however in all of the schematics I've looked at, the superspeed differential pairs have blocking capacitors on them (see page 11 of this datasheet http://www.ti.com/lit/an/slla329/slla329.pdf). My next though was to just check to see if the GND_DRAIN pin was connected to the common USB GND pin, but this post (USB3 with fewer wires) says that GND_DRAIN and GND are not necessarily going to be the same.

I don't need any of the RX/TX pairs to work or transmit data, I'm only interested in identifying maximum allowable current, and drawing it. I'm aware that some devices will limit me to 100mA, but in my experience these seem to be few and far between these days, so I'm willing to test the prototype without enumeration (worst case scenario I'll ad an FT232R host controller to take care of that later, but I'm trying to keep this as simple as possible).

Thanks for the help

  • \$\begingroup\$ What speed does your device support? Does it have USB3? \$\endgroup\$ Oct 31 '16 at 20:37
  • 1
    \$\begingroup\$ So your device is the peripheral? Then you may want to look into any new IC than the BQ you mention. One that does usb 3.0 high capacity negotiations for you. I'm sure there are some that can be configured via resistors instead of some programmable version. \$\endgroup\$
    – Passerby
    Oct 31 '16 at 20:45
  • 1
    \$\begingroup\$ Because usb 3.0 charging at a higher current or voltage requires enumeration. \$\endgroup\$
    – Passerby
    Oct 31 '16 at 20:47
  • \$\begingroup\$ The device does not actually do any communications. I only need to identify the port type to tell if I can safely draw 500mA or 900mA from the port. I've been looking for a couple of days, and I haven't found an IC that will do charger identification and usb3.0 level negotiations. (edit: Yes my device is the peripheral. It's completely dumb, however, it's not meant to talk to the host, just draw power from the Vbus). \$\endgroup\$
    – Platytude
    Oct 31 '16 at 20:52
  • \$\begingroup\$ @Passerby, no, not really. For a normal USB3 host (which is formally designated as "high power port") no enumeration is necessary, and one can safely get 900mA, always. This is the requirement for a host. The functional device, however, has no rights to take more than "one unit" before being enumerated and configured, which is 150mA. The "one unit" rule only applies to so-called "low-power embedded hosts", usually battery-powered gadgets. But who would try to charge a laptop or a powerbank from a tiny smartphone? And the "low-power hosts" should limit the VBUS current anyway. \$\endgroup\$ Oct 31 '16 at 22:12

Normally, the port capability is determined by device after connecting and configuring the USB interface. And then control the charger accordingly. But if the device you design does not have any USB, just a charger with a USB3 cable, you can use Rx-detect capability of the USB3 Tx channel, see section 6-11 of USB3.0 specifications.

Essentially you need to provide 45-Ohm termination on Tx -> Rx wires. The host will apply a pulse to Tx-/Tx+ wires, and watch for RC response time. This pulse might be difficult to detect however on Rx side. If the host detects the termination, it will start sending LFPS differential signals, Polling.LFPS, which are bursts at 10-50MHz and 1us in duration, repeated every 10us until timeout of 360ms, since your device will not respond. You should be able to detect this activity. Or maybe just any differential activity on Tx lines will give you a hint if the host port is USB3 or USB2.

Actually, you may want just to detect the Rx-detect activity without providing the termination, just a high-impedance single-ended receiver will do, since the host must periodically check for presence of Rx termination.

  • \$\begingroup\$ Thanks for the advice! I'll read 6-11 and see if I can come up with some sort of polling solution! I'll provide updates when I make some progress \$\endgroup\$
    – Platytude
    Oct 31 '16 at 21:04
  • \$\begingroup\$ Would you be able to provide some insight into the timing of the RX-Detect sequencing? I know it will be a common mode signal applied to the incoming RX+/RX- lines, with a voltage of no-more than 600mV, but the spec doesn't go into much more detail than that. Additionally, how often would it be re-checking for termination presence? Sorry if the answers are in the spec, I've looked but it's a mammoth document. If I can't get that to work, I can always add termination, and then put a small balun on the RX lines to detect the LFPS signals. Thanks for your help again! \$\endgroup\$
    – Platytude
    Nov 3 '16 at 16:42
  • \$\begingroup\$ @Platytude, oh, man, you forced me to turn my scope on... The pulse is 10us long, positive 400mV high, and repetition rate is about 5ms. Edge is about 50ns over ~2m cable. I'll send you an invoice... \$\endgroup\$ Nov 3 '16 at 17:06
  • \$\begingroup\$ Hahahaha, much appreciated, that should be all I need \$\endgroup\$
    – Platytude
    Nov 3 '16 at 17:26

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.