6

I want to interface a microcontroller with the RS-232 COM port of my PC.

My PC uses a 75232G IC, which uses +/-12V logic levels as per some multimeter tests.

Currently I'm planning to use the TRS3243ECRHBR IC as the transceiver between the MCU and the PC COM port.

What I don't understand is if I have to make sure that the logic levels used between the two ICs are the same.

The RS-232 standard defines logic levels in the range +3V/+15V and -3V/-15V to be valid, meaning that any IC that supports RS-232 should recognize and tolerate those voltage ranges. Does this mean that the transceiver that I use must output +/-12V as well?

Looking at the absolute maximum ratings for the TRS324 it looks like it can handle more than the +/- 12V I'm receiving from the PC, but looking at the Electrical characteristics table I see that the driver output voltage is listed as +/-5.4V.

enter image description here

enter image description here

Does that I will receive signals at +/-12V and send them at +/-5V? Is this acceptable (they are in range +/-[3-15]V) or should they be equal?

JRE
  • 67,678
  • 8
  • 104
  • 179
StefanoN
  • 480
  • 2
  • 12
  • 3
    As you stated, a legal RS-232 High signal is between 3 V and 15V and Low is -3 V to -15V. Is +/- 5.4 V between these limits? – Peter Bennett Jan 25 '23 at 23:42
  • 1
    @PeterBennett yes it is, but being used to making sure I don't mix 5V and 3.3V TTL logic it's strange to mix logic levels in RS232, had to ask :) – StefanoN Jan 25 '23 at 23:44
  • There was no 3.3V TTL (I think..?!); but 3.3V [LV]CMOS is quite common today. – Tim Williams Jan 26 '23 at 05:24

3 Answers3

9

The standard document that defines this all is EIA/TIA-232-F from 1997. To get the whole glorious 29 pages document, you'd need to pay around USD 160 to some organisation. You might get lucky if you look on google (I won't add a link for reasons) but the RS-232 Wikipedia entry is a good starting point.

The standard states, that the input of a receiving part has to accept -15V to -3V as logical 1 (called mark) and +3V to +15V as logical 0 (called space) on the data lines. Voltages between -3V and +3V at the receiver are undefined. Keep in mind, that on the status lines, a positive voltage over 3V means "active".

So essentially the goal of the transmitter is to get those levels at the receiver.

The standard states that a transmitter must provide at least 5V into a load of 3kOhm to 7kOhm. It also states a maximum cable capacitance of 2500pF. Cable lenghts above 20m are not covered by the standard. In reality, cable lenghts in excess of 100m are possible and in use with low capacitance cables and reduced bitrates.

Don't forget that the output of the USART of a microcontroler is not RS-232. It's serial with TTL levels. Its electrically not compatible. But with simple and cheap level converters, it becomes RS232.

So when connecting your stuff always make sure that you only connect stuff with the same voltage levels (either RS-232 to RS-232 or TTL to TTL) together.

A lower output voltage level of your transmitter might reduce the maximum cable lenght you can use or force you to reduce the speed of the connection. But in most cases it does not matter at all.

kruemi
  • 2,994
  • 16
  • 29
  • 4
    Actually the RS-232 standard that defines all this is from 1960. The F version may have beel released in 1997, but it's since been revised in 2012. – Justme Jan 26 '23 at 08:10
  • 1
    @Justme was it revised or just renamed from EIA-232 to TIA-232 because EIA ceased to exist in 2011? https://en.wikipedia.org/wiki/Electronic_Industries_Alliance. Because it seems that it's still revision F from 1997 that's regardeed as current. – kruemi Jan 26 '23 at 13:17
  • So is the answer to OPs question "yes" or "no"? If levels are allowed to vary between 3...15V, why would TTL (5V) levels not be compatible? (Nothing wrong with your answer, but it would be nice to point that solve that conundrum with a sentence or two.) – AnoE Jan 27 '23 at 11:24
  • @AnoE if you connect an RS-232 output to a TTL input you'll break the TTL input within a short period of time. TTL doesn't take kindly to negative inputs and voltages higher than Vcc. The other way around the RS-232 won't know how to handle the 0V from TTL because anything beween +3V and -3V is undefined. – kruemi Jan 28 '23 at 06:41
  • I'd suggest to add that to the answer, @kruemi. I mean these are the main questions OP are asking... a clear "No, because ...(what you wrote in your comment)...". OP unfortunately has accepted that very short other answer already, but yours is most high-voted, so nice to make it perfect. ;) – AnoE Jan 30 '23 at 10:56
  • 1
    ... als be sure to take the fact into account that OP does seem to intend to use some transceiver, so TTL might not even be of interest... – AnoE Jan 30 '23 at 10:57
7

No, devices are not required to use same voltage levels, that is the point of RS-232 standard.

They can use different voltage levels, as long as the levels are within the limits given in the standard.

Justme
  • 127,425
  • 3
  • 97
  • 261
3

Logic compatibility basically comes down to:

  1. Output range exceeding the input threshold range in the worst case
  2. Allowed input voltage range

A driver should also have a reasonably short rise/fall time.

#1 is so that, when connected to any compatible source/output/driver, no input is left floating at an indeterminate level.

Which is further so that we can call it "digital" in the first place. Digital is a strict subset of analog: all real signals vary continuously over time, and are no more quantized than the astronomical number of electrons flowing through a circuit. Digital is a simplification, where we push voltages (or whatever is representing the signal) to extremes so that we can ignore the continuity of the signal, and its smooth rate of change, and instead use boolean logic with propagation delays. (Which you can see also dictates risetime: too slow and it spends a long time in the indeterminate range.)

So, here we want the output voltage to exceed the input threshold range, so that the input reads a stable value. And this should remain true even in the presence of noise -- that is, a driver should supply an additional margin beyond the input threshold range, so we can handle some signal bounce, or interference, without corrupting the reading.

Most signal transmission standards use extra voltage range to account for cable losses, termination resistors, etc. as well as noise. For example, RS-422/485 has a strong output level (approx. ±2-5V), and fairly narrow threshold (typ. <100mV), and can transmit over hundreds of meters of cabling. It uses terminated lines, typically Z0 ≈ 100Ω, so a cable length corresponding to a few hundred ohms of copper resistance is enough DC loss alone to be problematic (let alone at AC!). This is a pretty generous distance, so you can see it works pretty well.

RS-232 uses a single high-impedance line, driven at high voltage to account for noise margin as well as losses. It isn't terminated like RS-422/485 are, but line losses and leakage (and required baud rate) contribute to limit the maximum length.

To be perfectly clear -- line length means reduced signal level. The situation that you imagine, is a natural thing, and already designed in and accounted for by the standard. :)

#2, is mostly driven by how ESD diodes clamp the input. There are other cases (like TTL doesn't have ESD diodes per se, but the way it's fabricated ends up handling that automatically (...I think?)), but clamp diodes are the most common case.

Now, the RS-232 receiver doesn't have supply clamp diodes, so it is okay to connect to anything making a valid logic level (i.e. ±3 to 25V).

You can get some idea of ESD diodes from the datasheet's absolute maximum ratings: typically a 0.2-0.5V limit referenced to a supply implies a diode there. A fixed limit (not dependent on a supply) implies a zener or other ESD device. Sometimes a current injection limit will also be specified, or an equivalent circuit provided (in which case, the diodes are shown explicitly, and can be relied upon for design purposes, at least within current limits, mind!).

RS-232 requires a ±25V minimum receiver range; presumably zener diodes or other ESD structures will clamp voltages outside of this range.

So with this, your confusion should be not only solved, but you should be prepared to interface anything to everything! Well, anything of binary logic levels at least, heh.

Tim Williams
  • 22,874
  • 1
  • 20
  • 71