Electronic – How does this PIC board achieve RS-232 communication without a line driver

charge-pumpdiode-clamppicrs232serial

All the develooment boards I have seen yet with serial communication support usually have MAX232 line trasceiver. However, I have come across this Olimex PIC-LCD development board that does not have it. Rather, it seems to use discrete components to achieve the same aim. Below is the schematic. The RXD and TXD are connected to the PIC:

enter image description here

I am trying to understand how this works. For recieved data we would need to clamp the voltage to Vcc. For transmitted data we need to amplify the signal. I vaguely understand that there would be a simple clamp diode for the received data and a charge pump made up of capacitor and diode for the transmitter. The transistors are resistors are confusing me. What purpose do they serve?

Best Answer

enter image description here

Figure 1. Standard RS-232 logic and voltage levels. Source: Wikipedia.

enter image description here

Figure 2. Diagrammatic oscilloscope trace of voltage levels for an ASCII "K" character (0x4B) with 1 start bit, 8 data bits, 1 stop bit. Note that idle is a negative voltage.

RS232 uses negative voltage for logic 1 and positive voltage for logic 0. The 'idle' state is logic 1. As far as I can establish, this arrangement is historical and possibly because copper wires exposed to moisture - as they could be on telephone line applications - are less likely to corrode if the voltage is negative. Ref CodePainters.

Receive

The receive circuit in this circuit uses the high logic zero signal level to turn on Q4 and assumes everything else must be a logic 1. This is not in accordance with the specification which treats anything between -3 V and +3 V as "undefined". This circuit is cheating!

The circuit needs to do two things to convert to 5 V logic data stream:

  • Clamp the signal to 0 to 5 V. (R18 and D4 do this.)
  • Invert the logic to conventional "logic 1 = 5 V". (Q4 and R17 do this.)

The circuit would probably work without R27 but it may help to pull the base low in the event of small differences in potential between the two RS232 device grounds.

Transmit

The circuit assumes that the device at the other end requires a proper bi-polar signal for it to work properly. Without the MAX232 chip there is no onboard source of negative voltage. The problem is solved by stealing power from the RX line.

  • When the RX line is idle C9 will be charged negatively via D3.
  • TXD will normally be idle and at +5 V. This will turn off Q3 and R14 will pull pin 2 low giving the idle signal to the other device. (Hence we get logic inversion again.) Note that the other device's TX is now charging C9, drawing current through D4 and R18 as well as pulling its own RX low. You can expect the voltage to collapse somewhat.
  • When TXD pulls low (GND) Q3 will pull pin 2 high. This will tend to discharge C9 and put further stress on the pin 3 circuit.

The circuit will work in many cases but probably only over short distances. Noise immunity is greatly reduced compared with the standard. If the other device is cheating in a similar fashion the connection may not work well, if at all.

Note also that if the received data consisted of data with very few 'ones' that there may not be enough power to keep C9 adequately negative and the TX data may not be received at the other end. This would be unlikely in a half-duplex transmission as there would always be idle gaps.