23
\$\begingroup\$

I would like to avoid using RS-232 converters between two microcontrollers on two different boards. For various reasons, only UARTs are supported, e.g. no SPI or I2C, and I will be using CAT5E cable to RJ45 jacks between the boards. The data rate will be 115200bps, possibly up to 921600bps. Ground is connected along with the UART signals.

While I currently have it working at the lengths I need it, for my own education, is there a way to estimate the maximum cable length at which this would be reliable?

\$\endgroup\$
5
  • 1
    \$\begingroup\$ This lammertbies.nl/comm/info/RS-232_specs.html may be helpful "If for example UTP CAT-5 cable is used with a typical capacitance of 17 pF/ft, the maximum allowed cable length is 147 feet." \$\endgroup\$
    – kenny
    Commented May 15, 2012 at 15:01
  • 3
    \$\begingroup\$ Real RS232 has a voltage swing of more than 10 Volt between mark and space state. And the 147 feet is for 19200 baud only. OP is talking about 3V3 UART and 115200 to 921600 baud: This will work only with relatively short cables. \$\endgroup\$
    – Turbo J
    Commented May 15, 2012 at 18:04
  • 3
    \$\begingroup\$ May I suggest RS422 tranceivers? They would fit CAT5E twisted pair cables much better. \$\endgroup\$
    – Turbo J
    Commented May 15, 2012 at 18:09
  • \$\begingroup\$ Not an option, unfortunately. \$\endgroup\$ Commented May 15, 2012 at 19:20
  • \$\begingroup\$ I have a question: why are 422 tranceivers not an option? \$\endgroup\$
    – DiBosco
    Commented Oct 31, 2017 at 8:35

2 Answers 2

18
\$\begingroup\$

There is no single safe answer. It has a lot to do with the length of the cable, surrounding electrical noise, and how fast you want to go. Ethernet uses CAT5 cable to transmit at 10 Mbit/s for the slowest variety, so 1 Mbit/s is easily doable if you take the proper precautions. Note that with ethernet each signal gets its own twisted pair, and each pair is carefully terminated at the characteristic impedance of the cable at each end. Each pair is driven differentially and interpreted differentially, and is also designed so that it can't cause ground loops.

If you do all these thing, you can transmit 1 Mbit/s data on CAT5 cable for long distances, like 1000 meters. As you do less of these things, the usable distance will go down. If it's just board to board in the same chassis, for example, then you probably don't need to do much special. If you're going outside the unit, then differential line drivers and receivers could be useful.

Try something in your setup and look at the signals at the receiving end to get some idea of the noise margin, adjust as needed. Maybe use a protocol that can detect and recover from errors, and keep track of how often that is happening. There are too many ways to list here without more information.

\$\endgroup\$
3
  • 2
    \$\begingroup\$ Just because you can get 145m out of Ethernet does not mean you would get the same out of a 3.3V TTL signal down the same cable just because you are using a lower bit rate, see explanation in my answer. \$\endgroup\$
    – Jay M
    Commented May 15, 2012 at 21:25
  • 2
    \$\begingroup\$ @Jason: Note that I didn't say you would. I said you could get long distances with the proper precautions, such as differential line drivers and receivers and terminated ends. \$\endgroup\$ Commented May 15, 2012 at 22:55
  • 4
    \$\begingroup\$ @Olion: From your post you seem to state it is more about the characteristics of a cable, rather than why a 3.3V TTL won't travel far down it. To me it reads as a suggestion to buy a good cable, which we both know is wrong. \$\endgroup\$
    – Jay M
    Commented May 16, 2012 at 5:59
12
\$\begingroup\$

Ethernet uses differential signalling, a TTL signal is single ended.

Ethernet uses pre-emphasis, TTL does not.

Ethernet is current mode, TTL is voltage mode.

Ethernet uses a modulation tachnique that reduces the number of edges, your TTL might not (standard ASYNC certainly do not)

Ethernet driver and receiver are impedance matched to the cable, unless carefully designed, TTL would not be (and if it were, then it would not be TTL!)

Ethernet uses a symetrical signal (by use of scambling) to create an even 1's density. ASYNC serial has a built in bias which charges the cable and has to be be overcome to get a signal out the other end.

For these reasons, just because you can get 145m out of Ethernet at 1Gbps does not mean you would get the same (or even 1000 times less) out of a 3.3V TTL signal down the same cable.

I recommend using a differential signalling driver such as RS422, that is what it is designed for. Indeed RS422, though run at a lower voltage is better for long runs because of the differential signalling (RS232 is single ended),
Also, the drivers and receivers do clever things to improve the quality of edges such as pre-emphasis.

\$\endgroup\$
5
  • 1
    \$\begingroup\$ The OP already had stated 3 hours before your answer that RS422 transceivers were not an option. \$\endgroup\$
    – tcrosley
    Commented May 15, 2012 at 23:26
  • 8
    \$\begingroup\$ Yes, I can read. I can still recommend the correct solution. Just because the poster does not like to hear the truth, it does not mean that it should not be told. \$\endgroup\$
    – Jay M
    Commented May 16, 2012 at 5:55
  • 2
    \$\begingroup\$ Why are you calling it TTL all the time? Title says 3.3V, so it's definitely not TTL. TTL drive has very asymmetrical sink/source capabilities, while HCMOS is symmetrical. Can make a world of difference driving a cable. \$\endgroup\$
    – stevenvh
    Commented May 16, 2012 at 9:34
  • 1
    \$\begingroup\$ What is "pre-emphasis"? \$\endgroup\$
    – m.Alin
    Commented Oct 31, 2017 at 8:04
  • 1
    \$\begingroup\$ Preemphasis is a technique where the drive strength (i.e. output impedance) is modulated during the transmitted pulse. It's used to compensate for capacitive and inductive characteristics of the cable and magnetics in an attempt to present better quality edges to the receiver. \$\endgroup\$
    – Jay M
    Commented Nov 1, 2017 at 11:20

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