LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 05-29-2008, 03:20 PM   #1
raypen
Member
 
Registered: Jun 2002
Location: Midwest
Distribution: Slackware
Posts: 365

Rep: Reputation: 30
Serial loop back test doesnt work


I have been trying to perform a serial loop back test of my
serial port (ttyS0) on a machine running Slackware 12.0.

I have inserted one end of a null modem cable into the serial
port and have shorted pins 2 & 3 on the other end. I then issue the
following commands:

on tty1
Code:
cat < /dev/ttyS0
on tty2
Code:
echo "This is a serial line/port test" > /dev/ttyS0
Expecting to see the result of the echo command on tty1, I get
nothing but a blinking cursor and some odd jibberish scrolling
by so fast I can't read it. As a matter of fact, the blinking
cursor and scrolling occur when I enter cat < /dev/ttyS0.

What am I doing wrong?
 
Old 05-29-2008, 04:36 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,459

Rep: Reputation: 6216Reputation: 6216Reputation: 6216Reputation: 6216Reputation: 6216Reputation: 6216Reputation: 6216Reputation: 6216Reputation: 6216Reputation: 6216Reputation: 6216
Would be easier to use a terminal program such as minicom. Any alphanumeric character typed in should be echoed back (visible) on the screen which means the loopback is working. The program must be configured not to echo characters which is typically the default.
 
Old 05-29-2008, 05:10 PM   #3
raypen
Member
 
Registered: Jun 2002
Location: Midwest
Distribution: Slackware
Posts: 365

Original Poster
Rep: Reputation: 30
I suppose I should have mentioned it, but I tried minicom and
it would not work properly. Not sure, but I get a blinking cursor
at the bottom of the window similar to the tty1 output. I tried
to exit and it hung. Had to kill its process from another tty.

Anyway, answers in these forums say the best way to do the loopback
test is as outlined above.
 
Old 05-29-2008, 05:29 PM   #4
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,370

Rep: Reputation: 563Reputation: 563Reputation: 563Reputation: 563Reputation: 563Reputation: 563
Quote:
Originally Posted by raypen View Post

I suppose I should have mentioned it, but I tried minicom and
it would not work properly. Not sure, but I get a blinking cursor
at the bottom of the window similar to the tty1 output. I tried
to exit and it hung. Had to kill its process from another tty.
From that clue I would say that the data is not being received at tty1. Take a look at the possibility that the data is not actually being transmitted or that it is being transmitted and the null modem cable is not sending it back.

Could you run a test with a different cable where you connect the serial ports of two different computers?

---------------------
Steve Stites
 
Old 05-30-2008, 11:41 PM   #5
raypen
Member
 
Registered: Jun 2002
Location: Midwest
Distribution: Slackware
Posts: 365

Original Poster
Rep: Reputation: 30
Recently ran across this which is a decent explanation of effects
of shorting the pins:

Quote:
Another test is to jumper the transmit and receive pins (pins 2 and 3 of either the 25-pin or 9-pin connector) of a test serial port. Then send something to each port (from the PCs keyboard) and see if it gets sent back. If it does it's likely the port with the jumper on it. Then remove the jumper and verify that nothing gets sent back.

Note that if "echo" is set (per stty) then a jumper creates an infinite loop. Bytes that pass thru the jumper go into the port and come right back out of the other pin back to the jumper. Then they go back in and out again and again. Whatever you send to the port repeats itself forever (until you interrupt it by removing the jumper, etc.). This may be a good way to test it as the repeating test messages halt when the jumper is removed.
I think this answers my question!
 
Old 01-07-2012, 07:06 AM   #6
littos
LQ Newbie
 
Registered: Aug 2010
Posts: 1

Rep: Reputation: 0
Ahhhh!

I just love you guys! Thanks for sharing information also after you find the soulution to your problems!

I had a simmilar problem when trying to loop back on the /dev/tts/1 on a Linksys WRT54g, running DD-WRT. I just couldnt get things to work, but after reading this thread I sent the router a:
"root@DD-WRT:~# stty -F /dev/tts/1 -echo"

and now things seems to work. I might need to remove some new line echo also, but that shouls be docunented in the stty documentation, I think.

Tanks for sending me down the right trail!

/Anders
 
  


Reply


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
serial line loop back error in dial-up mahdif Linux - Networking 0 07-05-2007 02:19 PM
Bash: how to test for a number in Array within if loop? realos Programming 1 12-15-2006 08:59 AM
What is a loop back device? kd7edh Linux - General 1 01-17-2006 08:19 PM
Why doesnt my USB mouse doesnt work? barkha Linux - Hardware 2 08-16-2005 12:31 PM
Loop back Interface siddiqu Linux - Networking 2 11-17-2001 09:34 PM

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

All times are GMT -5. The time now is 01:42 PM.

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