Author Topic: RS-232 vs USB  (Read 41885 times)

0 Members and 2 Guests are viewing this topic.

Offline mojoeTopic starter

  • Frequent Contributor
  • **
  • Posts: 437
  • Country: us
RS-232 vs USB
« on: February 16, 2024, 07:09:37 pm »
The below question is mainly focused on devices that have a TTL serial interface, like a GPS receiver.

The BG7TBL GPSDO has a 9-pin RS-232 port on the front to let you talk to the GPS receiver inside. However, it is most likely that any of us would be using a serial to USB cable to connect to our computer (not counting an old computer that still has serial ports). Wouldn't it make more sense to eliminate the TTL serial to RS-232 to USB conversions, and go straight TTL serial to USB?

I bring this up because this applies to many DIY projects. I'm even thinking about building one of the GPSDO's mentioned on this forum. Are there any advantages to keeping the RS-232 serial port? Is it more immune to ground loops, or being blown up by voltage differentials between equipment? Or how about static discharge? I know that I've blown a USB port this way at least once.

One additional factor is that u-blox GPS receivers also have a built-in USB interface, which makes it even easier to use straight USB, eliminating the serial port entirely.
 

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 24116
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: RS-232 vs USB
« Reply #1 on: February 16, 2024, 09:39:33 pm »
USB requires a lot of software at each end.

RS232 doesn't even require any electronics; it can use electromechanical teleprinters/teletypes. You know, the "tty" devices in Unix systems :) Subsequently VDUs and other devices used TTL rather than mechanics.

I could easily create an RS232 interface and comms from scratch. Life would be too short to consider creating a USB interface from scratch :)

Whether that is an advantage is a separate issue, of course.
« Last Edit: February 16, 2024, 09:42:32 pm by tggzzz »
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline mojoeTopic starter

  • Frequent Contributor
  • **
  • Posts: 437
  • Country: us
Re: RS-232 vs USB
« Reply #2 on: February 16, 2024, 09:54:34 pm »
I'm not planning on writing my own USB stack. I'm talking about using an off the shelf TTL-USB adapter, then a standard USB cable to the PC. And, as I said above, u-blox receivers have USB built-in, in addition to the TTL serial. A few resistors and a connector should be enough to go straight USB, instead of the TTL serial interface.

Ignoring how it's done, does RS-232 with a MAX 232 chip have any real advantage over a TTL-USB adapter, considering very few computers have serial ports any more, and the RS-232 port would need a serial-USB cable to the computer.

It would be simpler to either go TTL serial to USB, or USB to USB, rather than TTL serial to RS-232 to RS-232 to USB to get to the computer. So, are there any downsides to eliminating the extra two RS-232 conversions in the middle?
 

Online magic

  • Super Contributor
  • ***
  • Posts: 7755
  • Country: pl
Re: RS-232 vs USB
« Reply #3 on: February 16, 2024, 10:03:47 pm »
RS232 has a standard connector, TTL UART does not and it's easier to screw up.

I once blew a TTL level GPS receiver module by connecting to a USB UART and accidentally missing the ground connection. The module was powered by a separate wallwart, with some capacitive leakage from mains to its output ground (normal thing) and in absence of ground connection this current forced its way through the module's UART interface somehow.

That being said, better protection in the module would have prevented this failure.
 

Offline moffy

  • Super Contributor
  • ***
  • Posts: 2671
  • Country: au
Re: RS-232 vs USB
« Reply #4 on: February 16, 2024, 10:11:34 pm »
I'm not planning on writing my own USB stack. I'm talking about using an off the shelf TTL-USB adapter, then a standard USB cable to the PC. And, as I said above, u-blox receivers have USB built-in, in addition to the TTL serial. A few resistors and a connector should be enough to go straight USB, instead of the TTL serial interface.

Ignoring how it's done, does RS-232 with a MAX 232 chip have any real advantage over a TTL-USB adapter, considering very few computers have serial ports any more, and the RS-232 port would need a serial-USB cable to the computer.

