Review your favorite Linux distribution.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 07-26-2012, 07:21 AM   #1
Registered: Dec 2002
Location: algeria
Distribution: redhat 7.3, debian lenny
Posts: 620

Rep: Reputation: 31
writing to /reading from serial port

Hi every body

I hope find an answer thanks a lot.

I have written 2 small programs for writing on serial port S0 and another for reading from the port S1.
My machines have 2 physical serial port.
I connect the S0 to S1 via a crossed cable.

On one machine the programs ran perfectly,
when I tried them on another machine, exactly same machine running same system ( linuxMint),
in same conditions, they didn't.

the writing program to port S0 ran but the reading from S1 !!!
the situation is like no physical connection on 2 port exits!!! It is of course;

Very strange, so may be the I have to do something to activate the ports ???
Why it run on one case and not on another!!!

the programs are attached
thanks a lot for any idea.

Attached Files
File Type: txt inputOutSerial.txt (1.6 KB, 14 views)
Old 07-26-2012, 09:09 AM   #2
Senior Member
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 3,446

Rep: Reputation: 1054Reputation: 1054Reputation: 1054Reputation: 1054Reputation: 1054Reputation: 1054Reputation: 1054Reputation: 1054
try this (as root):
dmesg | grep ttyS
on my PC:

[    0.214607] 00:0c: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[    0.234844] 0000:00:03.3: ttyS1 at I/O 0x2450 (irq = 17) is a 16550A


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Writing ok on a serial port, reading garbage JeToMad Programming 12 03-28-2012 02:11 AM
Writing/reading to a modem via serial device? R00ts Programming 3 01-06-2011 05:02 PM
Reading/Writing to serial ports (Rs-232). linux_chris Linux - Software 9 12-10-2008 01:05 PM
Reading and Writing to a Serial Port without SU Steef223 Programming 2 06-16-2008 09:16 AM
Facing problems in reading from and writing to serial port. vineel Linux - Hardware 2 02-27-2008 02:18 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:30 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration