Author Topic: Simplest up-to-date way to detect USB possible intensity ?  (Read 1397 times)

0 Members and 2 Guests are viewing this topic.

Offline JaunedeauTopic starter

  • Regular Contributor
  • *
  • Posts: 100
Simplest up-to-date way to detect USB possible intensity ?
« on: April 10, 2016, 05:21:39 pm »
Hi,

  I am making a lamp with leds. The lamp will have an MCU to do useless animation. In normal conditon, the lamp will draw 1 to 2 amps. Of course when I plug it to a computer for firmware update (or for any other reason), I want to be sure to only draw 500mA after I have politely asked permission to do so.

  I've spent hours reading the USB and USB-IF documentation, and learned many things, but still don't want to spend more time prototyping and debugging the code myself (that would take as much time as the rest of the project !).

  So my question is : What is the simplest IC I can buy that will tell me how much current I can use (and would possibly be able to deal with non standard Apple chargers) ?

  For now, microchip's USB3751 seems rather ok (0.5mm pitch, no bga, easy to source since I will order things from microchip, only require 1 external capacitor). The thing is that it does not know about apple chargers, and don't tell you exactly how much current you can draw (e.g. it will tell you "Dedicated charging port", but this could be from 500mA to 2.5A available).

  What is you current solution to this problem ?

Thanks you,
John.
 

Offline Kilrah

  • Supporter
  • ****
  • Posts: 1852
  • Country: ch
Re: Simplest up-to-date way to detect USB possible intensity ?
« Reply #1 on: April 10, 2016, 05:32:48 pm »
There can be no such thing since there is no standard beyond 500mA (not counting the newest stuff that isn't really in use yet) and everybody does a bit what they want.
Devices often kinda self-regulate either actively or just naturally with the voltage drop of poor PSUs that get overloaded.

You should probably start low, try a few things and allow yourself more current at each step, e.g.
No enumeration, 100mA max
If enumeration, negotiate up to 500mA, draw what you're allowed
If USB lines shorted you get a "charging port" that can support anything between 500mA and 2A but you have no way to know how much.
« Last Edit: April 10, 2016, 05:38:43 pm by Kilrah »
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9933
  • Country: us
Re: Simplest up-to-date way to detect USB possible intensity ?
« Reply #2 on: April 10, 2016, 07:29:37 pm »
Basically, the D+ and D- pins will exhibit an impedance to ground of 15k ohms if the device is connected to a PC and the pins are left open for a charger.  Here is an article/datasheet that discusses the problem in detail:
http://www.skyworksinc.com/uploads/documents/Automatic_USB_Detection_AppNote_202742Apdf.pdf

You are trying to detect a charger (in effect) so I searched for 'usb how to detect charger'.  There are a number of links.

You let the uC detect whether it is powered by a charger or a USB port and if it is a charger, gate a MOSFET to pass the 5V to the loads.

Maybe this will help:
http://www.ti.com/lit/ds/symlink/bq24392.pdf
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf