Electronic – RS-232 signal level inversion

logic-levelrs232

Bit of a noob question but i'm having trouble understanding rs-232.

I'm sending data out over serial on an Atmel XMEGAA1U chip located on an Atmel XMEGA Xplained pro broad.

If i send binary 0000 0001, what is received at the other end (seen through a protocol analyzer) is 1111 1110.

From what i understand (google) this is normal as rs-232 inverts the logic.

What i don't know is whether I have to accommodate this inversion and flip the logic so the receiving end can just read it raw or if its normally the job of the receiving party to do the inversion.

What the "Standard" case of sending rs-232?

My requirements are just to send data over rs-232 with no mention of doing any logic conversion.

Thanks

Best Answer

The normal configuration for an RS-232 link between two pieces of equipment is this:

schematic

simulate this circuit – Schematic created using CircuitLab

As shown above as well as changing the voltage levels the line drivers (typically a MAX232 or some similar part) also invert the signals. As long as you use line drivers at both ends of the link (or skip them completely and run the link at logic levels) then you don't need to worry about the signal inversion.

There are also some cheap hacks of RS-232 drivers used for hobbyist systems which invert the signal but don't give the voltage levels required by the RS-232 specification and so you may sometimes see signal levels of 0 to 5 V rather than the -3V to +3V minimum range required by the RS-232 specification. While technically a violation of the specification these will normally work fine at lower speeds.

Hopefully this also explains why you need to be careful not to connect the TTL level serial interface you get out of most processors directly to an RS-232 port. Not only will the signal be inverted and so not work as a data link, few processors can take -15V on their IO pins without going pop.