HOWTO: Testing Serial Ports under Debian Linux
Purpose: This blog entry explains how you can determine whether your Serial Ports on your system works or not under Debian Linux.
Requirements:
- Two computers running Debian Linux
- At least one Serial Port on each of the computer
- A Serial Cable that runs from one computer (Computer A) to another computer (Computer B) with proper gender at both ends.
- Serial Port driver available in the Kernel. Almost all the kernels have it configured in them.
- Software: minicom & setserial (if required)
Install the software by giving commands:
#apt-get update
#apt-get minicom setserial
Basics:
Before we begin, it is important to know that your Serial Ports (COM1 and COM2) are named as /dev/ttyS0 and /dev/ttyS1 respectively and so on.
BIOS configuration: It is important to first check your BIOS and see if Serial Ports are disabled or not. If they are disabled then please enable them and assign them proper IRQ before you proceed.
The BIOS default settings are as follow:
COM1 – 0x3F8 = IRQ4
COM2 – 0x2F8 = IRQ3
Almost all the BIOSes have the above setting. Therefore, there are very less chances that you will have to modify those in the BIOS.
Tell me how to test now?
Step 1: Connect both the serial port of computer A to serial port of computer B using the Serial Cable.
Step 2: Check if Linux detects your Serial Port or not
There are many ways to do that. One way you could do is to give the following command:
# dmesg | grep ttyS
You should see something like this:
serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
serial8250: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
00:09: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
00:0a: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
The above output shows that your COM1 and COM2 ports are available and Linux recognizes them.
Another way to test is to give the following command:
# ls > /dev/ttyS0
If the command does not return any error message then your Serial Ports are recognized by your Linux system.
Errors?
In case, Linux does not detect your Serial Port, then try giving the following command:
setserial /dev/ttyS0 autoconfig auto_irq
Substitute ttyS0 with ttyS1 as required.
Step 3: Configure your Serial Ports
Launch the minicom program from your terminal and input the following settings after navigating through the minicom menu (Ctrl A -Z):
Select the device: ttyS0 or ttyS1 (Depending on whatever device name is being assigned to your serial port)
Buad Rate: 57600
Bits per second: 8
Parity: None
Stop Bits: 1
Hardware Flow Control: Yes
Software Flow Control: No
Here is an example of the settings:

Once you configure your Serial Port with above parameters, you are ready to start communicating between the two computers through Serial Connection.
Step 4: Start communicating
Before you can start communicating, you need to perform the Steps 2 and 3 on your other computer also. Once you do that you should be in a state where you have minicom window in front of you on both the computers.
Now start typing some characters from computer A (in your minicom window typing screen) and you should see those characters appearing auto-magically on your computer B. For example like this:
Errors?
Note: In some case, you might get an error as follow as soon as you try to launch “minicom” program:
#minicom
minicom: WARNING: configuration file not found, using defaults
Device /dev/modem access failed: No such file or directory.
All this means is that you need to pass on the flag -s when you launch minicom like this:
#minicom -s
Once you do that you should be able to select your serial port device and other parameters.
That’s it! You have successfully detected and tested Serial Ports on Debian Linux.
If you are further interested in this topic, then I high recommend you to read the following articles:
- http://www.cpqlinux.com/serialconsole.html
- http://www.vanemery.com/Linux/Serial/serial-console.html
As usual, please leave a comment/feedback if you have any. Comments encourages bloggers to post more and keep their spirits high.
Learn how to redirect Linux console messages over Serial Ports on another machine.



Email Subscription