It would be simpler to either go TTL serial to USB, or USB to USB, rather than TTL serial to RS-232 to RS-232 to USB to get to the computer. So, are there any downsides to eliminating the extra two RS-232 conversions in the middle?
I think you might be misunderstanding the purpose of the RS-232 protocol. First, using the MAX chip would convert the TTL to a +/-12V protocol which is useful for distance communication in noisy environments because of the large voltage swings and noise immunity. Second, any serial TTL needs a protocol so that the data and control can be interpreted, in this case RS-232 is the protocol because it suits the use. If not RS-232, you would need say I2C or I2S, SPI etc. but they suit different requirements, RS-232 only needs a single wire apart from ground for Rx or Tx because it is self clocking. In the case of serial TTL some protocol is necessary and RS-232 is often chosen. Also RS-232 has USB drivers for pretty much all the OSs.
« Last Edit: February 16, 2024, 10:16:55 pm by moffy »
 
The following users thanked this post: Smokey

Offline tooki

  • Super Contributor
  • ***
  • Posts: 14753
  • Country: ch
Re: RS-232 vs USB
« Reply #5 on: February 16, 2024, 10:24:47 pm »
I'm not planning on writing my own USB stack. I'm talking about using an off the shelf TTL-USB adapter, then a standard USB cable to the PC. And, as I said above, u-blox receivers have USB built-in, in addition to the TTL serial. A few resistors and a connector should be enough to go straight USB, instead of the TTL serial interface.

Ignoring how it's done, does RS-232 with a MAX 232 chip have any real advantage over a TTL-USB adapter, considering very few computers have serial ports any more, and the RS-232 port would need a serial-USB cable to the computer.

It would be simpler to either go TTL serial to USB, or USB to USB, rather than TTL serial to RS-232 to RS-232 to USB to get to the computer. So, are there any downsides to eliminating the extra two RS-232 conversions in the middle?
I think you might be misunderstanding the purpose of the RS-232 protocol. First, using the MAX chip would convert the TTL to a +/-12V protocol which is useful for distance communication in noisy environments because of the large voltage swings and noise immunity. Second, any serial TTL needs a protocol so that the data and control can be interpreted, in this case RS-232 is the protocol because it suits the use. If not RS-232, you would need say I2C or I2S, SPI etc. but they suit different requirements, RS-232 only needs a single wire apart from ground for Rx or Tx because it is self clocking. In the case of serial TTL some protocol is necessary and RS-232 is often chosen. Also RS-232 has USB drivers for pretty much all the OSs.
I think it’s fair to assume that OP means UART when they say “TTL”. (And it’s probably what you mean when you talk about using RS-232 “protocol” on TTL.)

Regardless, a USB-UART bridge chip like FT232, CP2102N, CH340, etc. appears the same to the host computer regardless of whether it’s used directly with TTL voltages or connected to an RS-232 transceiver.
 

Online langwadt

  • Super Contributor
  • ***
  • Posts: 5417
  • Country: dk
Re: RS-232 vs USB
« Reply #6 on: February 16, 2024, 10:38:49 pm »
I'm not planning on writing my own USB stack. I'm talking about using an off the shelf TTL-USB adapter, then a standard USB cable to the PC. And, as I said above, u-blox receivers have USB built-in, in addition to the TTL serial. A few resistors and a connector should be enough to go straight USB, instead of the TTL serial interface.

Ignoring how it's done, does RS-232 with a MAX 232 chip have any real advantage over a TTL-USB adapter, considering very few computers have serial ports any more, and the RS-232 port would need a serial-USB cable to the computer.

It would be simpler to either go TTL serial to USB, or USB to USB, rather than TTL serial to RS-232 to RS-232 to USB to get to the computer. So, are there any downsides to eliminating the extra two RS-232 conversions in the middle?
I think you might be misunderstanding the purpose of the RS-232 protocol. First, using the MAX chip would convert the TTL to a +/-12V protocol which is useful for distance communication in noisy environments because of the large voltage swings and noise immunity. Second, any serial TTL needs a protocol so that the data and control can be interpreted, in this case RS-232 is the protocol because it suits the use. If not RS-232, you would need say I2C or I2S, SPI etc. but they suit different requirements, RS-232 only needs a single wire apart from ground for Rx or Tx because it is self clocking. In the case of serial TTL some protocol is necessary and RS-232 is often chosen. Also RS-232 has USB drivers for pretty much all the OSs.
I think it’s fair to assume that OP means UART when they say “TTL”. (And it’s probably what you mean when you talk about using RS-232 “protocol” on TTL.)

