![]() |
| |||||||
| Notices |
| Computer Geek, Gadgets and Electronics- Περι υπολογιστών Software, hardware, help, coding, recomend a computer, electronics and gadgets... - Λογισμικό, ηλεκτρονικές συσκευές, βοήθεια, προτείνετε έναν υπολογιστή.. |
![]() |
| | Thread Tools | Display Modes |
| | #1 |
| GR Elite | Troubleshooting RS232 Communications In the last several of months I have realized that to many people RS232 serial communication is a little more black magic than it really needs to be. In an ideal world all communications paths and pinouts will be tested either on the design engineer’s bench or in fabrication during factory testing of a system. This includes testing with similar cables and cable lengths. Sometimes we believe a manufacturer’s literature and sometimes we make assumptions that may not be correct. Not performing these tests often leads to expensive and time consuming troubleshooting in the field. Hopefully this document will help to streamline the troubleshooting process. RS232 has been around since the 1950’s and is a simple, reliable way for two devices to communicate with each other. Once you understand the basic principles behind this standard, testing and debugging devices in the field becomes a straightforward and usually simple task. RS232 is a general term used to describe an asynchronous serial communications standard. It is often used to describe several things that it is, and also some things that it is not. There are several standards agencies that have definitions for RS232 (CCITT, EIA/TIA). We’re not as concerned here about the technical standard as about its common usages for communicating between parts of a computer or AV system. Also this document is more concerned with getting the wires connected correctly. Once that is done you will still need to sort through baud rates, stop bits, handshaking and ultimately serial protocols. Let’s start out with some definitions to help us clarify what are talking about. Serial communication – A method of transmitting information over a single wire one bit at a time. The bits are strung together into groups of eight bits which define a byte or character of information. Other bits, start, stop, parity, are used to synchronize and make the communication more reliable. RS232C – defines a db25 D Subminiature pinout RS232D – defines a db9 D Subminiature pinout RS232 Voltages – Defines, in general, the voltages that are used for communication. RS232 communication uses -12VDC for a 1 bit and +12VDC for a 0 bit. On an oscilloscope you can monitor the changing state of the RS232 line and see the voltage swings that define the bits and bytes of the communication. Normally with nothing being transmitted an RS232 line will “rest” at its minus (-5VDC to -12VDC) voltage. That being said of course there are always exceptions. The B&B Electronics RS232/RS422 converters will rest at +5VDC. It is important to note that the voltages used by RS232 are not critical. The original standard defined a -12VDC/+12VDC voltage swing. This usually required -12VDC/+12VDC power supplies to be built into the equipment. In the 1980’s a series of single chip voltage converters were invented that used a charge pump DC/DC converter to take the 5VDC already used in computers and create a voltage that can be used for the RS232 communication. These DC/DC converters usually generate about +/-9VDC. So, if you measure an RS232 line with a DC voltage meter in its resting state you should get -9VDC to -12VDC depending on what type of driver is used in your transmitting device. And then there was the early Macintosh which used a 0VDC/5VDC serial driver on an 8 pin din connector. That if wired properly on short cables would generally work. RS232 Length – Defines a maximum “legal” length of 75’ for RS232 communication. In most cases this can be extended to several hundred feet with some considerations. Such as the longer the wire the more internal capacitance in the wire which causes the wire to act as a low pass filter. As you get longer you want to slow your baud rate down to 9600 or even 2400 to lower the frequency of the communication and increase your reliability. With the cheap availability of RS422 line drivers it makes sense to limit RS232 wire length to the 75’ standard. RS422 – Defines another voltage standard. RS422 uses a 5VDC/0VDC differential line transmitter that puts voltage on both wires of the circuit. (In RS232 one wire is always a return or ground wire). In RS422 a 1 bit is 5VDC/0VDC on the two circuit wires. A 0 bit is the reverse or 0VDC/5VDC. For this reason you’ll find the wires of a RS422 circuit labeled e.g. TX+ and TX-. The biggest benefit of RS422 is that because of the differential drive on the RS422 line the maximum length allowed is 4000 feet instead of the 75 foot limit on RS232. DMX used for lighting uses the RS422 standard. RS485 – Is another voltage standard that uses the same voltages as RS422. The difference is that in RS485 all transmitters are “open collector” drivers. Meaning that when not transmitting there will be no drive or voltage on the circuit wires. Using the right software handshaking and sharing RS485 allows for multiple “talkers” on the same pair of wires. You can use a single pair of wires to both transmit and receive between two devices. Further you can tie several or many pieces of equipment on the same pair of wires and have them communicate with each other. A two wire fire alarm system with each alarm sensor or horn having its own ID is an example of RS485 using multiple talkers. DTE – Data Terminal Equipment. As defined by the standard this is the originator of the communication. In the original usage this would be a computer DCE – Data Communications Equipment. As defined by the standard this is the receiver or relay device. In the original usage this would be a computer modem or a printer. Null Modem – The null modem adapter can be very simple and swap pins 2 and 3 in the adapter. This can be a commercial null modem adapter or a custom made cable with pin 5 (ground) connected at both ends and pins 2 and 3 swapped in the adapter cable. The null modem adapter may also connect the hardware handshaking pins across the adapter. Hardware Handshaking – Some devices require hardware handshaking. That is certain pins on the originating connector are wired to pins on the receiving connector. In general modern equipment can be set to ignore the hardware handshaking pins so we will not go into this in detail. However we will give an example in the notes below on how to internally wire handshake pins in a connector to bypass or fake out hardware handshaking. It is also important to note that most line extender devices like a Magenta video/serial over Cat5 extenders or a B&B Electronics RS232/RS422 extender will not carry the handshake lines, only the TXD and RXD communication signals. Any application that uses an extender should be tested with the actual gear/cables intended to be used to make sure you can bypass the handshaking before being sent to the field for installation. Note: It is possible to use some but not all of the RS232 specification. E.g. The Technovision DV-66 video server has a RS232 communications connector. But if you read the literature or attempt to use this port you will find that Technovision is using the RS232 “ASCII protocol” but not the RS232 db connector OR the RS232 -12VDC/+12VDC levels. It uses a RJ11 telephone connector and TTL voltages. But it does use RS232 protocol. Technovision sells an adapter cable with a level converter chip built in that terminates in a db9 to communicate with more standard RS232 devices.. Examples: Now that we have sorted out some of the definitions lets look at a couple of examples how we actually use RS232 communication. The first will be a PC computer hooked up to a video projector. The computer uses the RS232D 9 pin dsub standard and is a DTE device. The projector also uses the RS232D 9 pin dsub standard but is a DCE device. The computer will transmit on its pin 3 and receive on its pin 2, 5 is ground. The projector pinout tells us that it will transmit on pin 2 and receive on pin 3, again 5 is ground. So this one is simple, A DTE<>DCE cable is a straight through cable and this properly connects the transmit to the receive on both devices. Computer Projector RXD 2 2 TXD TXD 3 3 RXD GND 5 5 GND Now that we’ve been through our first example we are going to give ourselves a couple of shortcuts to simplify things. 1. Hardware handshaking not required. 2. Ground on pin 5 unless otherwise noted 3. Either pin 2 or pin 3 will be the transmit 4. After we define the transmit pin the other pin, either 2 or 3 will be the receive data. 5. Only pins 2, 3 and 5 are required to make us communicate. Our second example will be a bit trickier. This time we will connect our PC computer to a Pioneer DVD player, the DVD-5000 in this example. Again the PC is a DTE/Transmit on 3. The Pioneer DVD player has a 9 pin dsub connector so this should be straightforward. However Pioneer many years ago defined an alternate serial pinout on a db15 connector. They now provide this db15 connector AND a db9 on the DVD-5000. BUT the db9 uses the old Pioneer db15 pinout for the db9. So using the Pioneer literature we would define our pinout as Computer Projector TXD 2 3 TXD TXD 3 2 RXD GND 5 1 GND So even though we tried to simplify the process the manufacturer bypassed the standard and threw us a curve. Reading the manual saved us. And what will always save us is test, test, test. Just because it says on paper it will work any of this communication should be verified on the design bench or the fabrication shop before gear is shipped to site. Manufacturers often have a strange way of labeling their signal lines. B&B uses an odd convention for their documentation which reverses the sense for TXD and RXD on their RS232/RS422 converters. This has caused communication to not work on more than one project and cost valuable time on site. Third example, this technique will work is most of our debugging situations. Now we’re hooking up our PC to a piece of gear in the field. It has a db9 labeled RS232 but we have no documentation. It may have been owner furnished but in any case its here and we have no manual. How do we make it work? We could wire up a straight through cable and see if that works. If it doesn’t we try inserting a null modem adapter and hope that works. We don’t have to guess, we can figure this out if the manufacturer follows the standard and our assumptions above hold up. Look at our assumptions above. Pin 5 is always ground, either pin 2 or 3 is the TXD, transmit data line. We know that the transmit data line is driven to a -10VDC voltage by the transmit driver chip. We also know that the RXD line is not driven. It goes to a receiver chip that is waiting for signal and therefore should read nearly 0VDC. Because of this we can hook up a DC voltmeter using pin 5 as the ground and then look for the minus voltage. It should be either on pin 2 or pin 3. Once we locate the minus voltage we have located TXD. RXD will be on the other pin, either 2 or 3. So with only a DC voltmeter and our assumptions we have tested and confirmed our pinout for most of the common serial devices we work with. Note: You can use male db pins to check pins on female connectors and small heat shrink can insulate test probes so you don’t short db pins together. Beware of paper clips. Using paper clips inserted into female db sockets can spread the small fingers on the sockets and cause them to lose contact when a real pin is inserted later. Let’s say we’re hooking our computer up to an Alcorn McBride 8Traxx MP3 player. We check our PC with the voltmeter and yes we find a -10VDC between pin 3 and pin 5, pin 5 being ground. Now we check the other end which is the 8Traxx. Pin 5 ground again and we find that pin 2 reads -10VDC. With this information we can build or verify a cable to look like. Computer 8Traxx RXD 2 2 TXD TXD 3 3 RXD GND 5 5 GND This “find the voltage” technique can be used to test RS232 in various ways. If you’re standing on a ladder at a projector that does not communicate you can use the voltmeter to check the pinout on the cable from the rack and the pinout on the projector. If you measure your minus voltage on pin 3 on both connectors you will know that the TXD lines are tied together and this cable won’t work. You must measure the minus voltage on pin 3 on one side of the connection and minus on pin 2 of the other side for the device to communicate properly. Anytime there is a connection at a piece of equipment this convention must follow for communication to be successful. If you have a chain of equipment in your communication path such as a control computer, RS232 router, serial over Cat5 extender and display screen you can test and verify that signals are wired correctly at each point that the TXD/RXD connect to an “active” device. RS232 communication has been with the control industry for over 50 years and it will continue to be used in some devices for years to come. Getting used to connecting and troubleshooting these signals can be a straightforward task and once mastered can save hours or days of time in the field working on equipment that is not the source of our communications problems. References: Alcorn Mcbride – To view links or images in this forum your post count must be 1 or greater. You currently have 0 posts. B&B Electronics- To view links or images in this forum your post count must be 1 or greater. You currently have 0 posts. Connect World- To view links or images in this forum your post count must be 1 or greater. You currently have 0 posts. Extron Electronics- To view links or images in this forum your post count must be 1 or greater. You currently have 0 posts. Indiana University- To view links or images in this forum your post count must be 1 or greater. You currently have 0 posts. Instrumental Software Solutions- To view links or images in this forum your post count must be 1 or greater. You currently have 0 posts. Magenta Electronics- To view links or images in this forum your post count must be 1 or greater. You currently have 0 posts. Technovision Interactive - To view links or images in this forum your post count must be 1 or greater. You currently have 0 posts. |
| | |
| | #2 |
| The Big Boss Join Date: Oct 2006 Location: In your head
Posts: 4,236
![]() ![]() ![]() ![]() | Re: Troubleshooting RS232 Communications Great info its always good to have some knowledge on this subject. Troubleshooting communications is quite common in my field although I have yet to do one myself. |
| | |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Arcade troubleshooting | Prokomenos | Troubleshooting - Αντιμετώπιση Προβλήματων | 6 | 07-12-2007 06:23 AM |
| Troubleshooting thread | Hellenika | Troubleshooting - Αντιμετώπιση Προβλήματων | 26 | 02-24-2007 01:17 AM |