232 - serial - USART - UART

Search This thread

d1mbu1b

Member
Jan 25, 2010
29
2
anyone know if there is a serial port hidden anywhere.
The PSP has one in the earphone jack and the iphone has on pinned out in the connector.

I searched high and low for the Nexus One pinout/schematic cant find it.
(probably right in front of my face)

I did see /dev/console and /dev/ttyHS0 and console but I dont know what that is.

Any pointers would be appreciated.
 

swetland

Senior Member
Jan 7, 2010
103
44
Mountain View, CA
android.com
anyone know if there is a serial port hidden anywhere.
The PSP has one in the earphone jack and the iphone has on pinned out in the connector.

I searched high and low for the Nexus One pinout/schematic cant find it.
(probably right in front of my face)

I did see /dev/console and /dev/ttyHS0 and console but I dont know what that is.

Any pointers would be appreciated.

TTL level (~3.3v?) serial is present on the D+/D- pins of the micro USB connector whenever VBUS (usb +5v power) is not present. This is physical UART1 (ttyMSM0). In standard builds the FIQ kernel debugger runs there. You'll have to disable the FIQ debugger and enable the serial device in your kernel config if you want to use it as a regular serial port.
 

d1mbu1b

Member
Jan 25, 2010
29
2
You'll have to disable the FIQ debugger and enable the serial device in your kernel config if you want to use it as a regular serial port.
Thank you for the info.
Is this a kernel compile time or run time configuration?

http://www.instructables.com/id/Android_G1_Serial_Cable/Obviously you need a micro usb cable instead of mini, but this should work I think. I'll let you know when my serial adapter shows up.
thanks for the link. If Im not mistaken you may be able to eliminate a lot of this by splicing an existing micro USB cable with a MAX232 cable, will need to verify D+/- can handle 0-5 volts instead of 0-3.3v
Motorola T 191 serial cable
t191cable_817.jpg

http://www.yoreparo.com/foros/files/t191cable_817.jpg
I can't tell is thats a 5 or 3 volt zener in the schematic
 
Last edited:

d1mbu1b

Member
Jan 25, 2010
29
2
One zener is marked 5V, the other two are 3V3 which means 3.3 volts.

So it seems that one can simply splice the existing T191 and micro-usb cables and have a working adapter. I will be trying this when I get a chance.

The open questions are:
1) are the D+/- actually 3.3v levels
2) how is the kernel configuration performed to get /dev/tty?S?0
 

d1mbu1b

Member
Jan 25, 2010
29
2
measured AM601 T191

tx is generating a 0-1.9v waveform at 19200 and 115200 and it took about 1 ms to charge the cap and start clocking data.
 

rotohammer

Senior Member
Jan 2, 2007
1,386
1,066
New Jersey
The open questions are:
1) are the D+/- actually 3.3v levels

USB signals are typically 3.6v, but the phone hardware may have a circuit to switch from USB to TTL serial. Regardless, the 3.3v zeners will give the MAX232 a nice flat topped square wave signal to work with.

Typically, to get a console on a serial port, you just specify a kernel boot option, or edit an entry in /etc/initab file. I'm not familiar the specifics of the android kernel though.
 

d1mbu1b

Member
Jan 25, 2010
29
2
I ended up with this one.http://www.sparkfun.com/commerce/product_info.php?products_id=718snipped a usb cable and soldered it together. Works well.

This data sheet says it implements the enture USB protocol on the chip.
Does this implement a USB host for the nexus one device?
I am confused.
I see there is a fuse and 5v connected to the USB 5v.
This implies the N1 is emulating a UART over the USB interface
and not clocking UART 232 over these same pins.

So my question is this an emulated 232 serial interface on the N1 or a UART in the N1 clocking 232 over the microUSB pins 2 and 3?

Please let me know what SW configuration you did on the N1 and what was the resulting name of the serial port in /dev/tty*
Thank you
 

d1mbu1b

Member
Jan 25, 2010
29
2
WARNING - dead battery

seems once I played with the serial port the battery stopped charging even after applying the stock usb cable/charger

still trying to figure out.
for now recommend rebooting, then making surge charge bolt is in battery
 

nilstk

New member
Mar 3, 2010
1
0
@ jairuncaloth

Is it necessary to have root access to the phone for your solution?
Are any special drivers needed or is it possible with the builtin ones?

Can I just use /dev/ttyS0 then via NDK or preferable via a function of the Android API ?

Thanks.
 

hugonz