Regardless, a USB-UART bridge chip like FT232, CP2102N, CH340, etc. appears the same to the host computer regardless of whether it’s used directly with TTL voltages or connected to an RS-232 transceiver.

I see little point in using a rs-232 transceiver these days, it's not the 1990's anymore

 

Offline moffy

  • Super Contributor
  • ***
  • Posts: 2671
  • Country: au
Re: RS-232 vs USB
« Reply #7 on: February 16, 2024, 10:47:17 pm »
I'm not planning on writing my own USB stack. I'm talking about using an off the shelf TTL-USB adapter, then a standard USB cable to the PC. And, as I said above, u-blox receivers have USB built-in, in addition to the TTL serial. A few resistors and a connector should be enough to go straight USB, instead of the TTL serial interface.

Ignoring how it's done, does RS-232 with a MAX 232 chip have any real advantage over a TTL-USB adapter, considering very few computers have serial ports any more, and the RS-232 port would need a serial-USB cable to the computer.

It would be simpler to either go TTL serial to USB, or USB to USB, rather than TTL serial to RS-232 to RS-232 to USB to get to the computer. So, are there any downsides to eliminating the extra two RS-232 conversions in the middle?
I think you might be misunderstanding the purpose of the RS-232 protocol. First, using the MAX chip would convert the TTL to a +/-12V protocol which is useful for distance communication in noisy environments because of the large voltage swings and noise immunity. Second, any serial TTL needs a protocol so that the data and control can be interpreted, in this case RS-232 is the protocol because it suits the use. If not RS-232, you would need say I2C or I2S, SPI etc. but they suit different requirements, RS-232 only needs a single wire apart from ground for Rx or Tx because it is self clocking. In the case of serial TTL some protocol is necessary and RS-232 is often chosen. Also RS-232 has USB drivers for pretty much all the OSs.
I think it’s fair to assume that OP means UART when they say “TTL”. (And it’s probably what you mean when you talk about using RS-232 “protocol” on TTL.)

Regardless, a USB-UART bridge chip like FT232, CP2102N, CH340, etc. appears the same to the host computer regardless of whether it’s used directly with TTL voltages or connected to an RS-232 transceiver.

Sorry, I don't mean 'UART' because RS-232 vs TTL serial, which is undefined, has start bits, stop bits, parity bits and idle levels well defined baud rates with tolerances etc. it is more than just a UART it is a well defined protocol.
« Last Edit: February 16, 2024, 10:53:02 pm by moffy »
 

Online ejeffrey

  • Super Contributor
  • ***
  • Posts: 4448
  • Country: us
Re: RS-232 vs USB
« Reply #8 on: February 16, 2024, 11:07:48 pm »
RS232 has a standard connector, TTL UART does not and it's easier to screw up.

This.  RS232 is a standard and if you don't know who or what is going to be connecting to your UART, better use RS232 signal levels and a standard transceiver.  If you want someone to be able to just buy an off the shelf USB serial adapter and plug it in you want RS232.

RS232 is also much better than TTL for operation across cables.  They have specified drive strength and slew rate, good noise margin, and they have ESD protection.   
 
The following users thanked this post: Smokey, moffy, tooki

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 24116
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: RS-232 vs USB
« Reply #9 on: February 16, 2024, 11:28:27 pm »
How far will the computer be from your equipment, when being used in anger?

During development the two will be close, of course.

When deployed, will it be within th length restrictions of USB? If not, how is it used?
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline mojoeTopic starter

  • Frequent Contributor
  • **
  • Posts: 437
  • Country: us
Re: RS-232 vs USB
« Reply #10 on: February 16, 2024, 11:31:06 pm »
Sorry I asked my questions. All I'm getting is off topic, esoteric, engineer nit picking. tooki seems to be the only one who gets it. Let's just forget it and not clutter up the forum with more replies to this topic.
 
The following users thanked this post: tooki

Online tggzzz

  • Super Contributor
  • ***
  • Posts: 24116
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: RS-232 vs USB
« Reply #11 on: February 17, 2024, 12:20:00 am »
Sorry I asked my questions. All I'm getting is off topic, esoteric, engineer nit picking. tooki seems to be the only one who gets it. Let's just forget it and not clutter up the forum with more replies to this topic.