August 5th, 2008 at 7:11 am
Thanks for Sharing!
Reply to this comment
September 24th, 2008 at 6:06 pm
good site izuetr
Reply to this comment
October 15th, 2008 at 1:08 pm
Well I am communicating with a single board computer(SBC) a PC104 using linux. Everything was going fine with minicom and suddenly it initiallized the modem through serial port ttyS0 and when I switch on the SBC it doesn’t load ?? any suggestions ? Thank you
Reply to this comment
Kushal Reply:
February 20th, 2009 at 12:22 am
Can you explain your problem in more detail? Between which two computers are you communicating? Is your SBC a PC/104 embedded computer? Which distro are you running on it?
Reply to this comment
March 29th, 2009 at 8:01 pm
[...] messages to a serial port on another computer. In one of my previous post, I had explained how to test serial ports under Linux. I highly recommend that you read it first before you read this post any [...]
March 31st, 2009 at 8:46 am
you have a typo in command:
# ls > /dev/tyS0
will always return error … ttyS0 works better
Reply to this comment
Admin Reply:
March 31st, 2009 at 9:06 am
Hi Kaii,
Thank you for pointing out the typo. I have now corrected it.
Reply to this comment
June 30th, 2009 at 11:11 pm
This is my first visit to your blog and found it very informative.
Reply to this comment
November 25th, 2009 at 3:03 am
Hi
I tried this using two windows system with Vmware having ubuntu images.
step 2: gives proper information ( # dmesg | grep ttyS)
i am using minicom under thus ubuntu image in VmWare , but unable to get any updates from serial port .
like i do
1)setting for serial port , save settings as dfl ,
and then the minicom runs ,
2) from other shell i do ls > /dev/ttyS0 but nothing comes on minicom console .
i expect the return string from ls should be displayed on minicom console , but that doesnt happen.
Any idea what could be the issue ?
Reply to this comment
December 3rd, 2009 at 7:25 am
Great read! thx
Reply to this comment
May 31st, 2010 at 4:16 am
Platform – Ubuntu 9.10 on Windows Xp ( Toshiba Te2100 laptop),
when I do #dmesg | grep ttyS
I get two instances of ttyS0 with same irq = 4, I/O 0x38f,
One says serial83250 , other one just gives no port description but, 00:09 ttyS0
Ps numbers at the begining are different
Question 1 is it two programs trying to access ttyS0?
question2 PS shows only one active bash process.
Can some one help me please? I am trying to get minicom up and running.
Reply to this comment
July 5th, 2010 at 7:30 pm
That was a great post. It is
very easy to follow even for
newbies.
Reply to this comment
July 19th, 2010 at 9:20 am
Nice article. Helped me find out if my linux machine detected the serial ports. Apparently, my serial ports were called ttyD0 and ttyD1 instead of ttyS0 and ttyS1. I’m guessing it was the serial port driver that renamed it. Anyways, thanks for the article!
Reply to this comment
September 13th, 2010 at 7:27 am
Hi,
I have followed all instructions but not getting any charcaters on any machine can you please help me. I have debian lenny machine.
regards
Reply to this comment
February 3rd, 2011 at 10:22 pm
Hi,
Nice article,thank you.
Can you write about communicating between 2 linux without minicom.
I want to chat(text) to another linux.
Easy example please.
Reply to this comment
February 10th, 2011 at 2:19 am
I have 2 servers (server1 and server2)
I have started minicom on both.
If I type in the console of server1 the output displays on server2
If I type in the console of server2 nothing appears on server1
Is this what you would expect??
Regards
Sean
Reply to this comment
April 6th, 2011 at 12:06 pm
[...] couple of potential useful serial port test links: How To Check and Use Serial Ports Under Linux Testing Serial Ports in Linux | Debian Ubuntu Linux Solutions Blog Reply With Quote + Reply to [...]
July 26th, 2011 at 6:04 pm
Hi there, I enjoyed 301 Moved Permanently. It was good. View my blog sometime, it all about Sanford, FL Real Estate.
Reply to this comment
September 26th, 2011 at 7:30 pm
[...] Testing Serial Ports in Linux | Organizing Linux Information! ????? linux ???? hylafax??????????? ← apache?? VPN???? → [...]
September 28th, 2011 at 5:15 am
Thanks for sharing.I have one doubt, in my system when i gave this command “dmesg | grep ttyS” i got the same which you mentioned in the top. when i gave the command “minicom -s” and in serial device as: “/dev/ttyS1″.i didn’t get any errors and whatever i’m typing there i’m not getting.Can i know what was the problem?
Reply to this comment
October 9th, 2011 at 10:28 pm
Thanks for your cordial wishes. This topic is effective and helpful for my study. Again thanks.
Reply to this comment
December 6th, 2011 at 2:04 am
I wanted to use a USB-to-Serial adapter.
“dmesg | grep ttyUSB” showed me what it was called (ttyUSB0)
Reply to this comment
April 19th, 2012 at 11:39 pm
I too want to use USB to Serial cable to connect my Debian Linux host to a target board. It seems it did not automatically detect the cable. Can anyone explain the procedure to make my usb to serial cable work in my Linux system. It should be detected as ttyUSB0 so that I can configure in the minicom to /dev/ttyUSB0
Reply to this comment
June 2nd, 2012 at 3:40 pm
Thanks, I did my first steps with this tuto. I have configurated minicom to use my usb-serial convertor and it work.
Reply to this comment
June 22nd, 2012 at 12:23 pm
Thank you for any other informative web site. Where else could I am getting that type of info written in such a perfect approach? I have a project that I am simply now operating on, and I’ve been on the look out for such information.
Reply to this comment
June 26th, 2012 at 7:12 pm
[...] Testing Serial Ports in Linux | Organizing Linux Information! ????? linux ???? hylafax ? jerry???????? [...]
January 1st, 2013 at 9:41 am
[...] with hardware flow control Everthing is plugged in and I am pretty sure the cable is good. I did this and was able to type on one machine and have it show up on the other. I wonder about the USB to [...]
May 8th, 2013 at 4:43 am
instead of using minicom save yourself the headache and just do:
cat /dev/ttyS01
on first system
And
echo hi > /dev/ttyS01
on second system.
Should print out nicely
after that change roles .. and you have checked two-way communication.
Reply to this comment