UART

A UART or serial console is absolutely essential when doing bootloader or kernel development on any computer. Due to the lack of a standard PC BIOS and the VESA BIOS that goes with it, access to the serial console on ARM devices is even more important than on the PC. Even if you do not intend to do much u-boot or kernel work, access to the serial console will be a life-saver when anything goes wrong. =UART-USB dongle= Currently, all of the available sunxi hardware requires a 3.3V UART. If you buy a voltage stepper module you might get away with attaching it to the serial port of your IBM PC (RS232), but this is rather cumbersome. It is much much easier to just buy a 3.3V USB UART module. Popular chips for such modules are the Silicon Labs CP2102 and the Prolific PL2303HX (the standard PL2303 chip is 5V/TTL only), which are both cheap and relatively easy to find.

Just search for "CP2102" or "PL2303HX" on your favourite online retailer or auction site, and you should be ok, though you might run into non-working ones too:


 * WARNING: User:Plaes got 5 non-working CP2102 USB to USART modules from ebay user "haoyu_electronics"

=Using the serial console=

Once you hook up your usb module to your host, you should see the following, amongst others, appear in your syslog: usb 1-1.3: cp210x converter now attached to ttyUSB0

Now you know what tty your UART is connected to, and you can now use it through, for instance, screen: screen /dev/ttyUSB0 115200

Be sure to set the baudrate to the maximum of 115200, otherwise your console might not function reliably.

=Attaching the UART=

With a UART connector available
If you are using a development board, or a device like the Mele A1000, you should have a nice connector available for attaching your UART module to. If you are extremely lucky, the pin functions will even be printed on your board. Many will not be so lucky, especially with tablets. How to deal with those tougher cases is described below.

Your USB UART module should have the GND (ground), RX (receive) and TX (transmit) pins clearly labeled. These are the only three pins that you should connect to your device. Do not connect the VCC or 3.3V/5V pin, as that will damage your device!

If it is not clear which pins are which on your target, use a multimeter to determine GND and Vcc. You can do this by measuring the voltage difference between, for instance, shielding of a USB connector, and the UART pins, on a running device.

If you have wired things up correctly, you should now be able to type into your serial console (ie. screen) and see at least your own typing echoed back to you. If this does not work, try swapping RX/TX around. If you are lucky, you might have access to a shell straight away. If not, it pays to reboot to see the initial u-boot messages scroll past.

Without a UART connector
Finding the UART pins on a device not meant for development might get quite tricky. It involves disassembling your device with great care, some basic (logical) troubleshouting, some soldering, and then some creativity to be able to export your serial connection to the outside world.

'''You will be seriously voiding your warranty here. The likelihood of being left with a damaged device is very high. You might even totally destroy your device. So you need to be extremely careful.'''

'''Like with everything on this wiki, you yourself are responsible for the actions you take. If you do damage or destroy your device, it's your own fault.'''

If you do want to risk damaging or destroying your device, then this howto is not for you. If you are not comfortable with disassembling your device, soldering wires to it, or are lacking some of the necessary equipment, get someone else to do it for you, or don't do it at all.

Necessary tools and skills
You need some very basic electronics equipment. A multimeter, your usual collection of banana plug cables, probes and hirschmann clamps, a fine soldering iron (temperature controlled preferred), good solder and flux.

You will also need some jumper wires, which are easily scrounged off of an old PC case. Preferably black, green and white, in a triple housing.

Disassembling the device
Disassembling your device is outside of the scope of this document. By using google, you might be able to find someone who has already taken your device apart, and see the process documented on some android forum. Failing that, there are tons of tablet disassembly guides on the likes of youtube.

You probably need to be able to access the backside of the motherboard as well, so make sure that the board is free. Do not cut any wires, you will need your device to work, even when all of it has been laid bare.

Inspect the mainboard
Often times, you can get lucky, and the UART can be spotted easily. The Hyundai A7HD is a great example of that as it has a full serial port on big pre-tinned pads available. In case of the Coby MID7042, due to the limited number of testpads, and the way they were grouped, it was also clear which were the UART pins.

When you are not so lucky, you get presented with a motherboard with a big load of test-pads. This leaves you no option but to systematically try each one of them.

Regardless of whether the connections are easy to find or not, you still pretty much need to run through the procedure as listed below.

Attaching the UART module
Boot your device, and get the original OS running.

Attach your UART module to your host PC and run your console program on it.

Connect GND of the UART module to a convenient ground location on your board, and attach a probe to RX of the UART module.

If you now touch the probe to ground, you should see some broken characters appear on your console program. If not, check whether GND is wired up correctly, or swap RX/TX around on the module side.

Make some noise
Normally, your device will only sporadically send data out the serial bus, so the chances of seeing any text scroll past on the console, is pretty low.

A small tool called serial_noise is available, and it is statically compiled and verified to run on many android systems (source code is available here). Download it to your device, and run it.

When serial_noise has successfully started, and has found serial consoles in /dev/, it says: Flooding serial consoles with text... It will then be sending the /dev/ device names out to all the detected serial consoles on the system.

Find TX
You can now go and carefully touch the testpads with your probe, for a few seconds each until you see a device name scroll past. From time to time, verify that your setup is still working by sending some garbage to your hosts console program by touching ground with your probe.

Find RX
If or when you have found TX, you should find RX nearby.

Attach a second probe to the TX pin of the UART module.

With the other probe on the TX pad on the device still, you can now go and probe for the RX pad.

The easiest way to verify this is to touch a pad with the probe, and then typing things into the console program on your host computer. If you see your characters echoed back, then you have successfully located the RX pad.

Cable routing
Before you solder on the jumper wires, figure out how to get your serial connection available to the outside world.

With space at a premium in any mobile device, it is not easy to find a good solution here. The punishment for bad routing is quite severe. Your device might not close anymore, and there might be pressure on your devices LCD, leading to uneven backlighting and colours. So do care take care at this stage.

A good example of bad routing and the damage that it causes can be seen on the Hyundai A7HD page.

Make a point of clearly marking which wire is GND by using a brown or black wire for it. If you use jumper wires from an old PC case, try use a triple connector to make life easier in future.

Soldering the jumper wires
The usual recommendations for small electronics soldering apply.

Reassemble your device
And if all goes well, you should now have a tablet with something strange hanging out. You should be able to attach your UART module to it directly, fire up your console program and immediately get a console.

Now you can do low level development on your tablet, even when on the move. Just don't bring it up in a conversation with normal people if you still want them to respect you afterwards.