Alternatively it means your question was insufficiently constrained.
Alternatively it means other people have thought of aspects you haven't considered/understood (yet).

Either way, your response is unlikely to make.people want to try to help you in the future.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 
The following users thanked this post: moffy

Offline moffy

  • Super Contributor
  • ***
  • Posts: 2671
  • Country: au
Re: RS-232 vs USB
« Reply #12 on: February 17, 2024, 12:25:46 am »
Sorry I asked my questions. All I'm getting is off topic, esoteric, engineer nit picking. tooki seems to be the only one who gets it. Let's just forget it and not clutter up the forum with more replies to this topic.

Alternatively it means your question was insufficiently constrained.
Alternatively it means other people have thought of aspects you haven't considered/understood (yet).

Either way, your response is unlikely to make.people want to try to help you in the future.
Just what I was thinking but better stated than I could.
 

Offline robert.rozee

  • Frequent Contributor
  • **
  • Posts: 368
  • Country: nz
Re: RS-232 vs USB
« Reply #13 on: February 17, 2024, 12:37:22 am »
mojoe: your question was perfectly valid, but unfortunately most of the responders siply failed to read and/or understand what you originally wrote!

TTL-level serial (and indeed, 3v3 level too) is commonly used by many of us who tinker with microcontrollers. in this field, hardly anyone bothers with RS232 transceivers any more. the only thing lacking, however, is a standardized connector or pinouts.

most folks will use a 4-pin berg connector that can plug into a 0.1" pin header, simply because these are ubiquitous and the 4th pin is useful for carrying power, but pin order is undefined and there is no polarization - blanking plugs for berg connectors seem to be as rare as hens teeth. i believe the designers of picaxe did try to standardize on 3.5mm stereo plugs/sockets, but this never took off.

so what you say makes perfect sense, we just lack any standardizing of connector and pinout to follow.


cheers,
rob   :-)
 
The following users thanked this post: tooki

Offline rsjsouza

  • Super Contributor
  • ***
  • Posts: 6179
  • Country: us
  • Eternally curious
    • Vbe - vídeo blog eletrônico
Re: RS-232 vs USB
« Reply #14 on: February 17, 2024, 12:52:05 am »
Wouldn't it make more sense to eliminate the TTL serial to RS-232 to USB conversions, and go straight TTL serial to USB?
An enclosed product being used in an unknown environment can only benefit from using a robust interface such as RS232 instead of fragile connections directly to the main processor (or perhaps via some TTL drivers). Sure, the convenience of the TTL signals is better, but any accidents or overvoltage can potentially cause much more damage.
Vbe - vídeo blog eletrônico http://videos.vbeletronico.com

Oh, the "whys" of the datasheets... The information is there not to be an axiomatic truth, but instead each speck of data must be slowly inhaled while carefully performing a deep search inside oneself to find the true metaphysical sense...
 

Offline soldar

  • Super Contributor
  • ***
  • Posts: 3634
  • Country: es
Re: RS-232 vs USB
« Reply #15 on: February 17, 2024, 01:19:07 am »
I have designed and built RS232 interfaces and still use RS232 here and there for convenience and because it is simple and robust. I would not even think of doing the same with USB.
All my posts are made with 100% recycled electrons and bare traces of grey matter.
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 8108
  • Country: fi
    • My home page and email address
Re: RS-232 vs USB
« Reply #16 on: February 17, 2024, 01:23:53 am »
The BG7TBL GPSDO has a 9-pin RS-232 port on the front to let you talk to the GPS receiver inside. However, it is most likely that any of us would be using a serial to USB cable to connect to our computer (not counting an old computer that still has serial ports). Wouldn't it make more sense to eliminate the TTL serial to RS-232 to USB conversions, and go straight TTL serial to USB?
For most users, yes.  However, it would cost money to redesign the product (even for such a simple change), and it might alienate existing users who buy them in larger quantities –– those that do product integration.

