Saturday, 1 March 2014

usb otg - How to configure USB OTG as power supply


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?



Answer



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.


No comments:

Post a Comment

arduino - Can I use TI&#39;s cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...