How to Do a Serial Loopback Test Pagina 1 di 6

How to Do a Serial Loopback Test- Developer Zone - National Instruments
Pagina 1 di 6
Improve your ni.com experience. Login or Create a user profile.
Document Type: Tutorial
NI Supported: Yes
Publish Date: Feb 18, 2008
How to Do a Serial Loopback Test
Overview
A loopback test allows you to send and receive data from the same serial port to verify that the port is operational. To
perform this test, you need to modify your null-modem serial cable temporarily so that the transmit and receive pins are
connected. If you do not have a null-modem cable, or if you do not know which serial cable to purchase for your serial
card, see the Serial Cables section below. Follow the steps below to modify the appropriate cable.
Table of Contents
1.
2.
3.
4.
5.
6.
RS-232 DB-9 Connector
RS-485 DB-9 Connector
RS-232 DB-25 Connector
RS-485 RJ-45 Connector
Serial Cables
Performing a Loopback Test with Windows HyperTerminal
RS-232 DB-9 Connector
The DB-9 connector is a 9-pin connector, as shown below. You need to insert one end of the cable into your serial port
and use the other free end to make the loopback connection. The figure below shows the female DB-9 connector with
pin# 2 and pin# 3 shorted. You can also use a simple paper clip to short the two connections by inserting the clip into
each hole in the female connector, as shown below:
RS-485 DB-9 Connector
The DB-9 connector is a 9-pin connector, as shown below. You need to insert one end of the cable into your serial port
and use the other free end to make the loopback connection. The figure below shows the female DB-9 connector with
pin# 4 and pin# 8 and pin #5 and pin# 9 shorted. You can also use a simple paper clip to short the two connections by
inserting the clip into each hole in the female connector, as shown below:
RS-232 DB-25 Connector
The DB-25 connector is a 25-pin connector, as shown below. You need to insert one end of the cable into your serial
port and use the other free end to make the loopback connection. The figure below shows the female DB-25 connector
with pin# 2 and pin# 3 shorted. You can also use a simple paper clip to short the two connections by inserting the clip
into each hole in the female connector, as shown below:
RS-485 RJ-45 Connector
The RJ-45 connector is am 8-pin connector, as shown below. It is a connector very similar to the network cable
connector, but the wiring scheme is different. You need to insert one end of the cable into your serial port and use the
other free end to make the loopback connection. It is not easy to short pins with this connector; therefore, you should
purchase the RJ-45 to DB-9 convertor cable (part #182845-01). However, if you do short the pins, short pin# 7 to pin# 3
http://zone.ni.com/devzone/cda/tut/p/id/3450
14/04/2008
How to Do a Serial Loopback Test- Developer Zone - National Instruments
Pagina 2 di 6
and pin# 6 to pin #2.
Serial Cables
The type of null-modem serial cable you need depends on the type of serial card you have. Below is a list of serial
cables National Instruments offers:
1. RS-232 9-pin female D-Sub to 9-pin female D-Sub
182238-01 (1 meter)
182238-02 (2 meters)
182238-04 (4 meters)
2. RS-485 9-pin female D-Sub to 9-pin female D-Sub
183283-01 (1 meter)
183283-02 (2 meters)
183283-04 (4 meters)
3. RS-232/485 10-position RJ-45 to 9-pin male D-Sub
182845-01 (1 meter)*
184428-01 (1 meter isolated cable)*
http://zone.ni.com/devzone/cda/tut/p/id/3450
14/04/2008
How to Do a Serial Loopback Test- Developer Zone - National Instruments
Pagina 3 di 6
4. RS-232/485 PCMCIA to 9-pin male D-Sub
183905-0R3 (30 cm) for single port and 2-port PCMCIA-232/485 cards*
185205-01 (1 meter) for 4 port PCMCIA-232 cards*
5. RS-232 SCSI-68 to 8-port 9-pin male D-Sub
185196-01 (1 meter) for 8 port PCI/PXI-232 cards*
6. RS-485 SCSI-68 to 8-port 9-pin male D-Sub
185845-01 (1 meter) for 8 port PCI/PXI-485 cards*
7. RS-232 16-port breakout box
186936-01 (1 meter) for 16 port PCI/PXI-232 cards*
* This is only a convertor cable/box to male DB9 connector. You also need one RS-232 or RS-485 null-modem cable per
port, as shown above.
Performing a Loopback Test with Windows HyperTerminal
After you modify the null-modem cable as directed in the sections above, you can perform the loopback test.
http://zone.ni.com/devzone/cda/tut/p/id/3450
14/04/2008
How to Do a Serial Loopback Test- Developer Zone - National Instruments
Pagina 4 di 6
Insert the cable
Insert the unmodified end of the cable into the serial port you want to test. The other cable end should have the RX/TX
pins shorted using a paper clip or a piece of wire.
Launch HyperTerminal
Launch HyperTerminal by selecting Start»Programs»Accessories»Communications»HyperTerminal.
[+] Enlarge Image
Create a Session
Create a session by giving it a name and press OK. The example below shows the name Loopback Test.
Select the COM port from the drop-down list and press OK.
Select the serial properties shown below and press OK.
http://zone.ni.com/devzone/cda/tut/p/id/3450
14/04/2008
How to Do a Serial Loopback Test- Developer Zone - National Instruments
Pagina 5 di 6
You will see the terminal window as shown below. If your serial port is working and the loopback cable is properly
connected, the text you type appears in the window. If you remove the cable and type text, it should not appear in this
window. If this test behaves differently than described here, see the troubleshooting advice at the end of this section.
If the loopback test is successful, it indicates that your serial port is functional and you can send and receive data through
that port.
[+] Enlarge Image
Troubleshooting
I do not see anything when I type in the terminal window
- Make sure the null-modem connector is inserted in the correct port. Try connecting it to a different port.
- Make sure the other null-modem cable end has the TX/RX lines shorted.
- Make sure the the bottom left side of the terminal screen has the words Connected. If it says Disconnected, repeat the
whole procedure.
- Make sure your serial card is installed properly. For National Instruments serial cards, select Start»Programs»National
Instruments»NI-Serial»Diagnostics. Make sure all serial cables are disconnected before running the test.
I can see the text I type even when I disconnect the cable.
Make sure Local Echo is turned off. To turn off Local Echo, select File»Properties. Select the Settings tab and click on
ASCII Setup. Uncheck the box that says Echo typed characters locally. Click on OK twice to return to the terminal
window.
I see two characters whenever I press a key.
Make sure Local Echo is turned off. To turn off Local Echo, select File»Properties. Select the Settings tab and click on
ASCII Setup. Uncheck the box that says Echo typed characters locally. Click on OK twice to return to the terminal
window.
Reader Comments | Submit a comment »
http://zone.ni.com/devzone/cda/tut/p/id/3450
14/04/2008
How to Do a Serial Loopback Test- Developer Zone - National Instruments
Pagina 6 di 6
thanks! I've read it and i've checked successfully!
- Apr 6, 2008
very good document
- siva prasad nandyala, wipro. siva.nandyala@wipro.com - Mar 13, 2008
Very useful technical information. K.N. Lakshmi Pathi Advanced Electronics Company Riyadh
- Kadaba Lakshmi Pathi, Advanced Electronics Company. knlpathi@hotmail.com - Feb 3, 2008
Very useful technical information. K.N. Lakshmi Pathi Advanced Electronics Company Riyadh
- Kadaba Lakshmi Pathi, Advanced Electronics Company. knlpathi@hotmail.com - Feb 2, 2008
Hi, I'm trying a different type of environment of loopback. The loopback suggested by you is done locally. Wondering
how the below can be done :- Step 1 : Tx characters from modem A to Modem B using hyper term. Step 2 : modem B
upon receiving the characters auto tx the characters received back to modem A. A summary of the enviorment is that
whatever Modem A transmits, Modem B will do a auto loopback to modem A. Are there any AT commands that support
this operation? Any advice is most appreciated. Regards, Zhiwei
- Zhiwei. chiopigwinner@hotmail.com - Jan 10, 2008
thanks!
- pham hung, DH Bach Khoa Ha Noi. pkh_1985@yahoo.com - Jan 7, 2008
Thank you. This web site was a big help because I have been looking for a way to do this.
- larry.harrison@ucps.k12.nc.us - Nov 7, 2007
Simply Superb, But Need Further Details
This type of tesing I have already done and its working really great for me. But the problem that am facing is, I use
MSCOMM32.OCX to connect to the COM Port. I get message saying PORT ALREADY OPEN, When actually Port is
closed and not used by other process and Vis Versa. Can any one put in some idea about why this happens. Thanks in
Advance.
- lakshmikanthkamath@gmail.com - Jun 27, 2007
Thanks!
thank you very much, it really helps. =)
- Jun 8, 2007
Great!
This helps out a lot, thanks!
- Apr 22, 2007
Perfect, thanks
Who would have thought I'd finally get some use out of that Quarterdeck loopback plug set all these years later? Thanks!
- Andrew. andrew.rich@gmail.com - Feb 12, 2007
Great Document
Exactly what I needed to sove a problem with a new Serial card.
- Jake. jatexas@camtel.net - Jan 11, 2007
Superb Article
This is exactly the article I was looking for. Thanks a lot.
- Susanta Mondal. cse_susanta@rediffmail.com - Sep 25, 2006
I am not clearly know that when I use modem connect mode, what type of the loopback connector I need, or modem
connect mode can not be tested by loopback? Thanks!
- When I use modem connection mode?, china. golden_ctbu@yahoo.com.cn - Apr 25, 2006
Great document
I was really looking to do some serial loopback tests, and this document also had the way to test them using
HyperTerminal. Great document!
- Dustin Martínez, Electronics School, University of Cauca (Colombia). tbb_mb@yahoo.com - Jan 24, 2006
great technical document
Thanks for this summary of testing serial ports!
- Oct 17, 2005
Looking to test Serial Port via DOS in Interrupt mode!
Looking to test Serial Port via DOS in Interrupt mode! Any quick examples I can "borrow"?
- Roger Owens, Hamilton Sundstrand. roger.owens@hs.utc.com - Apr 3, 2002
Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may
be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI
does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related
products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT
TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE
(http://ni.com/legal/termsofuse/unitedstates/us/).
My Profile | RSS | Privacy | Legal | Contact NI © 2008 National Instruments Corporation. All rights reserved.
http://zone.ni.com/devzone/cda/tut/p/id/3450
|
E-Mail this Page
14/04/2008