Operating System - Linux
1819694 Members
3478 Online
109605 Solutions
New Discussion юеВ

Serial port loop back test

 
PVR
Valued Contributor

Serial port loop back test

I have a Linux box. I want to perform a loopback test on the serial port (/dev/ttyS1). This is an extra serial port attached to the system. System is sensing both serial ports.

How can I perform the loopback test on it??

I have minicom utility . Can I do the test with this utility. My aim is to check whether the serial port is working or not.

urgent...

Thanks
Don't give up. Try till success...
3 REPLIES 3
Mark Grant
Honored Contributor

Re: Serial port loop back test

You can put each serial port in a special loopback mode where signals are just returned but I can't remember how to do this.

However, you should be able to make up a cable to go for the first serial port to the second serial port. Then make sure you have an entry in /etc/inittab to start a getty on one of the serial ports e.g. s1:12345:respawn:/sbin/agetty -L ttyS0 9600 vt100

Then run "init q" to get init to re-read this inittab file.

Then, using minicom, you should, in theory, be able to connect down ttys1 and get a login.

I have never done this but I can't see why it wouldn't work.
Never preceed any demonstration with anything more predictive than "watch this"
Alexander Chuzhoy
Honored Contributor

Re: Serial port loop back test

You can also connect two ports with cross serial cable.Then open minicom for each com port.While you type in first minicom's terminal-you should see the output in the second and vice versa.
(My windows users test their ports like this all the time using Hyper terminal-so it should work just the same way with minicom)..
Davorin Bengez
Occasional Advisor

Re: Serial port loop back test

Hi,

to get the test on the wire, short the pins
2 and 3 (TxD and RxD; will work on both 9 and 25 connectors as what is RxD on 9-pin is TxD on 25-pin :-). Just make sure that your communication program is set NOT to do local echo.
So, step by step procedure is:
- start your minicom / whatever
- choose port and set handshake to none,
also check that local echo is off
- type something - there should be no echo
- *carefully* short pins 2 and 3 on the
given RS232 port
- type something - if port is OK, you should
see the characters echoed back to the
screen

Also, if you need to do it more than once, consider buying RS232 tester - that little box with LEDs that will show you the state of each signal. It's cheap and can be real timesaver.

hope that helps,

davor