[Nexus 7 (2013) General] k23m:
​

Universal Asynchronous Receiver Transmitter

on previous Nexus models was really easy to use but our flo has a flaw - the bootloader prevents UART initialization on a booting kernel. To work around this limitation developers either had recompiled the stock kernel or changed boot config parameters and reassembled bootimg. However these options are not available on stuck and faulty units or in bootloops, where a look at dmesg log would most likely reveal the problem.

So I was checking some enigmatic lk (little kernel) messages in source code and text strings in "bootloader-flo-flo-04.05.img" when I noticed "oem uart-on" in the context of fastboot code. As I had a UART adapter already hooked up, I just typed "fastboot oem uart-on" and my Nexus immediately reacted, rebooted and logged the following (abbrev):

...
[427740] fastboot: oem uart-on
[427740] OdmData=0x6
...
Android Bootloader - UART_DM Initialized!!!
[0] welcome to lk
...
[820] UART is enabled!
...
[860] Machine FLO was detected
[ 0.000000] Booting Linux on physical CPU 0
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Linux version 3.4.0-cyanogenmod-g8a4918a (build01@cyanogenmod) (gcc version 4.8 (GCC) ) #1 SMP PREEMPT Tue Nov 17 02:00:34 PST 2015
[ 0.000000] CPU: ARMv7 Processor [511f06f0] revision 0 (ARMv7), cr=10c5387d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
[ 0.000000] Machine: QCT APQ8064 FLO
[ 0.000000] Truncating memory at 0x90000000 to fit in 32-bit physical address space
[ 0.000000] cma: CMA: reserved 8 MiB at af800000
[ 0.000000] memory pool 3 (start 0xfe100000 size 1e00000) initialized
[ 0.000000] Initialized persistent memory from 88d00000-88dfffff
[ 0.000000] cma: CMA: reserved 16 MiB at ab800000
[ 0.000000] Memory policy: ECC disabled, Data cache writealloc
[ 0.000000] socinfo_init: v7, id=172, ver=2.0, raw_id=2289, raw_ver=2289, hw_plat=8, hw_plat_ver=65536
[ 0.000000] accessory_chip=0, hw_plat_subtype=0, pmic_model=18, pmic_die_revision=4
[ 0.000000] allocating 44236800 bytes at c30df000 (832df000 physical) for fb
[ 0.000000] PERCPU: Embedded 8 pages/cpu @c5b12000 s16768 r0 d16000 u32768
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 476163
[ 0.000000] Kernel command line: console=ttyHSL0,115200,n8 androidboot.hardware=flo user_debug=31 msm_rtb.filter=0x3F ehci-hcd.park=3 vmalloc=340M androidboot.emmc=true androidboot.serialno=087888a4 bootreason=Reboot fuse_info=Y ddr_vendor=hynix androidboot.baseband=apq asustek.hw_rev=rev_e androidboot.bootloader=FLO-04.05
[ 0.000000] HW Revision: ASUSTek input rev_e
...

A complete boot log is now available on

untouched boot.img

! Can you see the seamless log transition from the little kernel to the big one? The "fastboot oem uart-on" command did change bootloader variables and now it always boots with UART enabled, getvar reports:

(bootloader) version-bootloader: FLO-04.05
(bootloader) version-baseband: none
(bootloader) version-hardware: rev_e
(bootloader) version-cdma: N/A
(bootloader) variant: flo 32G
(bootloader) serialno: 087888a4
(bootloader) product: flo
(bootloader) secure_boot: enabled
(bootloader) lock_state: unlocked
(bootloader) project: flo
(bootloader) off-mode-charge: yes
(bootloader) uart-on: yes

Presumably, "fastboot oem uart-off" would disable UART again.

I uploaded the full boot log here.

Let me repeat, UART is not only for developers, it is also a fantastic diagnostic tool for both hardware and software issues. While you can not buy a Nexus-specific UART adapter, it is quite easy to make - have a look at the attached schematic diagram. I did not have a FT232R IC and used an insanely cheap PL2303 general RS232-TTL-USB adapter from a different project. This PL2303 is most likely a fake and does not comply with 1.8V-level specs but I was able to get it going on a simple voltage level translator made of discrete components (att.).

​

I also discovered an alternative UART interface on the JTAG header but it is much harder to connect to of course.

What happens next depends on your host platform. On Windows you have to install a driver for FT232R/PL2303/etc, note a new COM port number and then use a terminal app like e.g. Putty.

Note - if UART is not activated with the above fastboot command, then the default speed after booting will be 9600, not 115200bps. To speed it up type stty -F /dev/ttyHSL0 115200 in an Android terminal app.

Don't hesitate to ask any questions on this subject.

:good: