Question: We are able to communicate with our Serial Device via the DS100 (EM100) but there are a lot of data errors. It seems that data bytes are randomly lost. What is the problem here?
Answer: The most frequent cause of data loss is some problem with the handshaking (RTS/CTS) between your serial device and the Device Server. Using handshaking is recommended whenever possible. Just because your serial device could operate without handshaking when connected directly to the PC doesn't mean that it will also work fine without handshaking when connected to the Device Server. Here is why:
Unlike a serial cable which serves exclusively to connect together two devices, the Ethernet (TCP/IP) is a shared media that is used by many devices at the same time. Depending on the network conditions the DS100 may not be able to route all the serial data as it arrives into the serial port, so this data may need to be buffered. The buffer has a limited size (see below) and, to prevent it from overflowing, you need to enable RTS/CTS handshaking between the DS100 and your serial device.
The procedure below will help you determine if your RTS/CTS handshaking is enabled and is functioning correctly. The problem with handshaking may be:
One Setting and one Parameter define whether the Device Server is running with the Flow Control enabled or disabled:
The bottom line of all this is that the DS100 may be running with RTS/CTS disabled even if the Flow Control is enabled in the DS100's Settings. The flowchart on Figure 4 shows the “action plan” for making sure that the DS100 is running with RTS/CTS enabled.
Figure 1. “Action plan” flowchart
If your serial application does not use the VSP but is working with the Device Server directly via the TCP/IP or UDP/IP protocol then you needn't worry about Parameters (unless, of course, you have implemented Parameter passing in your application software). All you need to do is make sure that the Flow Control Setting of the Device Server is set to “RTS/CTS”.
If your serial application does use the VSP, you need to check if on-the-fly Parameter passing is enabled (you need to check both the VSP side and the Device Server side).
If you have made sure that the DS100 is operating with the RTS/CTS Flow Control enabled but you are still losing data then this may be because your serial device is running with RTS/CTS disabled.
The problem may also be in an incorrect (incompatible) wiring of the serial cable that connects the DS100 to your serial device. The serial cable is a “simple thing” yet its wiring is at the heart of a problem in many cases.
The problem stems from unclear definition of what is the RTS and what is the CTS signal. Many know that these two are at pins #7 and #8 (for 9-pin serial cable) and that one of them is supposed to be an input and another one- an output. But which one is which? Some manufacturers define the input and output with respect to the PC (to which the serial device is supposed to be attached). Some manufacturers define the input and output with respect to the serial device itself.
The net result is that there are serial devices on the market with exactly opposite wiring. You may think that RTS pin on your serial device's connector is an output while, in fact, it is an input (or vice versa). The whole thing is so cumbersome that here at Tibbo we have completely abandoned calling the wires RTS or CTS but instead refer to them as “handshaking input and output” (always with respect to the serial device itself).
As a result of all this, your serial cable might be connecting the “handshaking output” of the DS100 to the “handshaking output” of your serial device (and “input” to an “input”). Obviously, this is wrong! The “output” on one side must be connected to the “input” on another side and vise versa!
Now we will tell you the only 100% error-proof method of finding out if your wiring is correct. Don't just “check the manual”, do as we advise!
Take any kind of meter that is capable of measuring voltage, and measure the voltage on both RTS and CTS lines (with respect to the ground). You need to perform this test with both the DS100 and your serial device powered and the serial cable connected to both of them at the same time (yes, finding a way to measure the voltage may be tricky but you will defeat the purpose of this test if you disconnect the cable on either side to make the measurement on the connector pins). The measurement arrangement is shown on Figure 2.
Figure 2. Making sure that RTS/CTS lines are wired correctly
When the cable wiring is correct (compatible with your serial device) then there will be some potential (about 5-12V, doesn't matter positive or negative) on both lines. If the wiring is incorrect then there will be a potential on one of the lines and nothing (i.e. just some “millivolts”, definitely <1V) on another line. If you discover then this is so then you must “swap” the CTS and RTS lines. That is, if you had a connection like this (“cross”):
#7 –> #8
#8 –> #7
then you will need to change it to this (“direct”):
#7 –> #7
#8 –> #8
And if you had the “direct” connection then you will have to change it to “cross”.
After you have rewired the cable please check the voltage again. Now you should have a “sizeable” voltage of 5-12V on both RTS and CTS lines!
We hope that the above has helped you sort out the problem with the handshaking. If the problem is still there please let us know- we will try to help you find out the solution!