{"id":634,"date":"2018-04-15T08:05:06","date_gmt":"2018-04-15T08:05:06","guid":{"rendered":"http:\/\/buklijas.info\/blog\/?p=634"},"modified":"2018-04-14T18:29:18","modified_gmt":"2018-04-14T18:29:18","slug":"rs232-sniffing-python","status":"publish","type":"post","link":"http:\/\/buklijas.info\/blog\/2018\/04\/15\/rs232-sniffing-python\/","title":{"rendered":"RS232 sniffing with Python"},"content":{"rendered":"
<\/a><\/p>\n Published on:<\/strong> 15.04.2018<\/p>\n I had PC and LG TV screen communicating via RS232 cable.<\/p>\n PC was turning TV screen on and off via RS232 commands.<\/p>\n But TV screen was not acting normally, it was always in standby mode.<\/p>\n So, either PC was not sending RS232 commands or TV screen was not responding to them<\/strong>.<\/p>\n In order to diagnose the problem, I decided to spy on their communication<\/strong>.<\/p>\n There are two types of communication in RS232<\/strong>: half-duplex and full-duplex.<\/p>\n In half-duplex<\/strong> while one device is talking another one is listening, just like people communication should be.<\/p>\n In full-duplex<\/strong> both devices are talking and listening at the same time, people think that they can do this also, but it is not working in practice.<\/p>\n The first step was to make special half duplex RS232 spy cable because I did not have software access on PC.<\/p>\n So the only solution was to sniff communication between PC and TV<\/strong>.<\/p>\n <\/a><\/p>\n Schematics are available from https:\/\/www.lammertbies.nl\/comm\/cable\/RS-232-spy-monitor.html<\/a>.<\/p>\n On the same website, there are also Schematics for full duplex RS232 spy cable.<\/p>\n For redirecting, all communication data from the RS232 compliant serial port device into a text file Eltima RS232 Data Logger<\/a> can be used.<\/p>\n The program is working fine, the only problem that I had was that there is no output on screen just to text file.<\/p>\n No real-time watching of communication data was possible, due to that I decided to make my own program for viewing RS232 communication data in real-time<\/strong>.<\/p>\nMy motivation for monitoring RS232 with Python.<\/h4>\n
half-duplex and full-duplex RS232<\/h4>\n
Hardware<\/h4>\n
Software<\/h4>\n
Python to the rescue<\/h4>\n