1
\$\begingroup\$

Currently I'm working on a little reverse-engineering project, where I want to understand the communication between the controlling software and a modem/DCE via serial port (RS232C).

EDIT: both the controlling software and the modem are from the early 90s, the software only runs on MS DOS. My laptop, which is supposed to do the work of understanding the communication, runs on Windows 10 and will be connected through a Serial to USB Adapter. (end of edited part)

For this purpose I already build a little listening device which mostly works fine. It looks like this:

enter image description here

I've drawn the circuit diagram but I got the 'blueprints' from http://airborn.com.au/serial/rs232.html, however, no description or explanation is provided there. I just build it and got lucky. Unfortunately I'm not as good in electronics as in the software-part of my project. I've got some simple questions first I hope someone can answer:

  • I think I kind of get why there needs to be a diode at line 2 ('Transmit Data' from a female point of view). To keep it one way? Is that correct? Or am I thinking too simple?
  • I am nowhere near an understanding of why line 3 ('Receive Data' from a female point of view) needs a resistor, instead of a diode. Why is that? And why the specific resistance of 2.2kOhm?

Now for the not so simple question (I think). I don't expect answers, maybe some tips or hints:

The software does an initialization sequence in order to see if the modem works and is connected. This initialization fails if I start the controlling PC and the modem while I am connected thorough my device. I am only able to get a successful initialization and to the actual main menu of the software if I disconnect one of the cables going to my listening computer (either the one with the diode or the one with the resistor). However, if I plug it back in after the initialization everything works fine, I can listen both ways again and the communication between controlling software and the modem is not impeded at all.

  • Why does this 'work around the initialization by unplugging one cable' approach work for either line, the diode- and the resistor-cable? I thought it would either matter which one to disconnect or I would have to disconnect both.

Thanks in advance!

\$\endgroup\$
  • \$\begingroup\$ You have a closed circuit between pin3 and pin2 through the diode and resistor. Why both are connected anyway? Are you assuming half duplex communication? How are you going to distinguish the incoming from outgoing? Add another diode on pin 2 as well. \$\endgroup\$ – Eugene Sh. Feb 8 '17 at 21:15
  • \$\begingroup\$ So far I distinguished incoming from outgoing data by unplugging either the cable from outgoing data (line 2) or from incoming data (line 3). I can assume half-duplex because of the structure of the data I receive if both cables are connected at once. \$\endgroup\$ – Tobitobitobi Feb 8 '17 at 21:28
  • \$\begingroup\$ If you are unplugging... Why do you need the third connector at all? \$\endgroup\$ – Eugene Sh. Feb 8 '17 at 21:29
  • \$\begingroup\$ The third connector? This is for my laptop where I listen to the active communication. I plan to mimic the controlling software at some point, but I'm not there yet in terms of understanding the commands. When I said 'unplugging' I meant single cables, not the whole connector. \$\endgroup\$ – Tobitobitobi Feb 8 '17 at 21:34
2
\$\begingroup\$

The resistor and diode combination could be replaced with two diodes but then you would need an additional resistor pulling the output down to a negative voltage.

The diodes can only pull the signal positive, not negative. RS232 operates between at least +5V and -5v (can be up to +/-15v)

By using the resistor instead of a diode it is possible to steal the negative supply from the other input; the resistor also acts as the path for the signal when that input is active.

The resistor is not critical - it has to be much lower than the input resistance of the receiver it is connected to but must not be so low that is loads down the signal it is monitoring.

A few kilohms is appropriate - I used 4.7k when I came up with an identical circuit 20 years ago to allow two terminals to be connected to the console input of a voicemail system.

kevin

\$\endgroup\$
  • \$\begingroup\$ Ahhh! I understand, thanks! I knew about the voltage window of RS232, but I actually didn't know a diode can only pull the signal positive. Sorry about my lack of basic knowledge... \$\endgroup\$ – Tobitobitobi Feb 8 '17 at 21:38
  • \$\begingroup\$ I built a similar dongle a long time ago allowing me to monitor both TxD and RxD (diode logically or'd). This works well for master/slave packet based communications that are inherently half-duplex. For full-duplex communications, I added dip-switches to disable monitoring of one or the other so they don't step on one another. It still comes in handy. \$\endgroup\$ – Tut Feb 8 '17 at 21:46
  • 1
    \$\begingroup\$ @Tut I just used two com ports :) \$\endgroup\$ – Eugene Sh. Feb 8 '17 at 22:35
  • \$\begingroup\$ I also use two COM: ports for listening when the traffic I am listening to is between two distinctly non PC devices. In today's USB centric world that becomes two USB <--> serial converter cables. On the other hand if one of the ports that I want to listen to terminates to/from a PC running a modern Window's OS then I use some software called a serial port monitor that wedges itself between the the Windows COM: port driver layer and relays the traffic through to a second Windows virtual COM: port driver. This allows full traffic snoop to be done without any added cables or circuits. \$\endgroup\$ – Michael Karas Feb 9 '17 at 8:28
  • \$\begingroup\$ (continued from above) Note that there are multiple serial port monitor programs available today. They vary a lot in quality and available features. Some of them work way better than others at high baud rates so make sure you test carefully to find the software that works best for your application. I recently used a setup like this to help me debug my own application. \$\endgroup\$ – Michael Karas Feb 9 '17 at 8:34
0
\$\begingroup\$

I think the interaction you see between your ports during initialization may be because the RS232 Rx implementation is far from modern (If you're in MSDOS era equipment).

For modern RS232 Rx implementations you don't actually need to have any negative voltage on the receiver input for operation.

For the vast majority of receivers today this is what an RS232 receiver looks like:

enter image description here

RIN2 is the +/9 V RS232 signal and ROUT2 is TTL off to the UART.

Here's the characteristics of the receiver input:

enter image description here

Note here that the input would never need to go beyond 0.2 V for correct operation. In fact most receivers work well with simply a TTL signal as input.

Based on the above, I would suggest that you replace your resistor with another diode. This provides a wired OR of the two RS232 signals (so they will still clash if the signal is full duplex), but they never go below zero at the signal input to the monitor PC RS232 input.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
  • \$\begingroup\$ Thanks for the answer! 'For modern RS232 Rx implementations you don't actually need to have any negative voltage on the receiver input for operation' I didn't know that. I thought, as Kevin White wrote in the first answer, 'RS232 operates between at least +5V and -5v (can be up to +/-15v)'. I just stole an oscilloscope from the office next to me and will test the signal. The equipment itself is from the early 90s, only my own laptop, which is supposed to listen, works on Windows 10. \$\endgroup\$ – Tobitobitobi Feb 10 '17 at 11:03
  • \$\begingroup\$ What I didn't mention (I will edit the question soon) is that I use a Serial to USB Adapter. Just a thought: is it possible that this has its own handshake procedure which interferes with the initialization? \$\endgroup\$ – Tobitobitobi Feb 10 '17 at 11:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.