The main issue is surprisingly isolation.  While full-speed USB 2.0 (12 Mbit/s maximum, about 1Mbytes/sec in practice, sustained) isolators exist and are relatively cheap (see ADuM3160 and similar; even the $10 eBay cheapies are okay if you check their isolated DC-DC converter, because the signal side is trivial), UART/TTL isolators are even cheaper, and isolated RS-232-to-USB interfaces are available off the shelf.
Check out my Public Domain design of ISO6721 UART isolator for example: just the IC and two bypass capacitors.

To add isolation to RS-232 or UART to USB dongle, you really only need a ISO6721 isolator (1.39€ in singles at Mouser, 0.633€ apiece for a full reel), some bypass capacitors, and optionally a low-power isolated DC-DC supply to power the RS-232 transceiver; say Murata NME1S0505SC, RECOM Power RFM-0505S, and so on (about 1.5€ in singles at Mouser).  Full-speed USB 2.0 isolators start at about 9€ in singles, 5€ apiece for a full reel at Mouser.  High-speed USB 2.0 isolators (ADuM3166, ISOUSB211, etc.) also require a 24 MHz crystal (or reference clock).

When connected to a computer, if the external device is powered from a separate source, the signal grounds may not have the exact same potential, which can lead to ground loops, and possibly even destroyed equipment.  Isolation is often overlooked, but really useful to avoid problematic situations like that.  The downside is that both sides of the isolator need separate supplies.  If you have an UART with some 20mA available at the logic level VCC pin, that well suffices even for very high data rates (several Mbaud), otherwise you need an isolated DC-DC converter, which can cause some electromagnetic noise issues (itself being a switch-mode supply device with a high-frequency transformer in it).

When the external device is powered by the computer, say from the USB 5V, there is obviously no need for isolation.

A secondary reason is that USB is inherently asynchronous, with latencies on the order of a millisecond or more from the device to an userspace application when using USB 2.0 low or full speed (1 Mbit/s or 12 Mbit/s).  UART and RS-232 (without hardware handshaking), on the other hand, is full duplex with the only delays being on the receiver side buffering (hardware and software).

I bring this up because this applies to many DIY projects. I'm even thinking about building one of the GPSDO's mentioned on this forum. Are there any advantages to keeping the RS-232 serial port? Is it more immune to ground loops, or being blown up by voltage differentials between equipment? Or how about static discharge? I know that I've blown a USB port this way at least once.
I would use an USB-to-UART adapter or a CH552G microcontroller (cheap, programmable with open source tools, easy to use) to interface to USB, and remember that you will not be able to receive a high-precision pulse train or even time via USB, because of the inherent latencies in low-speed/full-speed USB; even in the best case with kernel drivers you'll have jitter on the order of one millisecond (one USB low-speed/full-speed frame).  With high-speed USB 2.0, that decreases to about 125µs (1/8000 of a second)

One additional factor is that u-blox GPS receivers also have a built-in USB interface, which makes it even easier to use straight USB, eliminating the serial port entirely.
I only know about the software side, and know nothing about GPSDO per se, or about the signal grounding here.

Even if USB-powered, it may be useful to isolate the analog side from the digital side.  The isolated DC-DC controller can be chosen to boost the USB 5V to say 12V, which is then inverted and both positive and negative side regulated to produce the low-noise isolated analog rails.  For a more complex device, you might even have multiple isolated power domains.  There, knowing that isolating logic-level UART (2.5V to 5V) is cheap and easy even at several Mbaud, but isolating USB is much more expensive, is useful.

One of my own projects is an analysis probe using a Teensy 4.0 microcontroller, with an isolated high-impedance sampling front-end that contains both low-samplerate 16+-bit ADC, and a high-samplerate 8-bit ADC, plus a pair of analog comparators with reference voltages driven from a DAC connected to an UART.  The idea is that when I investigate an appliance (router, media box, etc. running some variant of Linux), I could probe running devices, with a program on my computer telling me the distribution of voltages on that pin and the exact average voltage, and even autodetect UART settings.
 
The following users thanked this post: Gertjan

Online PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 2843
  • Country: au
Re: RS-232 vs USB
« Reply #17 on: February 17, 2024, 03:47:22 am »
Are there any advantages to keeping the RS-232 serial port?

Simplicity and portability. 8) (tho in 2024 you really mean TTL-RS-232)

The GPS USB ports you mention are all done using USB bridge parts, so it is not a RS-232  'versus' USB question at all.

