2
\$\begingroup\$

I'm working on a PCB to both charge an Android tablet and also allow Android to connect to the PCB via Serial port (PCB includes an ATMega8u2 configured as a CDC, supplying a Serial port). To enable 500mA charging I have CC1 and CC2 pulled high via a 56k resistor. The CDC device is connected to the D+/D- pins. Here are the problems:

  1. If the D+/D- pins are connected when the Android device is plugged in, then it will not charge, nor see the CDC device.
  2. If the D+/D- pins are NOT connected when plugged in, then the Android device will charge. Connecting the D+/D- pins afterwards (via a MUX chip) does not stop charging, but the Android device still cannot see the CDC device.
  3. Using an OTG->USB-C cable to the Android device enables it to see the CDC device, but of course cannot then charge the Android device. The Android device has no other means of charging.

So my question is, what is the minimum circuit to allow concurrent charging and connection between Android and a CDC peripheral via USB-C? Will I need to use a custom controller chip for this? I am trying to avoid adding a PD controller and circuit if possible, as it will more than double the BOM cost.

\$\endgroup\$

2 Answers 2

1
\$\begingroup\$

It has been my long term experience with Android devices that the device will be in an host mode when it needs to communicate to a CDC device. This is especially obvious when you use a typical USB to Serial cable that has the CDC service built into a customized MCU at the end of the USB cable. Such devices require the Android device to be in the host mode so as to be able to supply power to the USB cable. Obviously there is no chance of charging the Android device in this mode.

If you search on the web (intensive searching required) you can find some web pages where people have made claims that if you build a special splitter cable with the power coming in to the split cable from an external source that you can coax the device into working and get the Android device to charge. It supposedly requires a certain sized pulldown resistor on the ID line into the Android device. I have tried this and it is a lost cause and is not a general solution. It may happen to work with some specific manufacturers phones and tablets but it failed with the 20 or so Android test devices I have piled on a shelf in my lab.

One solution you may want to look into that will let an external device charge an Android device is to operate the external device according to the Adroid AOA protocol. (Android Open Accessory) You can implement the AOA protocol in an external microcontroller that has an USB connection. There are several manufacturers that have made application notes regarding this.

Alternatively you could take a look at the FTDI FT311 chip. This clever device implements the AOA protocol that the Android device will recognize and the can operate in a number of down stream ways including UART, SPI, GPIO and I2C. FTDI has an available small reference board that you can use to evaluate the technology and the FT311.

Note that most of the discussion I have given here centers around Android devices with micro-usb connectors. USB-C brings its own set of new twists to the party.

\$\endgroup\$
1
  • \$\begingroup\$ This is very useful thanks - as said I was attempting to use a simple pull-up on the CC lines, to avoid the extra cost of the whole PD controller and circuit. My assumption was that only USB-C was capable of concurrent charging and communication with a CDC peripheral. I will investigate the FTDI FT311 part, as I'm not opposed to using a micro-USB based tablet. \$\endgroup\$ Commented Jul 21, 2020 at 18:19
0
\$\begingroup\$

The way you are trying to setup your USB communication is the old way, i.e. according to the USB standards predating USB-C and USB Power Delivery.

In that setup, your device can either be charging or communicating but not both. In charge mode, the Android tablet must take the role of a USB device. When communicating with the USB CDC device, the Android tablet must take the role of a USB host. These two roles are mutually exclusive.

To achieve what you intend, you have to adopt USB-C (not just the plug) and USB Power Delivery, provided your tablet supports it. With these new standards a USB host (i.e. your tablet) can communicate with a USB device and charge at the same time (taking the additional role of a sink device). In this setup, the USB host and device use the CC1 and CC2 pins to negotiate which side provides power and how much.

However, implementing USB Power Delivery is a huge task. It requires a special USB chip (e.g. On Semi FUSB302) and a considerable software stack (in the order of 100 KB of compiled code). So it's far beyond the capabilities of an ATMega8u2.

I'm not familiar with Android AOA. But according to Michael Karas' description, it sounds like a easier route.

\$\endgroup\$
4
  • \$\begingroup\$ As said, I am using a pull-up on the CC line to initiate 500mA charging - I'm not basing this on pre USB-C tech, but my intention was to try to avoid using the whole PD controller and supporting circuit if possible due to the added BOM cost (practically doubling the cost of the device). I'm fully aware of the fact that the 8u2 cannot handle PD. Thanks. \$\endgroup\$ Commented Jul 21, 2020 at 18:21
  • \$\begingroup\$ Due the serial communication, the roles are fixed in your setup: The Android table is host, your PCB is the device. Without USB PD, power may only go from host to device, no matter how you wire the CC lines. \$\endgroup\$
    – Codo
    Commented Jul 22, 2020 at 5:58
  • \$\begingroup\$ R u sure this is an argument between USB-C PD and the "old way"? I see nothing in the docs that suggests the Android Open Accessory protocol is specific to USB-C/PD. From the overview it looks like the power can only come from an external source when the phone is implementing Accessory Mode. Are you saying otherwise? If so, where can we find documentation on this specific to Android? i.e. I am aware of the upstream/downstream roles of PD, but not specific to Android and how to initiate a data connections and accept external pwr. \$\endgroup\$
    – topher217
    Commented Jun 16, 2022 at 6:40
  • \$\begingroup\$ Say you implemented a USB-PD controller on your project and it negotiates to be the upstream facing port and provide power. Are you saying at this point the Android device can still remain in Host mode and negotiate a serial connection? Based on what I'm seeing in the docs, this is not possible. I think you still have to inform the Android device that you are a host implementing the Android Open Accessory protocol before the device will accept data transfer while charging. I'd love to be wrong about this, so if you have docs or evidence otherwise, I'd love to know how. \$\endgroup\$
    – topher217
    Commented Jun 16, 2022 at 7:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.