Member
Dec 28, 2006
43
0
TTL level (~3.3v?) serial is present on the D+/D- pins of the micro USB connector whenever VBUS (usb +5v power) is not present. This is physical UART1 (ttyMSM0). In standard builds the FIQ kernel debugger runs there. You'll have to disable the FIQ debugger and enable the serial device in your kernel config if you want to use it as a regular serial port.

Can you/someone confirm it is 3.3V? Not 1.8V?
 

dl9pf

New member
May 22, 2010
1
0
TTL level (~3.3v?) serial is present on the D+/D- pins of the micro USB connector whenever VBUS (usb +5v power) is not present. This is physical UART1 (ttyMSM0). In standard builds the FIQ kernel debugger runs there. You'll have to disable the FIQ debugger and enable the serial device in your kernel config if you want to use it as a regular serial port.


Whats the mapping D+/D- <-> RXD/TXD ? e.g. green -> RXD white -> TXD or vice versa ? .
 

dcordes

Retired Senior Recognized Developer
Nov 20, 2007
707
254
TTL level (~3.3v?) serial is present on the D+/D- pins of the micro USB connector whenever VBUS (usb +5v power) is not present. This is physical UART1 (ttyMSM0). In standard builds the FIQ kernel debugger runs there. You'll have to disable the FIQ debugger and enable the serial device in your kernel config if you want to use it as a regular serial port.

I don't see how you need any adaptor if this is correct. Can you not just connect the D+/D- and gnd wires from some off the shelf micro usb plug to db-9 plug ?


edit: ok got it it's all about shifting the voltage levels up
 
Last edited:

keener2u

New member
Jul 3, 2007
2
0
I was able to create a cable using the sparkfun ft232r cable. After turning off FIQ and SERIAL_CONSOLE_DEBUGGER in the kernel I now have a command prompt and a bunch of kernel printlns out. How do I mute these kernel outputs and the command prompt? I want to use the serial port to communicate with a micro-controller using cat and echo to /dev/ttyMSM0 but all the noise from the kernel prevents me from having the microcontroller read the serial port without filtering out junk. Below are a few of the lines that I receive on the port.
--------------------------------
[ 102.658782] batt: 60%, 3889 mV, -7 mA (-5 avg), 24.5 C, 808 mAh
[ 102.717681] suspend: enter suspend
[ 102.718658] PM: Syncing filesystems ... done.
[ 102.777770] Freezing user space processes ... (elapsed 0.01 seconds) done.
[ 102.798736] Freezing remaining freezable tasks ... (elapsed 0.01 seconds) don
e.
[ 102.828948] PM: suspend of devices complete after 9.603 msecs
 

dcordes

Retired Senior Recognized Developer
Nov 20, 2007
707
254
I was able to create a cable using the sparkfun ft232r cable. After turning off FIQ and SERIAL_CONSOLE_DEBUGGER in the kernel I now have a command prompt and a bunch of kernel printlns out. How do I mute these kernel outputs and the command prompt? I want to use the serial port to communicate with a micro-controller using cat and echo to /dev/ttyMSM0 but all the noise from the kernel prevents me from having the microcontroller read the serial port without filtering out junk. Below are a few of the lines that I receive on the port.
--------------------------------
[ 102.658782] batt: 60%, 3889 mV, -7 mA (-5 avg), 24.5 C, 808 mAh
[ 102.717681] suspend: enter suspend
[ 102.718658] PM: Syncing filesystems ... done.
[ 102.777770] Freezing user space processes ... (elapsed 0.01 seconds) done.
[ 102.798736] Freezing remaining freezable tasks ... (elapsed 0.01 seconds) don
e.
[ 102.828948] PM: suspend of devices complete after 9.603 msecs

Hi

Take a loot at your kernel cmdline. I don't know where it is set in android. It should have something like 'console=/dev/ttyMSM0' Try removing it


Can somebody detail on the nexus pinout when in serial mode? I need to know which of the data pins is TXD, which is RXD ?

RED=+5V WHITE=??? GREEN=??? BLACK=GND

tia
 

keener2u

New member
Jul 3, 2007
2
0
Using this diagram as a reference
kineteka.com/microusb-b.aspx
2 Data − is hooked up to tx-0
3 Data + is hooked up to rx-i

Unfortunately I tore apart a best cell list cable and reused the micro-plug. It looks like they don't follow standards for wire color so i can't give you the correct color out to each wire but if you use a meter and check continuity you should be able to figure out the wire color from the above pin out.