The only real question is on-board or off-board USB Bridge.  That decision is made for you, by the GPS module you select.

eg Adafruit have new modules with USB on-board
https://www.adafruit.com/product/4279
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 10328
  • Country: fi
Re: RS-232 vs USB
« Reply #18 on: February 17, 2024, 11:45:22 am »
This whole topic is can of worms because of so much mixup in terminology it's not even funny.

RS232 is signal level specification. Some people want to put it in volts. Don't be that guy. RS232 is not +/-12V. It is... RS232. You don't want to copypaste the whole specification every time you talk about it. RS232 is its name. Like you know, if your neighbor's name is Bob Richardson, then your neighbor is Bob Richardson and not "that guy who makes a million per year" when he might not do that. Also if you then call your another neighbor, who is not Bob Richardson, also Bob Richardson, that would be like super confusing. Only call the actual Bob, Bob.

Besides signal levels, RS232 standard specifies some other stuff like a few choices of recommended connectors, but in usual discussion the name is used in one of the two ways:
 1) incorrectly to mean really anything
 2) correctly to describe the signal levels

TTL is another signal level specification. 99.999% of "TTL serial" are not TTL and have absolutely nothing to do with TTL. Again, don't call your aunt Bob if she's actually Margaret. Don't say USB-TTL adapter when it's actually USB - serial with CMOS levels. Simple.

RS232 signal levels are getting exceedingly rare. They offer only minor (maybe one order of magnitude) of signal integrity advantage over 3.3V or 5V CMOS. The transceiver chip offers built-in ESD protection, but ESD protection can be had separately with much less hassle, too. RS422 for physical layer makes more sense for truly long links. RS232 only adds extra components for little gain, and the problem is, it requires others to make their circuits more complicated, too. The standardized D-sub connector is "nice", but it's all but disappeared from everyday use, so actually interfacing using this obsolete connector means users have to build more adapters, which is more work. Logic level UART on pin headers is easier for everyone else except that one guy who happens to have a RS232 adapter with D-SUB connector in his pocket. Or a computer from 1990's.

So it's not surprising to see that in 2020's, for simple serial interfaces, it's just 5V or 3.3V CMOS, possibly with some low-cost ESD protection components. This is fine for lab/debug use, and it's also fine for stuff that is permanently wired within enclosure. For something regularly connected and disconnected by users, possibly in harsh environment or long distances, consider RS422 over twisted pair instead, and let RS232 become history.
 

Offline tooki

  • Super Contributor
  • ***
  • Posts: 14753
  • Country: ch
Re: RS-232 vs USB
« Reply #19 on: February 17, 2024, 12:26:24 pm »
I'm not planning on writing my own USB stack. I'm talking about using an off the shelf TTL-USB adapter, then a standard USB cable to the PC. And, as I said above, u-blox receivers have USB built-in, in addition to the TTL serial. A few resistors and a connector should be enough to go straight USB, instead of the TTL serial interface.

Ignoring how it's done, does RS-232 with a MAX 232 chip have any real advantage over a TTL-USB adapter, considering very few computers have serial ports any more, and the RS-232 port would need a serial-USB cable to the computer.

It would be simpler to either go TTL serial to USB, or USB to USB, rather than TTL serial to RS-232 to RS-232 to USB to get to the computer. So, are there any downsides to eliminating the extra two RS-232 conversions in the middle?
I think you might be misunderstanding the purpose of the RS-232 protocol. First, using the MAX chip would convert the TTL to a +/-12V protocol which is useful for distance communication in noisy environments because of the large voltage swings and noise immunity. Second, any serial TTL needs a protocol so that the data and control can be interpreted, in this case RS-232 is the protocol because it suits the use. If not RS-232, you would need say I2C or I2S, SPI etc. but they suit different requirements, RS-232 only needs a single wire apart from ground for Rx or Tx because it is self clocking. In the case of serial TTL some protocol is necessary and RS-232 is often chosen. Also RS-232 has USB drivers for pretty much all the OSs.
I think it’s fair to assume that OP means UART when they say “TTL”. (And it’s probably what you mean when you talk about using RS-232 “protocol” on TTL.)

