It is often useful to capture the data flowing on the Serial Line for troubleshooting reasons.
Your unit does not react as expected? It does not reply at all? Sometimes it happens because the unit does not receive the correct command, or the command never reaches the receiver (supposed to be).
On such situation, it is necessary to analyse what the transmitter (a controller, a video encoder, a NVR, ...) puts on the Serial Line, trying to find out what is wrong with the message.
If we are lucky enough to have a protocol analyser around, equipped with a RS485 Serial Interface, the job is half done: just connect the transmitter to the analyser RX ports, run the capture, and issue some commands from the transmitter itself. The analyser will capture the message, and you will be able to check for possible errors.
Instead, if you do not have the chance to use an analyser, you can use your PC, even if not as straightforward as using such instrument would have been.
What you need:
USB to RS485 adaptor:
The adaptor is necessary to interface the RS485 Serial Line to your PC through the USB port.
Cables and Connection Boxes:
Depending on the adaptor ports, you may need different cables and connection boxes to interconnect the adaptor to the Serial Line. Ours have a 6-pins RJ11 female out, that's why we used a 6-wires flat cable with RJ11 male connectors, plus a connection box to extract the RX+/RX- pair.
Now you can connect everything together:
The Rapport depicted above is actually a Protocol Analyser; being able to transmit also telemetry commands, we are using it in place of a real transmitter, such as a video encoder.
Be sure to install the required drivers for your USB-to-RS485 adaptor. Your PC's Device Manager should list the adaptor under the Port (COM & LPT) section, assigning it with a specific COM Port ID:
With a double-click on the COM Port, you can open the Serial Port properties, and configure the communication parameters, which have to match the transmitter's settings (e.g. 9600-8-N-1-N):
The Serial Port is now ready to capture the data, but we need somehow to display the data. Unfortunately, the widely used PuTTy (Terminal Emulator) does not display Raw data (i.e. HEX bytes) directly on the screen, but it translates them into ASCII format, which is not really good for the sake of the analysis.
Better to use a more flexible Terminal Emulator: RealTerm - freeware, available from SourceForge at the following address: http://realterm.sourceforge.net/
Install and run the application.
On the Port tab: insert the correct communication parameters; select the USB-to-RS485 converter's COM port; hit the Open button. The green Status led should indicate a good connection:
On the Display tab, select the Display mode: HEX (Space) will show the Raw data, separated with spaces for a better reading. Now it's time to capture and display: operate the transmitter to send commands on the Serial Line; you should see those commands displayed by the application:
Our transmitter was using the Pelco-D protocol for telemetry commands. The captured strings need now to be translated into the related commands to know if they are correct or not. For example:
FF 01 00 02 3B 3B 79 means:
FF: Sync Trailer (start of command);
01: Receiver Address;
00 02: Pan Right;
3B 3B: Pan/Tilt Speed;
The string complies with the Pelco-D protocol specifications. The unit should move accordingly.