2
\$\begingroup\$

Consider the very common case of communication between the UART peripheral of a microcontroller and a PC, using a USB-UART converter such as are available from FTDI and others[1].

If there's a non-trivial length of cable, then the characteristics will change depending on whether the conversion to USB is placed near the PC or the MCU.

  1. Place converter near MCU. UART link is short (may be TTL-level single-ended signals) and USB link is long.
  2. Place converter near PC. UART link is long (should be RS-422/EIA-422 differential pairs) and USB link is short.

USB, like EIA-422, uses differential signalling to reject common-mode noise. But which is the better choice for a multiple meter run of rugged cable?

I presume the advantage goes to EIA-422 because it is compatible with a wide range of twisted pair cables, while USB signalling requires specific impedance matching. On the other hand, USB is pervasive so cables with rugged protective jackets do also exist.


[1] All the converters I'm interested in use either 12 Mbps or 480 Mbps.

For the purposes of this question, let's assume a UART rate of 3 Mbaud, putting us well within the capability of full-speed (12 Mbps) USB.

For the purposes of this question, let's assume a cable length range of 2 to 10 meters.

Yes, single-ended serial, whether TTL or EIA-232, can achieve 3 Mbps in a quiet environment, but they are quite sensitive to interference.

\$\endgroup\$
17
  • 1
    \$\begingroup\$ How much is a non-trivial length of multiple meters of wire then? 1,2,3,4 or 5 meters, or more? Which USB protocol is used, 1.5, 12, 480 MBPS or something else? \$\endgroup\$
    – Justme
    Commented Aug 15, 2023 at 15:49
  • 1
    \$\begingroup\$ @TimWilliams By that logic, also RS485 and RS422 are just mostly differential as well. \$\endgroup\$
    – Justme
    Commented Aug 15, 2023 at 16:17
  • 1
    \$\begingroup\$ @BeB00: Not all symbols sent on USB have balanced opposite levels on D+ and D-. \$\endgroup\$
    – Ben Voigt
    Commented Aug 15, 2023 at 16:34
  • 1
    \$\begingroup\$ You will always be limited to the allowable length of the USB cable. \$\endgroup\$ Commented Aug 15, 2023 at 17:28
  • 1
    \$\begingroup\$ @ScottSeidman True, and also limited to multiple USB cables if you use hubs between cables, or limited to active USB repeater cables of few tens of meters, or limited to few hundred meters with USB CAT5 extender boxes, or few kilometers with USB fiber extenders. But are these viable or cost effective options, unlikely. \$\endgroup\$
    – Justme
    Commented Aug 15, 2023 at 18:16

1 Answer 1

1
\$\begingroup\$

The answer could be very simple.

You can buy ready made USB to TTL, USB to RS-485, USB to RS-422, and USB to RS-232 cables. Even directly from FTDI. Most of them have the USB chip right at the USB connector, as there are just cable and bare wires. The adapters with RS-232 on a DE-9 connector may better fit the USB chip at the DE-9 connector end.

USB has maximum length of 3 or 5 meters per cable segment depending on which USB version and speed is in question.

In practice, don't really count on it - I've seen a manual which tells users to use 1 meter or shorter cable to prevent problems - difficult to say do they know their device might not be the best, or do they suggest most PCs were not the best at handling USB, as there may be various quality and length differences of USB cabling inside a PC, for example from front panel to motherboard.

On the other hand RS-422 and RS-485 can hande up to 1200 meters, depending on implementation. RS-232 should go up to 15 meters without issues.

And the 3.3V TTL (CMOS really) adapter cable from FTDI works for 1 meter at 3 Mbps just fine. So for short lengths logic levels are no issue.

\$\endgroup\$
9
  • \$\begingroup\$ So your answer is "USB struggles with cables over a meter in a best-case environment, and even the converter manufacturer uses long serial / short USB so do the same"? \$\endgroup\$
    – Ben Voigt
    Commented Aug 15, 2023 at 16:55
  • \$\begingroup\$ @BenVoigt No I did not say that. The thing is the USB chip with transceivers typically fits inside USB plug and there is just no other and cheaper place to put the chip except right at the plug from where cable/wires stick out. USB should work well for 2-3 meters just fine and if you need more than 2-3 meters you have to anyway use an active hub/repeater/extender if you need to much beyond one 2m cable. \$\endgroup\$
    – Justme
    Commented Aug 15, 2023 at 17:12
  • \$\begingroup\$ "On the same circuit board as the MCU" is a viable option for converter chip placement, and there's also more than one place for a USB plug where the converter can be hidden -- right at the PC is one but also at the enclosure of the embedded device. \$\endgroup\$
    – Ben Voigt
    Commented Aug 15, 2023 at 17:20
  • \$\begingroup\$ @BenVoigt It is a viable option if you want to work within USB cable limits or extend it with hubs. If you need up to 10 meters, that's at least two hubs with two 5 meter cables if you want USB, or active extender cable if you trust them. If you use USB to RS-485 or RS-422 adapter cable, regardless of where the USB chip is, just add suitable connectors and cables for getting far beyond 10 meters. Which is why many devices don't use USB for long cabling. \$\endgroup\$
    – Justme
    Commented Aug 15, 2023 at 18:04
  • \$\begingroup\$ I never had problem with USB repeaters (even cheap ones). Max that I used was 20 m with data rate of 48 Mbps (+overhead) with no problems. Only problem was/is if you have bus powered device. In that case you can have problems even with much shorter cables. \$\endgroup\$
    – Rokta
    Commented Aug 15, 2023 at 18:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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