Dsc Serial Protocol Sniffer
RS232 serial spy monitor cable. Introduction on monitoring serial RS232 dataThe RS232 standard defines an asynchronous way of communication between DTE,data terminal equipment (computers, printers, etc.) and DCE,data communication equipment (modems). This type of communication has become the minorityand nowadays serial communications is mainly between two DTE devicesusing a. Although this is1:1 communication, it is possible with special cables to monitor the data streams.RS232 provides 2 data lines for each data channel. One is for transmitting data and the otherfor receiving.
Because of these two separate lines, data can be send full duplex. This meansthat both ends can send and receive data simultaneously without mutual interference. In most situationshowever the high level communication protocol only allows half duplex communications because most simpleprotocols with external devices work with a master-slave, or question-answerconfiguration.
Esp8266 Dsc Keybus
One of the parties is the master which is in charge of communications. This mastersends commands and requests to the slave which responds to them. The slave will never by itselfstart a communication sequence so in practise the communication is half duplex: There is no singlemoment when both sides send data simultaneously. That most RS232 communication is performed in a half duplex way is important if the data stream hasto be monitored. A half duplex communication protocol can be spied with a computer with just oneserial port attached. This port listens to both RS232 communication lines simultaneously but nodata will be garbled because only one party sends at a time. This type of communication can be spiedwith simple software like the terminal emulation program HyperTerminal which is shipped with theWindows operating system.In the situation of full duplex communication on a RS232 channel we cannot simply tie both linestogether and listen to it.
For this situation you need two separate serial ports on the spionagecomputer. Also special sniffer software is handy that listens to both ports simultaneously and outputsthe data of both lines to the screen or to disk.Half duplex RS232 spy / monitor / sniffer cableIt is not difficult to monitor half duplex RS232 serial communication between two deviceswith a PC. To do this you need the RS232 monitor cable which is displayed in thenext picture.
Two DB9 connectors are wired straight through. The spy computer is connectedto the third connector. This monitor cable taps communication from two sourceson only one RS232 receiver port.
This means that ifthe two devices happen to talk simultaneously, the monitored informationwill be garbage. In most circumstances communication protocols work halfduplex, in which case this RS232 cable will work without problems. Otherwiseyou need the full duplex RS232 monitor cable which is discussed here also. Half duplex RS232 spy / monitor / sniffer cableConnector 1Connector 2SpyFunction11-Carrier detect222 via R 1RxRx spy332 via D 1TxRx spy44-Data terminal ready555Signal ground66-Data set ready77-Request to send88-Clear to send99-Ring indicator-1 + 4 + 6DTRCD + DSR-7 + 8RTSCTSThe electronic diagramlooks simple and strange at the same time with one diode and one resistor.The functionality is however straight forward. The spy computer is attachedto the connector in the right bottom.
The female connector at the leftis attached to the spied computer and the male connector at the right to theattached device.When an RS232 port is in an,it will be in the so-called markingstate with a negative voltage at the transmit output. Assume the computerconnected to the left port is sending data and the peripheral device at the rightside is idle. At that moment the RS232 signal levelon line 3 will change. When the voltage of this line changes to a higher value,current will flow through the diode to the spy computer. We assume the attached device isin an idle state. Therefore, the voltage at line 2 is something like -12 Volt,while at the other end of the resistor +12 Volt is applied. Simplemathematics learns that a current of approximately 11 mA (=24 Volt/2200 Ohm) flowsthrough the resistor.
This is no problem because most RS232 driver IC'sare capable to deliver at least 45 mA. Because the voltage drop overthe diode is only 0.7 Volt—independent of the current through thediode—the spy computer will see on its RS232 port (almost) the same voltage levels aspresent on the transmit port of the sending computer and data fromthe sending computer to the peripheral device is successfully captured.In the second situation the computer has finished sending data and waits for an answer from the deviceat the male connector. The RS232 signal level at line 2 will go to positive values.The diode will block current to line 3 so the spy computer effectivelyonly sees the data coming from the peripheral device. Now the spy computer will be ableto pick-up the data send from the device back to the computer.In the diagram for the half duplex monitor cable some shorts have been made between pinsof the connector of the spying computer. These shorts loopback the handshaking signals of thecomputer. In most cases these shorts won't be necessary, but if the spy monitoring softwareuses handshaking, this will prevent the monitor software from blocking.You don't need expensive software to use this RS232 spy cable. A simpleserial terminal emulator like the HyperTerminal program present on all Windowsbased computers is enough to spy your communications.
The only thing you needto do is changing the baudrate and start and stop bits settings from theterminal emulation program to the settings used on the line to monitor.Full duplex RS232 spy / monitor / sniffer cableAs already discussed, it is not possible to monitor a full duplex RS232 communicationwith only one spy port. For this purpose the full duplex monitor cable can be used. Thiscable connects to two serial ports on the spy computer where each ports taps one directionof the communication. You could open two sessions of a terminal emulation program on yourcomputer, but often better is to use one of the specialized RS232 monitor software products.In that way the two communication streams are merged in one screen which makes it easierto analyze the sequence of the communications. Full duplex RS232 spy / monitor / sniffer cableConnector 1Connector 2Spy port 1Spy port 2Description11-Carrier detect222-RxRx 133-2TxRx 244-Data terminal ready5555Signal ground66-Data set ready77-Request to send88-Clear to send99-Ring indicator-1 + 4 + 6-DTRCD + DSR-7 + 8-RTSCTS-1 + 4 + 6DTRCD + DSR-7 + 8RTSCTSThe diagram of the full duplex RS232 monitor cable is actually simpler than the diagram ofthe half duplex monitor cable. This is because no special circuitry is necessary to combinetwo communication lines on one input. Just to be sure, all handshake signals on both spyconnectors have been looped back.
This prevents the software from blocking input in caseit checks the CTS, DSR or CD inputs.Other RS232 monitor solutionsBesides the cables mentioned above, there are ready made adapters available on the market which monitor serial communicationson RS232 channels. An interesting product is thefromStratus Engineering. It allows you to monitor RS232 communications via the USB port.