1
\$\begingroup\$

I am designing a device using the PIC32MX795 processor that will act as a USB host. Since it is a battery operating device, I would prefer to not supply 5 volts all of the time on the USB port (the device will operate off a 3.7v Poly-Lithium battery and use a DC-DC boost converter to generate the 5 volts).

I would like to keep the device powered down as much as possible whenever there is nothing plugged into the USB connector. Is there some way of waking up when someone plugs in a USB device into the connector?

Even if I have to wake up once every second or so for a few milliseconds, that might be acceptable but I would prefer not to have to power up the 5 volts each time.

EDIT: After a device is plugged in, and I get data from it, then after some delay I would like to power it off so that it is not drawing current any more. This will force the user to unplug the device and plug it back in again to read the data again, which is okay.

\$\endgroup\$
3
\$\begingroup\$

You can't count on what a device will do when it doesn't receive valid USB power. For example, it might not even turn on its pull up/down resistors to indicate the speed until it thinks it's plugged into a USB, which it might detect by looking at the bus power voltage.

If you can tolerate a little lag when a device is plugged in, wake up periodically and turn on the USB power for a little while. One problem is that devices might themselves take a little time to come up once power is applied. Some of my PIC programmers, for example, have deliberate waits of a few 100 ms after they run before turning on the USB. This is to make sure everything is truly stable before talking to the host. There is no guarantee how long you need to wait for a device to want to talk to the host after being powered by the USB. A half second is probably good enough for most cases, but you can't know that for sure.

A more reliable strategy would be to make a converter that takes very little power when no current is drawn from its 5V output. That shouldn't be too hard. If done properly, the drain on a 5V output with nothing connected can be a few microamps or less.

USB is optimized for light weight devices at the expense of more burden on the host. There is no free lunch.

\$\endgroup\$
  • \$\begingroup\$ After a device is plugged in, and we get data from it, then after some delay I would like to power it off so that it is not drawing power any more (I didn't make this clear in my question, will edit). This will force the user to unplug the device and plug it back in again to read the data again, which is okay. \$\endgroup\$ – tcrosley Oct 27 '11 at 19:44
  • \$\begingroup\$ What if I constructed a circuit like my multimeter, and when the +5v power is off, measured the resistance between the +5 and ground leads of the USB connector? I tried several different devices, and they all showed a resistance under 500K. Actually I just want to sense something that is not an open circuit. \$\endgroup\$ – tcrosley Oct 27 '11 at 20:56
  • \$\begingroup\$ @tcrosley: That could work for many cases, but some devices might not draw much of anything until the voltage gets to valid USB levels. \$\endgroup\$ – Olin Lathrop Oct 27 '11 at 21:43
  • \$\begingroup\$ @OlinLathrop - I can't think of a single device that won't have some sort of clamping diodes to VCC and VSS. Every USB PHY I have seeen has at least some sort of protection on the USB IO. It's needed for ESD protection from the connector. And even if that is (strangely) missing, there is the intrinsic diode native to every semiconductor IC to consider. \$\endgroup\$ – Connor Wolf Oct 28 '11 at 5:08
  • \$\begingroup\$ Anyways, something like a flying capacitor converter (which uses basically no power at no load) is probably the best idea, anyways, as Olin says. \$\endgroup\$ – Connor Wolf Oct 28 '11 at 5:09

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.