22

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?

QuestionMan
  • 1,145
  • 2
  • 10
  • 19
  • This http://www.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." – kenny May 15 '12 at 15:01
  • 3
    *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. – Turbo J May 15 '12 at 18:04
  • 3
    May I suggest RS422 tranceivers? They would fit CAT5E twisted pair cables much better. – Turbo J May 15 '12 at 18:09
  • Not an option, unfortunately. – QuestionMan May 15 '12 at 19:20
  • I have a question: why are 422 tranceivers not an option? – DiBosco Oct 31 '17 at 08:35

2 Answers2

17

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.

Olin Lathrop
  • 310,974
  • 36
  • 428
  • 915
  • 2
    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. – Jay M May 15 '12 at 21:25
  • 2
    @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. – Olin Lathrop May 15 '12 at 22:55
  • 4
    @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. – Jay M May 16 '12 at 05:59
11

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.

Jay M
  • 3,753
  • 15
  • 30
  • The OP already had stated 3 hours before your answer that RS422 transceivers were not an option. – tcrosley May 15 '12 at 23:26
  • 8
    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. – Jay M May 16 '12 at 05:55
  • 2
    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. – stevenvh May 16 '12 at 09:34
  • What is "pre-emphasis"? – m.Alin Oct 31 '17 at 08:04
  • 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. – Jay M Nov 01 '17 at 11:20