Serial Ports problem for Embedded guys in PC and laptops!!

So, its all about SERIAL PORT! and its problems for the Embedded guys.  All the stuff we come across usually have a serial port to interface or a USB port.  Older ones are usually having the Serial port to interact with as it is heavily cheap, a max232 and a few capacitors generally makes the work done under 20Rs. and voila! you are communicating serially!!!

Its really simple making the serial connections with any micro-controller 8051/AVR or PIC with such a cheap price.  Another thing “Arduino”, the open source hardware BOSS for 8 bit controllers has a USB support for it.

FTDI232 is the one which helps in interfacing the serial and USB in a real simple manner!!   Every other USB supported board uses it now, I guess.??

The modules in market like that of GSM/GPRS, RFID, GPS, Fingerprint scanner, Gyrosensor and a few other are easy to interface with serial connection as they send data over the serial line.  So, serial communication becomes quite important  to rely upon.

Most of the old motherboards gives the serial port as connector at the back(DB9).  The new ones don`t  provide the connector but a few do provide the connectors at the motherboard, You may click out some wires from the motherboard itself(another cheap way iff you got lucky to have the pin connectors ).

So, what to do if you got the new motherboard and FORTUNATELY  no serial port to work with.  (poor guy…)

You have got two options hereby,

  • purchase a usb to serial converter.
  • purchase a pci serial/parallel card.

Usb to serial Converter works easily i.e. OUT OF THE BOX; if you have got linux otherwise go and have fight with WINDOWS drivers :(…(lolz..) .  Do care while searching for the 64 bit drivers with Windows…(windows really SUCK..)

The second options is quite stable and reliable for PC case, and it gets into the CPU cabinet itself and you get a feel as if you have got a Serial/Parallel port.  These PCI cards comes in variation i.e. either two serial ports or a serial port and a parallel port etc. on a single Card.

You may already know that serial ports in linux are listed as /dev/ttyS* as hardware devices are also treated as device files.  So,  we`r  gonna learn to make the serial port work as it should be bcz. as usual the new hardware won`t be working directly.

So, we will be needing a few of the programs to make this all work.

Setserial and your favorite serial terminal program( mine is putty ) to work with.  First of all, how would I know that which of the serial device port is the working one as /dev/ttyS* shows a many.  Using, “setserial” command we will find the real serial port.


Debian based:                             apt-get install setserial

Red-hat based:                            yum install setserial

otherwise, you will as usual get the FEEL while installing it from the source

$setserial -g  /dev/ttyS*

will list the serial port interface available. In my case:

sh-4.2# setserial -g /dev/ttyS*
/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4
/dev/ttyS1, UART: undefined, Port: 0xc010, IRQ: 16
/dev/ttyS2, UART: unknown, Port: 0xc000, IRQ: 16
/dev/ttyS3, UART: unknown, Port: 0x02e8, IRQ: 3

The two devices showing the same IRQ number must be from a same hardware i.e. my PCI card. Now we need to initiallise the port and make it work!!! The first device i.e. /dev/ttyS0 is labelled “16550A”, the controller IC of UART just as the 8042 for keyboard..(obviously I love hardware ….:)

The ttyS0 port is there on the board but just not given the connectors to interact with in most of the case otherwise you wont be having ttyS0 port labelled as 16550A.

So, how to make it work now!! Ugh, you should not dare to use the CD provided with it…lol…it wont work for obvious reasons…^_^  You may give a try to the README with it and put the object files in the mentioned places and wait for nothing…(atleast I was ….. can`t guarantee for you..but its what I have seen with most of the PCI cards).

What all is needed for the serial port to work is just to make the machine know that it is the port containing the 16550A UART controller, so just use it as there is some problem with most of the PCI cards that they are not able to automatically make the settings in linux.  So, if you read to like the man page of setserial it specifies to change the “uart” to any type that you want to configure.!!

Commands which does the magic is:

$setserial  /dev/ttyS1 uart 16550A

ttyS1 in my case as guessed from the above mentioned…

Setserial works with superuser rights only.

Simply use the serial port as configured just now using any of the serial port software like putty.

About Beyond

an electronics hobbyst, 8 bit microcontroller(8051/AVR/Arduino) programmer, Linux lover, in love with Embedded Linux systems ... TGL: just push it "BEYOND THE LIMITS"..

Posted on August 1, 2012, in Embedded Systems, Linux and tagged , , , , , , , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s