Electronic – Connecting CDC device to Android over USB-C, with concurrent charging. A cheap option

androidmicrocontrollerusbusb device

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.

Best Answer

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.