1

I have an ARM computer with an USB 2.0 OTG port, and I want to use it as 5V 100mA power supply (to drive a couple of leds). However, when I connect a load (LED+resistor) via an OTG cable, the power is not supplied constantly. The LED blinks shortly 4 or 5 times, and then shuts down until I replug the OTG cable. Additionally, dmesg command reports:

musb-hdrc: configured as A device timeout

I suppose that means the OTG host supplied the power for a short time, but could not detect a USB slave on the bus and powered off the connector.

What does it take to trick the OTG host controller to believe there is a connected slave, so it keeps supplying power? Is this possible to achieve with a simple schematic, or is it absolutely necessary to implement the USB protocol? Is there a chip with low power consumption I could use for this?

Dmitry Grigoryev
  • 25,576
  • 5
  • 45
  • 106
  • If all you care about is power, a usb mouse or keyboard or hub ic would work wonders. Plug in and ignore, then take advantage of the power pins. – Passerby Apr 20 '15 at 19:52
  • I thought of this possibility, but the old USB mouse I have has a single chip in it (USB slave + sensor + processor), and it consumes 100 mA, leaving nothing for my application. – Dmitry Grigoryev Apr 20 '15 at 20:12
  • 1
    cut the parts you don't need out. A 1 dollar ebay usb hub would work otherwise. And your computer might only implement power switching, not power limiting. And the mouse might report as 100mA but probably uses a lot less, etc. – Passerby Apr 20 '15 at 22:58

1 Answers1

2

Related: How to get more than 100mA from a USB port

Do you have a way to force USB hardware into host mode (not OTG)? I see some kernel code here (with register bit definitions here)

/*
* Wait for the musb to set as A device to enable the
* VBUS
*/
while (musb_readb(musb->mregs, MUSB_DEVCTL) &
         MUSB_DEVCTL_BDEVICE) {

    mdelay(5);
    cpu_relax();

    if (time_after(jiffies, timeout)
          || loops-- <= 0) {
        dev_err(musb->controller,
        "configured as A device timeout");
        break;
    }
}

This is just a guess, but if you can force the controller into host mode, it might clear the BDEVICE bit in DEVCTL. The OTG spec allows a minimum of 1.1 seconds and a maximum of 30 seconds for a B device to connect before the host is allowed to turn off. I don't think plain USB includes this behavior.

If that doesn't work, you'll probably have to go through enumeration. This will require a controller IC. FTDI's programmable USB converter chips will probably do the job.

Adam Haun
  • 21,331
  • 4
  • 50
  • 91