LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 08-24-2007, 01:25 PM   #1
anroy
LQ Newbie
 
Registered: Aug 2006
Location: Tokyo
Distribution: Gentoo, Xandros
Posts: 18

Rep: Reputation: 0
Question Serial (RS232) communication is one-way


I need to use my Gentoo machine to obtain data from an external instrument via a 9-pin serial port. Very old stuff.

It was not working, so I have been trying to diagnose the problem.

I bought a cable that is called a "cross cable" in Japan (where I am located), I think this corresponds to what is called a "null-modem cable" in America. Both ends are female, and it is used to directly connect 2 PCs.

So here is the setup:

PC-1: Gentoo OS
PC-2: Has partitions for both Windows XP and Xandros Linux.

I installed Minicom on PC-1
On PC-2, in Xandros I also installed Minicom. In the Windows side I use Hyper Terminal.

I connected the PCs, started up the terminal programs on both boxes, and would type messages such as "Hello World".

Whether I used Xandros or Windows on PC-2, the result was always the same: I could send messages from PC-1 and it would show up in the terminal program of PC-2, however the other way round never worked. Nothing I ever typed in PC-2 showed up in PC-1.

On both machines I checked the serial port permissions. The Xandros machine result was as below.
Code:
# ls -l /dev/ttyS0
crw-rw-rw- 1 root tty 4, 64 Aug 24 16:31 /dev/ttyS0
However in the case of the Gentoo machine, the permissions were as follows:
crw-rw----
I set them to crw-rw-rw- using chmod, to be the same as the Xandros setting. It didn't help anything.

Grasping for straws, I even disconnected the cross cable from the computers, and reconnected reversing the ends. Still no luck.

Is it possible that the Gentoo OS is set up in such a way that it can send from the serial port and not receive? Does this kind of thing happen? ops: Does anyone know where I should look next?

(As for the possibility that the problem lies in PC-2, in that it can receive and not send, well, I am disinclined to think that since the results were the same whether or not the OS was Xandros or Windows. Mind you, whether it is running Xandros or Windows, it is still the same box and consequently using the same physical serial port)
 
Old 08-24-2007, 02:33 PM   #2
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
You could have a bad tx port on PC2 or a bad receive port on PC1.

You also might not have minicom configured right on PC1; it might be set to not display incoming text, or font colors could be wrong, or perhaps some other issue...dunno.

If you are able to rule out software, then you'll need a serial breakout box to figure it out.
 
Old 08-24-2007, 09:31 PM   #3
anroy
LQ Newbie
 
Registered: Aug 2006
Location: Tokyo
Distribution: Gentoo, Xandros
Posts: 18

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jiml8 View Post
You could have a bad tx port on PC2 or a bad receive port on PC1.

You also might not have minicom configured right on PC1; it might be set to not display incoming text, or font colors could be wrong, or perhaps some other issue...dunno.

If you are able to rule out software, then you'll need a serial breakout box to figure it out.
Thanks Jim, I will look into the minicom configs on PC1, as you suggest.

Assuming there is no problem with minicom settings... I am not sure how to go about determining if there is a bad tx port on PC2 or a bad receive port on PC1... is this what a breakout box would help with?

I will Google "serial breakout box" then, and may have follow-up questions.
 
Old 08-25-2007, 01:03 PM   #4
dxqcanada
Member
 
Registered: Sep 2006
Location: Canada
Distribution: Gentoo
Posts: 702

Rep: Reputation: 43
Look at /proc/tty/driver/serial ... it should give you some info:
Code:
N620c ~ # cat /proc/tty/driver/serial
serinfo:1.0 driver revision:
0: uart:16550A port:000003F8 irq:4 tx:23 rx:14
If you are using any Flow Control ... set both sides to NONE and try again.

To test PC-1's port ... you could tie pins 2-RXD and 3-TXD together to form a loopback ... you should see data on PC-1 ... otherwise PC-1's serial port is defective.
 
Old 08-25-2007, 01:35 PM   #5
anroy
LQ Newbie
 
Registered: Aug 2006
Location: Tokyo
Distribution: Gentoo, Xandros
Posts: 18

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by dxqcanada View Post
Look at /proc/tty/driver/serial ... it should give you some info:
Code:
N620c ~ # cat /proc/tty/driver/serial
serinfo:1.0 driver revision:
0: uart:16550A port:000003F8 irq:4 tx:23 rx:14
If you are using any Flow Control ... set both sides to NONE and try again.

To test PC-1's port ... you could tie pins 2-RXD and 3-TXD together to form a loopback ... you should see data on PC-1 ... otherwise PC-1's serial port is defective.
Flow control has always been none on both machines. I will try the loopback test later (have been scared to try it in case I destroy my PC with the paperclip!) but I am pretty sure the physical port is not the cause.

This is because another Gentoo PC, whose HDD image was used to make mine, also has problems recieving via serial. This indicates that it is probably the software environment.
 
Old 08-25-2007, 01:35 PM   #6
anroy
LQ Newbie
 
Registered: Aug 2006
Location: Tokyo
Distribution: Gentoo, Xandros
Posts: 18

Original Poster
Rep: Reputation: 0
Serial (RS232) communication - failing to detect stop bit

I have narrowed things down to where I realize I am getting the following.

If I run the following command on the Gentoo machine (PC-1):
cat /proc/tty/driver/serial
I get, along with the number of bytes transfered by rx and tx, I also get fe:2, which I assume means two frame errors.

The rx figure is correct in that it jives with the number of bytes I sent from PC-2... this indicates that the Gentoo machine IS receiving data. However maybe the fe:2 means that it is not detecting the stop bits, and this is preventing it from displaying output text in minicom.

I have checked and rechecked that all the settings (bit rate, parity etc) all match on both machines. I am wondering if there is some factor in the kernel that is making it not recognize the stop bit. I have had other indications as well that a stop bit or a terminator is not being detected (long story). What are some possible causes? (e.g. the OS is doing too much interrupting or not enough?)
 
  


Reply

Tags
communication, minicom, port, rs232, serial



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
USB to RS232 (serial port)? - no I need to configure anything? Ultrus Linux - Hardware 12 08-16-2007 06:00 PM
USB - Serial RS232 Adapter blox Linux - Hardware 3 01-28-2005 10:58 AM
Serial RS232 problem Onyx^ Linux - Hardware 6 09-09-2004 11:35 PM
RS232 serial port programing blackzone Programming 2 08-11-2004 12:54 AM
serial port: RS232 RS574? blackzone Linux - Hardware 1 08-10-2004 04:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

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

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