Android ext. circuit, does not connect unless provided w/ 5V, need workaround - Page 1
Forum section: electronics / projects

author: frank26080115
author_rank: Regular Contributor
timestamp: June 13, 2012, 01:00:11 am
content: Android external circuit, does not connect unless provided with 5V, need workaroundMy circuit involves an AVR microcontroller and a MAX3421E USB host interface IC. This IC is exactly the same one as what is used on the "USB Host Shield" and "Android Accessories Development Kit" for Arduino. The circuit is powered at 3.3V, not 5V, keep that in mind. The 3.3V supply comes from a LDO regulator that is actually connected to my Android smartphone's battery (I placed copper tape on the back of my battery, soldered to the terminals, the PCB has springed contacts that connect with the copper tape. The PCB is held to the battery securely because I 3D printed a phone case designed specifically for my PCB and phone. These steps are already done so it is too late to change the project approach regarding this).Alright, so I've gotten code to work, I know the circuit works, the AVR is programmed, serial debug is working. I have a logic analyzer and checked that the MAX3421E is talking on the SPI bus and is initialized properly.So I connect it to my smartphone. Keep in mind that since my circuit runs at 3.3V, with no possible source of 5V at this time. So even though GND, D+, and D- are connected to my smartphone, the 5V line is not connected.The INT output of the MAX3421E does not show activity, meaning from the MAX3421E point of view, nothing has happened. I verified this by checking the D+ and D- USB signals. One of them should show a logic high indicating a connection (only one of D+ or D- depending on the USB speed classification), but none of them do.Now I'm suspecting that I need to inject 5V into the 5V line to make the smartphone even bother to respond. When I connect it to a 5V external source, Android shows USB as connected, the battery as charging, and there is activity on the MAX3421E's INT signal and SPI bus. This confirms my suspicions. I did try injecting 3.3V instead but the phone does not respond to that.I connect a DC/DC step-up converter circuit from the 3.3V supply to output 5V. It works and does successfully trick the smartphone into connecting via USB. But the step-up converter gets hot. It's rated for 200 mA, my 3.3V voltage regulator is rated for 300 mA. I did a measurement and the phone was pulling around 600 mA. This is unacceptable.Through research, I read that I should not place DC/DC converters in parallel. So I have no way of simply increasing the current rating by placing anything in parallel.I cannot use a bigger battery due to the 3D printed case.I cannot constantly have an external source of 5V, the final device must be portable.I know USB devices has to "negotiate" a charge current, in the USB descriptors, it tells the host whether or not it is self or bus powered, and how much current is required. Is there any way to tell the device to not take so much current?From my knowledge of circuit theory I think there are no practical devices that can maintain 5V and yet still impose a limit on current without dropping voltage, such a device would break Ohm's law. But if I am wrong, please let me know.Or... is this something that is controlled by the Android OS or a component of the Android OS?I am using "microbridge" fromhttp://code.google.com/p/microbridge/which pretends to be a ADB server's TCP connection. I am running Android 2.3.3 I cannot use ADK since it is not supported. Yes I know ICS supports ADK but NO I cannot upgrade to ICS so that's not an option. I did try various ways of hacking ADK into 2.3.3 but had no success.Another option is to simply get a new DC/DC converter with higher capacity and connect it to the phone's battery, in theory it should work but this is really inefficient. I want to leave this as the last option because it does involve more hardware hacking as opposed to a clean software solution.

author: jerry507
author_rank: Regular Contributor
timestamp: June 13, 2012, 02:11:49 am
content: Holy wall of text.The short answer is that you need VBUS, which is 5V. Without VBUS nothing happens.Rereading this, is this a troll?

author: frank26080115
author_rank: Regular Contributor
timestamp: June 13, 2012, 04:54:32 am
content: Quote from: jerry507 on June 13, 2012, 02:11:49 amyes i figured out VBUS needs to be 5V, like I wrote, I did connect a DC/DC stepup to feed 5V to it and it does trick it into working, but my stepup converter is rated to 200mA and the phone is pulling 500mA so it gets really hot.MORE PROGRESSbNumConfigurations is only 1, which means I can't really tell the phone to use another current setting through software, bMaxPower is 500mA as well

author: jerry507
author_rank: Regular Contributor
timestamp: June 13, 2012, 04:19:10 pm
content: As a host, you're REQUIRED to supply 500mA. Depending on the host implementation, you may be able to restrict the draw of the phone. On fixed function chips though, often the chips just assume there is 500mA there and only implement logic to distribute that 500mA as needed, leaving you no interaction to the process.You must understand that supplying 5V isn't "tricking" anything. You're a host. You're REQUIRED to supply 5V. That 5V is what signals the USB device (your phone) that it's plugged in and ready to communicate. USB isn't a protocol you can use without supplying power. VBUS is built into many signaling and connection aspects of the protocol.

author: hlavac
author_rank: Frequent Contributor
timestamp: June 14, 2012, 02:37:40 am
content: Did you look at the usb-2-go specifications? Maybe there are some provisions for this

author: AlfBaz
author_rank: Super Contributor
timestamp: June 14, 2012, 02:45:43 pm
content: Does your phone support otg? If so have a look at the various modes that can be set up via the ID pin. I'm fairly certain you can be a device with no vbus current draw. The ID pin has a few states like open cct, shorted to gnd and shorted to gnd via certain resistances.I haven't looked into it in any great detail, but I'm going to have to soon. If you get it to work, let us know

author: frank26080115
author_rank: Regular Contributor
timestamp: June 14, 2012, 03:23:34 pm
content: I'll mess around with the ID pin soon, but I'm pessimistic because technically, the phone should be the one with OTG and thus it should be the one setting the state of the ID pin. Later when I have time I'll try some other tricks involving resistors on the VBUS line, or pull-up resistor on the D+ line.I can't get USB host working on the phone, I don't think it's supported. Tablets might but not this phone since it requires Android 3.1 and I can't upgrade above 2.3.3

author: AlfBaz
author_rank: Super Contributor
timestamp: June 14, 2012, 03:43:58 pm
content: Have a look at some of this guys projects.He has a usb diagnostic tool that can tell what your phone can and cant do, USB wise... and you're in luck it works on 2.3.1 and up

author: frank26080115
author_rank: Regular Contributor
timestamp: June 14, 2012, 03:47:38 pm
content: Quote from: AlfBaz on June 14, 2012, 03:43:58 pmHi AlfBaz, I think you forgot to post the link

author: AlfBaz
author_rank: Super Contributor
timestamp: June 14, 2012, 03:48:45 pm
content: Yeah I did...http://www.chainfire.eu/articles/110/USB_Host_Diagnostics_released_/

author: frank26080115
author_rank: Regular Contributor
timestamp: June 14, 2012, 06:48:52 pm
content: Quote from: AlfBaz on June 14, 2012, 03:48:45 pmBleh, tried it, my phone doesn't support any of it. Thanks though, it's a really useful tool