Regardless, a USB-UART bridge chip like FT232, CP2102N, CH340, etc. appears the same to the host computer regardless of whether it’s used directly with TTL voltages or connected to an RS-232 transceiver.

Sorry, I don't mean 'UART' because RS-232 vs TTL serial, which is undefined, has start bits, stop bits, parity bits and idle levels well defined baud rates with tolerances etc. it is more than just a UART it is a well defined protocol.
But that’s not the point here. OP’s question is why you would use a USB-RS232 adapter, only to then convert RS-232 signal levels to TTL signal levels internally, when you could skip the RS-232 level conversion using the TTL signals of the USB-serial bridge directly.

To the host computer, it’s the same USB-serial bridge. It does not see what the voltage levels are and it doesn’t care. To it, it’s a serial port.
 

Offline tooki

  • Super Contributor
  • ***
  • Posts: 14753
  • Country: ch
Re: RS-232 vs USB
« Reply #20 on: February 17, 2024, 12:54:57 pm »
This whole topic is can of worms because of so much mixup in terminology it's not even funny.
True, but I think your own understanding of it is not quite right, either!

This whole topic is can of worms because of so much mixup in terminology it's not even funny.

RS232 is signal level specification. Some people want to put it in volts. Don't be that guy. RS232 is not +/-12V. It is... RS232. You don't want to copypaste the whole specification every time you talk about it. RS232 is its name. Like you know, if your neighbor's name is Bob Richardson, then your neighbor is Bob Richardson and not "that guy who makes a million per year" when he might not do that. Also if you then call your another neighbor, who is not Bob Richardson, also Bob Richardson, that would be like super confusing. Only call the actual Bob, Bob.
Well no, it’s not just signal levels, though that’s arguably the most defining part of RS-232 compared to related RS standards.

Besides signal levels, RS232 standard specifies some other stuff like a few choices of recommended connectors, but in usual discussion the name is used in one of the two ways:
 1) incorrectly to mean really anything
 2) correctly to describe the signal levels
In all fairness it specifies a lot more than signal levels and connector pinouts. It also encompasses baud rates, timing, etc. In this regard ejeffrey is correct, that using RS-232 prevents a lot of configuration problems.

TTL is another signal level specification. 99.999% of "TTL serial" are not TTL and have absolutely nothing to do with TTL. Again, don't call your aunt Bob if she's actually Margaret. Don't say USB-TTL adapter when it's actually USB - serial with CMOS levels. Simple.
Technically correct, but we know it’s also very common usage to say “TTL” as shorthand for “5V logic levels of any kind” even though CMOS and TTL aren’t entirely compatible. Since practically everything these days is actually CMOS, this is more of a problem in theory than in practice.

RS232 signal levels are getting exceedingly rare. They offer only minor (maybe one order of magnitude) of signal integrity advantage over 3.3V or 5V CMOS. The transceiver chip offers built-in ESD protection, but ESD protection can be had separately with much less hassle, too. RS422 for physical layer makes more sense for truly long links. RS232 only adds extra components for little gain, and the problem is, it requires others to make their circuits more complicated, too. The standardized D-sub connector is "nice", but it's all but disappeared from everyday use, so actually interfacing using this obsolete connector means users have to build more adapters, which is more work. Logic level UART on pin headers is easier for everyone else except that one guy who happens to have a RS232 adapter with D-SUB connector in his pocket. Or a computer from 1990's.
Exceedingly rare? Uh, no, they’re still all over the place, even on new gear. RS-232 transceivers are readily available and widely used, as are the D-sub connectors used with them. They’re no longer common on the host PCs, but are common on servers and industrial PCs.

Logic level UART on a header is great for tinkering and for connections between boards. But it’s not convenient for connecting standalone devices.

You know what is exceedingly rare, to the point of being essentially nonexistent nowadays? RS-422 signal levels. Why? Because RS-485 signal levels completely encompass RS-422 signal levels, so the transceiver manufacturers simply make the transceivers use RS-485 signal levels, sell them as being for RS-422/485 and leave it up to you to use them as RS-422 (which defines connectors, data rates, etc) or something else. (That is to say: some RS-422 signal levels are not compliant with RS-485 signal levels, but RS-485 signal levels are always compliant with RS-422 signal levels. So you can always use an RS-485 transceiver in place of a true RS-422 transceiver, but not vice versa.)

