USB powering a design

Discussion in 'General Electronics Chat' started by Northy, Sep 6, 2012.

  1. Northy

    Thread Starter New Member

    Sep 6, 2012
    6
    0
    I have a problem with one of my designs, I've made it so that the board can power up from the USB connector, the problem is that the board struggles to boot.

    I guessing this is because the PC is limiting the USB output to 100mA, and the USB is interfaced straight to the uP in the design (that would have to negotiate more power) - but that hasn't booted to do that as the board is struggling to boot! A vicious circle!!! :eek:

    This whole thing has been made worse by adding a PTC polyfuse in line with the USB 5V coming in, the series resistance of that is causing voltage drop into the main regulator.

    Does anyone have any experience of doing similar things with USB powering? I'd like to keep the protection if possible.

    Thanks,

    G
     
  2. nigelwright7557

    Senior Member

    May 10, 2008
    487
    71
    Can yopu power down everything on the PCB ?
    The PIC can power up things like EEPROM's via an i/o pin once you have made contact with the PC.
     
  3. Papabravo

    Expert

    Feb 24, 2006
    10,137
    1,786
    Reduce your power consumption during the boot process. This is a well known hard limitation. Why on Earth would you design a product that violates this limitation?
     
  4. Northy

    Thread Starter New Member

    Sep 6, 2012
    6
    0
    Well it's not my initial design, it's a design I have been asked to tweak/change things on.
     
  5. Papabravo

    Expert

    Feb 24, 2006
    10,137
    1,786
    You may have bitten off more than you can chew. You have to negotiate for more than 100 mA and there really is no way around it except to build yourself a powered hub that can supply the power.
     
  6. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    You need to control your loading to under 100mA until you negotiate more current, and if the negotiation fails then you can't turn that other stuff on.

    You'll need another I/O pin on the micro and some firm firmware changes. I've used low dropout regulators as power switches, works if you can tolerate some minimal drop.
     
  7. chrissyp

    Active Member

    Aug 25, 2008
    82
    10
    Hi
    USB 2 output power should be up at 500 m/a ,otherwise use a power hub.Non communication can also be poor signal. ie not using twisted pair signal wire or using coiled cable .a signal repeater will help with that.
     
  8. Papabravo

    Expert

    Feb 24, 2006
    10,137
    1,786
    500 mA REQUIRES negotiation. You don't get it from the get go.
    BTW what is the Vcc on your board, and what is the Vcc of your processor?
     
  9. nigelwright7557

    Senior Member

    May 10, 2008
    487
    71
    Too long a cable can cause problems too.
    And a cable with LED's in it to light up the connectors can steal a bit of current.
     
  10. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,670
    804
    Actually, the standard says you need to negotiate, but have you seen the circuits that are published in datasheet from an USB hub? The recommended design for a 7-port hub chip from TI uses 100mΩ P-channel mosfets to control power for each port, and on this resistance it measures the current going to the port. It uses a simple comparator chip which changes output state when the drop on the transistor reaches ~0.5V, because 4.5V is the lower limit for usb power. It simply cannot tell if you draw 100mA or 500mA, and I doubt that any motherboard manufacturer bothers to implement that function.

    To the OP, I suggest you try measuring the voltage going to your device, preferably with an oscilloscope.
     
  11. Papabravo

    Expert

    Feb 24, 2006
    10,137
    1,786
    The problem is that a host device is only required to meet the terms of the standard. You absolutely cannot rely on the behavior of a particular piece of hardware that goes beyond the standard. One will meet the enhanced expectation and the next one will not.

    I agree that the OP needs to provide more information since we have joined him in leaping to the conclusion that 100 mA is not enough or that this is indeed the problem.
     
  12. Northy

    Thread Starter New Member

    Sep 6, 2012
    6
    0
    Hi everyone, sorry I've just got back to looking at this, I was sidetracked on other things.

    A bit more info.

    This is someone else's design, that I have been told to modify as little as possible.

    One of the known issues is that it struggles to boot and run from the USB, so I am looking into what I can do about it.

    I don't have a scope (yet), so did a few tests with a logging multimeter yesterday, not ideal but the best I can do for now. I powered up the board a lot of times to see what the max current was. The maximum value I saw was 145mA.

    I'm going to get a scope and look at extending the soft start to see if that helps, but if anyone has any other ideas I'd like to hear them?

    I've changed the circuit slightly, I'm taking the USB +5V from BEFORE the fuse to the main regulator circuit now, and just using the polyfuse to protect the uP port.

    That leads me onto another 'issue' with the current design. The USB +5V and battery voltages are diode 'OR'ed' together before the main regulator, but the battery voltage is always higher than USB +5V (when they are not flat), so it always takes power from the batteries anyway if they are in the unit. I'd really like to change this so that USB power really is used if available, but I'm limited mainly by space on the board, and also introducing any losses into the chain that would impact battery life. So again, if anyone has any simple ideas on that one I'd love to hear them :)

    G
     
  13. John P

    AAC Fanatic!

    Oct 14, 2008
    1,632
    224
    I don't like the sound of " PTC polyfuse in line with the USB 5V coming in, the series resistance of that is causing voltage drop into the main regulator".

    You haven't said what voltage the circuit runs on. Could it be 5V? If so, you're giving a 5V regulator a 5V input, along with this PTC fuse in series--the result should be obvious. Even if it's 3.3V, you might have problems.

    I think you'll need to control the battery operation via a transistor network. It doesn't have to be complicated, just a P-channel MOSFET with an N-channel MOSFET on its gate, and the N-channel FET controlled by the processor. There's probably a way to make it automatic depending on whether the USB power is on or not, but my first inclination would be to have the processor sense the power source and set the switch as required.

    Oh, and another thing--this "diode OR" business. That's another hit on the available voltage, over .5V if it's a regular diode or ~.3V for a Schottky. Is there a step-up feature to this regulator, or is it just throwing voltage away left and right?
     
  14. Northy

    Thread Starter New Member

    Sep 6, 2012
    6
    0
    Sorry, the circuit is 3.3V. The main regulator input can tolerate 3.1V to 17V, but it's struggling to boot from the +5V USB with the polyfuse in line. Now the +5V USB goes straight into the regulator the circuit boots fine, and the polyfuse is there to protect the uP USB port.

    I had been thinking about a P fet and a little reset monitor perhaps to control it when the USB +5V is 'good'?

    They are schottkys. But is there a better way to do it? I want some reverse connection protection anyway?

    Thanks,

    G
     
  15. JMac3108

    Active Member

    Aug 16, 2010
    349
    66
    Kubeek is correct. I know the USB spec requires negotiation for more than 100mA, but every PC I've ever tested will put out more than 100mA without any communication.

    I have a design on my bench right now that is using 200mA from USB without any negotiation having occured. I don't recommend designing new products this way, but its likely the OP has another problem.
     
  16. John P

    AAC Fanatic!

    Oct 14, 2008
    1,632
    224
    You haven't said whether the regulator is a linear or switching type. If it's a switcher, then it makes sense to say that it can operate with an input down to 3.1V, but if it's linear then that's irrelevant--you would need some amount of headroom, depending on device specs, between the 3.3V output and whatever the input is. And you say when the "+5V USB goes straight into the regulator the circuit boots fine" it makes me think that the problem is too much voltage drop in the system to allow the regulator to work properly. Measure the voltage at every point in the circuit, the (nominally) +5V USB input, both sides of the PTC fuse, both sides of the diode, both sides of the regulator. Then check the specs of the regulator and see if it's operating the way it should.
     
  17. Northy

    Thread Starter New Member

    Sep 6, 2012
    6
    0
    Sorry, the main regulator is a switcher Texas TPS6211.

    With the circuit:

    USB connector -> Polyfuse -> diode -> regulator
    USB connector -> Polyfuse -> diode -> uP USB port
    (+5V USB split after diode)

    I got:

    V USB before fuse: 5.00V
    V USB after fuse, before diode: 4.63V
    V USB after diode: 4.38V
    Board boots: No


    With the fuse shorted:

    V USB before fuse: 4.93V
    V USB after fuse, before diode: 4.93V
    V USB after diode: 4.66V
    Board boots: Yes


    With the circuit:

    USB connector -> Polyfuse -> uP USB port
    USB connector -> diode -> regulator
    (5V USB split after connector)

    The board boots.

    I'm quite happy with this really, the polyfuse can be spec'ed to protect the uP port and the board boots.

    I just need to look into my other problem of not taking current out of the batteries when the USB is plugged in.
     
Loading...