Serial debugging/Cable schematics: Difference between revisions
Line 95: | Line 95: | ||
See http://elektranox.org/2017/02/0009-droid-4-root/ | See http://elektranox.org/2017/02/0009-droid-4-root/ | ||
and http://muru.com/linux/d4/ | |||
== Sony Xperia == | == Sony Xperia == |
Revision as of 23:42, 21 April 2018
Some phones have a serial port accessible from the outside, this makes debugging boot problems way easier since you can see the boot messages from the bootloader and the early kernel stuff. For example the whole nexus range has serial debugging through the headphone jack.
Nexus debug cable
The nexus phones multiplexed the serial debug lines with the headphone audio lines. To switch it into serial mode you have to supply -3V to the mic port. The uart lines themselves are 1.8V. If you use a 3.3V usb-to-uart adapter the signal from the phone will probably work, for the TX side you have to add a resistor divider to lover the voltage for the phone. Here's the schematic for a nexus debug cable:
This cable has been tested with:
- Nexus 5 hammerhead
- Nexus 5x bullhead
It should work fine with:
- Nexus 7 2013 (flo)
The Nexus 7 2012 (grouper) does not work with this setup and likely does not have any serial UART capabilities at all.
Google open sourced their own debug cable design in the AOSP repository.
Samsung USB debug cable
The Nexus S, Galaxy Nexus and other Samsung devices have the serial port multiplexed with the USB connector instead of the headphone connector. This is the schematic for those devices, For this cable too it's important to have a 3.3V usb-to-uart adapter.
It should work with:
- Nexus S
- Galaxy Nexus
- Samsung GT-I8190 (Galaxy S3 mini)
- Samsung GT-I5800 (Galaxy 3)
- Samsung GT-P1000 (Galaxy Tab P1000)
- Samsung GT-S8500 (Wave)
- Samsung i897 (Captivate)
- Samsung GT-i9195 (Galaxy S4 mini)
- Samsung klte (Galaxy S5)
Serial Settings | ||||
---|---|---|---|---|
Speed | Data bits | Stop bits | Parity | Flow control |
115200 | 8 | 1 | No | None |
Device | Codename | Connection | |
---|---|---|---|
Resistor (R3) | Connected VCC | ||
Google Galaxy Nexus (GSM) | samsung-maguro | 619K ohm | No |
Samsung Galaxy Mini 2 | samsung-s6500d | 530K ohm | No |
Samsung Galaxy S4 Mini LTE | samsung-i9195 | 619K ohm | No |
Samsung Galaxy S5 | samsung-klte | 619K ohm | No |
Mozilla Flame
The Flame has open UART pads that are accessible underneath the outer and inner covers.
- TX - red
- GND - green
Pull-ups/downs are unneccesary, hook straight up to any FTDI/USB-to-serial.
Nokia N900
See the following links:
- http://n900.elektranox.org/serial-adapter.html
- http://wiki.maemo.org/N900_Hardware_Hacking#Debug_ports
Motorola Droid 4
A off-the-shelf USB-TTL Adapter with 3.3V signal level can be used together with a MicroUSB connector to access the phone's UART. By using a standard MicroUSB <-> USB A cable and just combine a USB jack with a cheap chinese USB-TTL adapter is space-saving and allows you to use the same MicroUSB cable to access the device in USB mode
See http://elektranox.org/2017/02/0009-droid-4-root/ and http://muru.com/linux/d4/
Sony Xperia
See this page, and that one (basically a new formatting for the same page, as of 2018-02-21, but that might might change soon)
Alternatives to a serial cable
There might not be a need for a serial cable if you think it is too complicated to make one for your device (although it is much more convenient when it works). From there, about the Google Nexus 7 2013 (asus-flo):
If you cannot get it booting you will need to reboot into recovery and check /proc/last_kmsg for the errors. Or try and build the UART cable (which I failed at)
Also, a sony employee gave an alternative method here, that might be worth a go:
Unfortunately the only way to access the serial port is to open the device but.... You have the other option to debug - pstore: 1. flash an aosp recovery image with a working kernel to the recovery partition 2. to flash your new kernel on the main partition and boot After your new kernel crashes keep volume down pressed and you will boot the working kernel from the recovery partition. From recovery you have access to adb and you can extract the logs from pstore
Finding the serial port on your device
Sometimes there is no other solution but to poke at random motherboard pins to find the serial port. This is mostly a lucky process, but you can:
- send either garbage, or a repeating pattern to the serial port at
/dev/ttysomething
(if you have a kernel where it's working), and then try to find the tx pin with a scope.- If you can't, you can also reboot your phone and hope it writes something during boot (but that's really trying luck)
- tx is usually good enough for debugging, but rx should be quite close, with a high impedance, or more likely a pulling resistor.
- a pull-up or pull-down resistor will make the pin look like gnd or vcc
Soldering a connector on your device
This can be a bit involved, but is generally necessary if you want to use it:
- This procedure is dangerous for your device, even more so if you are not very experienced
- Prefer to ask help in a fablab or similar you'll practice another day on something easier
- If you have to solder it yourself, it's probably a good idea to practice on an old motherboard before
- Prefer soldering short cables to the PCB instead of full-length ones
- The smaller (diameter) the cables, the better, generally
- too long or too thick and the pads you have soldered risk being teared apart by the cables
- too small and it will be a hassle to work with
- The best is to have them a couple (4-8) centimeters long, to solder them, solder a connector on the other end, and scotch tape them to the pcb
- Please, don't forget to pick insulated wires