I’d rather see RS-485 used instead of RS-232 when a signal needs to go over longer distances than TTL/CMOS logic levels can handle reliably. But the inconsistent pinouts of RS-485 connectors are a significant handicap.
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 10328
  • Country: fi
Re: RS-232 vs USB
« Reply #21 on: February 17, 2024, 03:10:40 pm »
Well no, it’s not just signal levels, though that’s arguably the most defining part of RS-232 compared to related RS standards.

That compared thing was the whole point and assumed. When one compares UART over RS-232 to UART over other signalling standards, then RS232 adds just voltage level ranges.

Quote
that using RS-232 prevents a lot of configuration problems.

Compared to the increasingly usual logic level directly out/in of the very same microcontroller pins that would otherwise drive the transceivers, there is no difference whatsoever in configuration.

Quote
Technically correct

The best kind of correct. Mislabeling CMOS logic level as "TTL" in this context dates back to some Chinese adapter cables during last ten years. Natural everyday language being in constant change is one thing, but in technical context, I continue my quest to correct incorrect and misleading terminology, no matter how futile it may seem. Misuse of LDO is a very similar case. I can change my mind after the misuse has continued for over 50 years and all relevant Wikipedia articles have been rewritten to reflect the new meaning.

Quote
“TTL” as shorthand for “5V logic levels of any kind”
I personally write "5V UART" or "3.3V UART" on my designs (documentation / pinouts / PCB/case silk screen). These are shorthand and everybody understand what they mean and them being correct (both technically and practically) does not hurt. Then I don't have to resort to random misused terminology like the sickening "RS232 TTL" which most people also understand but only because they would understand even "Adolf Hitler TX/RX" in that context - because they know the product has a serial port and it's probably this randomly named thing.

Quote
Exceedingly rare?

Yes. I have worked in several fields which do not cover everything, but have seen zero RS-232 ports in last decade or so in new designs. Automation and sensors use RS422/485, CAN, Ethernet, USB, whatever. RS232 was only widely used in different kind of data terminal equipment (computers and their peripherals), terminal interfaces for configuration / text interfaces, configuration interfaces of routers and industrial equipment. Most of this has gone WiFi, USB, Ethernet. Some CAN. Modbus over RS485 stays strong. Probably some modern-day router still has an RS-232 port for legacy convenience, but otherwise what's left is some low-cost / simple maintenance/debug/firmware update interfaces and that is exactly the thing where I can clearly see the transition from RS232 to transceiver-less 3V3 UART.

15 years ago you could see a DB9 on a freaking DVB TV set top box for firmware update no one would ever actually perform! Modern-day equivalent for this is pin headers (possibly unpopulated) on the PCB. I applaud this cost optimization. It was awkward to use when RS232, it's not any more awkward now.

But I'm sure you are thinking about some niche what I'm completely missing where RS232 stays popular. Of course you would then use RS232 on that field to maintain compatibility. Then again if this was the case, OP would not be asking. Due to the fact that fewer and fewer people carry around RS232 UART to USB adapter cables, I have no reason to recommend it for new designs for any purpose. For those simple cheap-ass configuration interfaces, or modules which communicate with user microcontroller (like sensors connecting to single-board computers, this is not only for hobby stuff), just logic level UART. For more serious data rates, hot plugging, harsh conditions, or long wiring, then neither logic level UART nor RS232 UART, but something completely different, like Ethernet, CAN or RS422/485.
 

Offline bk81

  • Newbie
  • Posts: 3
  • Country: us
Re: RS-232 vs USB
« Reply #22 on: February 18, 2024, 05:37:15 pm »
Regarding the original question of whether USB is the way to go for hobby projects, I'd say yes in most cases.  I've now done multiple projects that way as a hobbyist.  Its very convenient to test/use the board because you can just plug it into your laptop and go.  No RS232 dongle, no terminal application, no external power supply. 

There is a price to be paid though.  The firmware complexity goes up a lot.  And if you want to use something other than the CDC driver with a terminal application, a custom interface application might be needed as well.  Finally, the power supply might be more complex in the case of a 5V supply or if you need a really low noise supply for analog circuits. 

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf