Similar to some Nexus models, Google Pixel (/XL) devices multiplex audio and the UART port signals through the 3.5mm audio port. The UART console can be used to view kernel console messages or for kernel debugging (i.e., kgdb over serial).
In order to activate the UART port, 3.3V should be applied to the sleeve of the TRRS connector. The TRRS connector (stands for Tip-Ring-Ring-Sleeve) is a standard audio connector used in most mobile devices and laptop ports that combine audio / mic functionality. There are 4 conductors (2 for stereo audio, 1 for mic, and a ground):
When 3.3V is applied to the sleeve conductor, the audio port switches to the UART mode. The following parts are required to build the debug cable:
- USB to TTL serial cable / adapter. We are using a 4-pin TTL cable based on the FT232 chip.
- TRRS connector breakout board or a terminal block as shown above. You can also get a standard TRRS 3.5mm jack plug and solder TTL wires directly.
- A couple of resistors for a voltage divider (see below).
The basic schematic for wiring the TTL cable to the terminal block / breakout board is shown below:
Depending on the TRRS breakout board / connector, T-R1-R2-S pinouts might be different or marked something like L (left audio channel), R (right audio channel), blank (generally microphone), etc. To find out the right pinouts, refer to your connector schematic or do a continuity test(provided by most multimeters). For example, the marking on the terminal connector below are Ground, blank, L, R but on the connector schematic, these connectors are Sleeve, Ring 2, Ring 1, Tip:
The above configuration will work (both TX/RX lines were tested on a Pixel device) but the RX / TX signals provided by the Pixel UART are actually 1.8V. The FTDI chip on the other hand is 3.3V (most off-the-shell UART adapters are either 3.3V or 5V). FTDI RX line will work fine with the 1.8V signal from the Pixel device. However, the TX signal ideally needs to be regulated to 1.8V. There is probably no need for a voltage regulator and a simple voltage divider should be sufficient:
The last step is to reboot the device into the fastboot mode and enable UART (configured as 115200n8
with no hardware flow control):
# adb reboot-bootloader # fastboot oem uart enable
In order to enable UART, the bootloader obviously needs to be unlocked in the first place.