Stories
Slash Boxes
Comments

SoylentNews is people

posted by janrinok on Monday March 13 2023, @04:04PM   Printer-friendly
from the hard-to-kill-these-serials dept.

Why Do Some Modern Computers Still Have Serial Ports?:

While the parallel port is now safely buried in the grave of obsolescence, it may seem odd that the humble, slow serial port is still around. But as it turns out, bit-by-bit, this humble communications port has become essential.

[...] Serial ports are slow with the standard speed at the high end of the range coming in at a pedestrian 115.2Kbps. At that speed, it would take you almost a day to transfer 1GB of data! That's under ideal circumstances, and things can be much, much slower than that.

If we have USB, and serial ports are so slow and comparatively bulky, why the heck do some computers still have them? There are a few reasons, but the most important ones include:

  • Lots, and lots, of industrial and scientific equipment are still in service and use serial ports to interface.
  • It's simple, reliable, well understood, and much cheaper to implement than other more modern port types.
  • Hobbyists have uses, such as programming microcontrollers.

Do you still use the serial port, or do you depend on equipment that does? I have noticed that it is still widely used in medical equipment but are there other fields in which the serial port is the standard interface?


Original Submission

This discussion was created by janrinok (52) for logged-in users only, but now has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
(1)
  • (Score: 5, Informative) by Opportunist on Monday March 13 2023, @04:17PM (28 children)

    by Opportunist (5545) on Monday March 13 2023, @04:17PM (#1295918)

    Have you ever tried to implement something low-level on USB? That protocol is a nightmare, only rivaled by the even more insane Bluetooth protocol. USB is fairly heavyweight, especially for the master devices.

    It is trivial to implement, trivial enough that even the smallest and cheapest MC has an UART interface baked into the silicone. I mean, the protocol is like 50 years old, and ICs back then had to be able to handle it, you bet that current chips run circles around that. And this also makes it very attractive as an "emergency" management interface for things like routers, where you can put the whole serial communication over RS232 into the non-flashable (and thus non-brickable) part of the firmware. That standard is SO old that even Netgear by now managed to implement it correctly.

    You also don't need any too sophisticated or fast switching hardware for it. It's a very trivial interface, no twisted pairs of signals or complicated handshakes you need to observe, it's raw, pure "signal or no signal", on or off, 5V or 0V (or -9 to 9 if level shifted). And what that means is, technically, entirely up to you. You might want to adhere to a standard if you don't just want to communicate with another device you designed, but whether you do is something the interface doesn't really care that much about.

    • (Score: 5, Interesting) by Revek on Monday March 13 2023, @04:30PM (1 child)

      by Revek (5022) on Monday March 13 2023, @04:30PM (#1295921)

      Its been a few years but I was a superstar locally for being able to flash a bunch of commercial hd receivers without bricking them. All due to the fact I used a old and I do mean old windows XP laptop with an actual hardware uart serial port. The company that manufactured them would do it for free but it required them being shipped there and there was a several day back log. A usb serial connection bricked them three out of four times. Anytime I doing anything that involves flashing hardware I use a real serial port.

      --
      This page was generated by a Swarm of Roaming Elephants
      • (Score: 2) by Opportunist on Monday March 13 2023, @04:53PM

        by Opportunist (5545) on Monday March 13 2023, @04:53PM (#1295925)

        My server here has a dedicated serial card. It has served me well many, many times.

    • (Score: 5, Informative) by stormwyrm on Monday March 13 2023, @04:42PM (14 children)

      by stormwyrm (717) on Monday March 13 2023, @04:42PM (#1295924) Journal
      Yep. RS-232 is so simple that it's ubiquitous in embedded systems. I've been doing some experiments with FPGAs and found that a basic UART can be done in less than a hundred lines of Verilog or VHDL. It is not so hard to bit bang even on a small CPU; most of the tricky business is in getting the timings right. USB is crazy complicated by comparison: just the spec on power alone is like 100+ pages.
      --
      Numquam ponenda est pluralitas sine necessitate.
      • (Score: 4, Informative) by Opportunist on Monday March 13 2023, @04:58PM (5 children)

        by Opportunist (5545) on Monday March 13 2023, @04:58PM (#1295927)

        With most contemporary MCUs, firing up UART communication is a matter of a few lines in assembler.

        Turning that into a full blown RS-232 interface usually requires something like a MAX232 chip, though, they only speak 0-3V3 or 0-5V (which makes kinda sense if you think about it, so all is good).

        • (Score: 1, Informative) by Anonymous Coward on Monday March 13 2023, @06:11PM (4 children)

          by Anonymous Coward on Monday March 13 2023, @06:11PM (#1295945)

          For reference (in case someone doesn't know), MAX232 chip [ti.com] shifts 3.3 or 5V (TTL) signals to proper RS-232 ±12V (up to ±25V) signal levels, although "proper" signal voltage isn't clearly defined, and variations are a-plenty [wikipedia.org].

          From TI .pdf (with my clarifications in [] ):

          3 Description:
          The MAX232 device is a dual [line (where "line" = wire/cable)] driver/receiver that includes a capacitive voltage generator to supply TIA/EIA-232-F [±12-25V] voltage levels from a single 5-V supply.

          Each receiver converts TIA/EIA-232-F [±12-25V] inputs to 5-V TTL/CMOS levels. These receivers have a typical threshold of 1.3 V, a typical hysteresis of 0.5 V, and can accept [up to] ±30-V inputs.

          Each driver converts TTL/CMOS [5V] input levels into TIA/EIA-232-F [±12-25V] levels.

          • (Score: 2) by Opportunist on Monday March 13 2023, @08:56PM (3 children)

            by Opportunist (5545) on Monday March 13 2023, @08:56PM (#1295980)

            I think the 3v3 version is the max202, but it's been a LONG while since I had to use the last one. It's actually pretty funny that most serial communication I use today is direct 0-5v or 0-3v3, no level shifting to "real" RS232 required.

            • (Score: 1, Informative) by Anonymous Coward on Tuesday March 14 2023, @01:09AM (2 children)

              by Anonymous Coward on Tuesday March 14 2023, @01:09AM (#1296024)

              I don't have scientific studies and results, but I've often encountered serial connections not working, or barely working, because someone thinks 0 and 5 V is "good enough", but the other end needs ±12V. Worst is they sort of work, flaky, frustratingly. I hate when people are lazy, ignore rules, standards, definitions. It's crap.

              A great example is where I was trying to do some PLC programming. The PLC's programming adapter needs true ±12V to work. Stupid laptop has 0 and 5 on the DB-9 serial port. I even reverse-engineered the PLC programming adapter and confirmed- it needs at least ±5. 0 leaves the circuit in the 5V input state.

              All that said, there's been an apparent move toward 0 and 5 as being okay for RS-232, so most things are fairly compatible.

              It's good to have a little MAX232 interposer module to clean things up. (2 MAX232 back-to-back).

              MAX232 specs say the RS-232 side "Receiver negative-going input threshold voltage" is 0.8 - 1.2 V, and "Receiver positive-going input threshold voltage" is between 1.7 and 2.4 V. So it will tolerate the very minimum "swings", like 0 and 3.3V, and still transmit data reliably. Yay! MAX232 is brilliant.

              • (Score: 2) by Opportunist on Tuesday March 14 2023, @03:01PM (1 child)

                by Opportunist (5545) on Tuesday March 14 2023, @03:01PM (#1296090)

                In my particular case, the reason why I don't level shift is simply that both systems used talk 0~5V. Sure, I could technically shift to -12~12 and shift then back to 0~5, but ... why?

                • (Score: 0) by Anonymous Coward on Wednesday March 15 2023, @05:43AM

                  by Anonymous Coward on Wednesday March 15 2023, @05:43AM (#1296209)

                  You misunderstood me. Pretty much obvious- if you don't need it, you don't need it. I was just saying that some things can't handle the 0-5, so having a level-shifter available might get you out of a jamb if you're like me and do a wide variety of tech.

      • (Score: 3, Insightful) by aafcac on Monday March 13 2023, @06:07PM (2 children)

        by aafcac (17646) on Monday March 13 2023, @06:07PM (#1295942)

        I wonder how much simpler it would be if it didn't try to do so much. These serial ports don't do much other than send and receive data. They don't need to worry about how much power to send or whether or not something is plugged into it as that's not included.

        • (Score: 1, Informative) by Anonymous Coward on Monday March 13 2023, @07:01PM

          by Anonymous Coward on Monday March 13 2023, @07:01PM (#1295958)

          If by "it" you're referring to USB, the issues are in the analog world, and electrical signal interference (noise) is a big factor.

          Three of USB's design goals: much faster signaling rates (speed), 5V signaling, and for "green" reasons, power control.

          A big issue in any communications system is noise rejection. Pretty much any electrical signal running through some kind of wire / cable will pick up electrical noise (interference) from all of the many many electrical things surrounding us. We often use what's called "shielding" where the signal-carrying conductor is of course insulated, then wrapped by something electrically conductive which is "grounded" ("earthed") (although sometimes such shields can also induce noise due to "ground loops").

          We need to achieve greatest "signal-to-noise" ratio so that we get good clean signal. One way to do that is make the signal voltages high (ish) so that the receiver circuits can have a wide margin for deciding if the present signal level is a 1 or a 0. We use a thing called "hysteresis" (or "deadband") which says we don't have a single voltage threshold to decide 1 or 0, but rather, one voltage threshold for a rising voltage, but a lower one for falling voltage.

          This hysteresis pretty much defines the amount of electrical noise we can tolerate in the signal.

          The greater the signal voltage range, the greater we can define the hysteresis to be, so the greater our immunity to electrical noise in the desired signal. Which is why RS-232 was often up to ±25V, which meant you have a total of 50V for the signal high to low.

          One of USB's design goals was to work at TTL 5 volts, which drastically reduces the signal-to-noise ratio.

          So, to achieve faster speeds, USB uses a low-impedance differential line pair. In other words, balanced twisted pair wire with low ohm resistors at each end to get the cleanest signals possible. With twisted pair we have two signaling wires: one wire is in a reverse polarity. So if our signal is a 1, one wire goes high, and one wire goes low. The receiver circuits look for the voltage difference between the two signal wires.

          The reason for this is that electrical interference should and will typically cause the same added noise signal on the two wires, and the receiver doesn't care about "common mode" voltage, again, it only looks at the difference voltage.

          It may not seem like much power is involved, but it's enough that designers wanted to keep the Energy Star people happy, but yet drive enough signal onto the USB wire pair to have a strong enough signal so as to overcome electrical noise (greater margin of safety), so some adaptive line (signal wire) power circuits are necessary.

        • (Score: 0) by Anonymous Coward on Tuesday March 14 2023, @03:28AM

          by Anonymous Coward on Tuesday March 14 2023, @03:28AM (#1296038)
          If you want simple stick to serial.

          Some people want their USB keyboards and/or mice to be able to "wake up" their computer from "off" or very low power state.

          Some don't.

          Some people want their phones etc to still be chargeable from the USB port while their computer is "off".

          Some don't.

          Now think about how difficult that is to achieve "if you didn't try to do so much".

          Now attach the USB keyboards etc via USB hubs etc and think about the problem again. 😉
      • (Score: 1, Informative) by Anonymous Coward on Monday March 13 2023, @06:21PM (4 children)

        by Anonymous Coward on Monday March 13 2023, @06:21PM (#1295948)

        Yep. RS-232 is so simple that it's ubiquitous in embedded systems.

        Virtually no modern embedded systems implement RS-232 [wikipedia.org] or any of its variants, except perhaps some embedded control systems on factory machinery where direct cable connections to PCs are the normal operating mode and USB's very short cable length limits are problematic. Although RS-485's differential signalling is perhaps more suited for such applications, RS-232 still works and remains popular.

        RS-232 is a bit of a pain because it requires a negative voltage supply which is not common on digital electronics and the extra mixed-signal design complexity is just not worth it in most cases. But plain UARTs running at normal digital logic levels? Those certainly are ubiquitous.

        I've been doing some experiments with FPGAs and found that a basic UART can be done in less than a hundred lines of Verilog or VHDL.

        Of course, it is easy to implement a simple UART in verilog, but since most FPGAs I/Os only support a handful of digital logic levels, it's unlikely your FPGA can handle RS-232 signalling so you'll need external tranceiver circuitry to actually implement RS-232 (the max232 and related ICs are popular for this purpose).

        • (Score: 2) by stormwyrm on Tuesday March 14 2023, @08:05AM (3 children)

          by stormwyrm (717) on Tuesday March 14 2023, @08:05AM (#1296062) Journal
          Yeah, you'll generally need a line driver like the MAX232 (which is not exactly cheap btw) or hack together some kind of charge pump circuitry to implement full RS-232 because of the requirement to do negative voltages and such. This was to make it less susceptible to noise and interference and to allow transmission over longer distances. The standard was published in 1962, at a time when contemporary electronic systems used even higher voltage levels (e.g. >100V in telephone switching systems of the same era): RS-232's approximately ±12V levels were low voltage by comparison. TTL and its 5V/0V logic levels wouldn't come about until a few years later and using them over the relatively longer cable lengths that RS-232 was designed for would have been problematic, especially with 1960's era electronics. There's still a -12V rail in ATX power supplies primarily to support RS-232. If you don't really need the noise resistance and cable length advantages that the higher voltage levels give, then a TTL or even LVCMOS level UART based on the dead simple RS-232 asynchronous protocol would work well.
          --
          Numquam ponenda est pluralitas sine necessitate.
          • (Score: 2) by RS3 on Wednesday March 15 2023, @05:51AM (2 children)

            by RS3 (6367) on Wednesday March 15 2023, @05:51AM (#1296210)

            > ... MAX232 (which is not exactly cheap btw)...

            A quick check on Mouser is odd- some are $1.72, some $10+ each...

            Ah, I see, some are 1 Tx/Rx pair, some are dual, which are more than twice the price of the single pair. Odd.

            • (Score: 2) by stormwyrm on Wednesday March 15 2023, @08:29AM (1 child)

              by stormwyrm (717) on Wednesday March 15 2023, @08:29AM (#1296224) Journal
              Even $1.72 is somewhat expensive, when you consider that you can get an ATTiny85 microcontroller for slightly less than that ($1.34). The circuit you need to use a MAX232 also requires four electrolytic capacitors for the charge pump, so it can also take a bit of board space too. I suppose the dual ones will be required for RTS/CTS for hardware flow control or the other pins besides RX/TX.
              --
              Numquam ponenda est pluralitas sine necessitate.
              • (Score: 2) by RS3 on Wednesday March 15 2023, @06:37PM

                by RS3 (6367) on Wednesday March 15 2023, @06:37PM (#1296295)

                You may be more frugal than me! I'm thinking more of my stock of "stuff" and personal projects. If I was designing a system to be manufactured I'd look at some options for cost. But you always have to consider labor, parts inventories, reliability, compatibility, support costs, etc.

                Yes the dual chip could be for RTS/CTS, or just a second serial port. RS-232 spec includes 2 ports on the DB-25 connector. I don't remember ever encountering the secondary channel being used though.

                MAX232's 4 charge-pump caps are only 1uF, so pretty tiny.

                Does the ATTiny85 do any of: ±5, 9, 12, 15? [trundles off, looks at .pdf] doesn't look like it.

                We may be a bit off track. My point is: there are some situations where 0-3.3 or 5 will not work. This isn't an MCU thing, rather an electrical hardware-level signal / voltage thing.

                For example, I have an Allen Bradley PLC programming interface (physical box) that interfaces between true RS-232 and whatever the AB interface is (maybe RS-485 variant). Said interface does not work with 0-5. I even (very painstakingly) reverse-engineered the somewhat kludgy circuit, hoping to mod it for 0-5. It would be a great effort- 5 isn't enough to bias some of the transistors, and reducing some resistor values might not work because I can't be guaranteed of the current supplied by the PC's serial port. I was looking at an external level-shifter, like MAX232 back-to-back, or some other re-engineering of the AB interface. The PLC side does supply power to the interface, so some active boost is easily in reach without needing a battery or AC power adapter. But, it's all optically-isolated, and I need to get power to the isolated side. Project is thankfully on hold...

    • (Score: 5, Interesting) by JoeMerchant on Monday March 13 2023, @05:28PM (8 children)

      by JoeMerchant (3937) on Monday March 13 2023, @05:28PM (#1295933)

      I think the year was 1996... anyway, I had been developing a line of products that lived and breathed RS232 data at 19.2kBaud for many years, and "USB" was the new hotness in all the trade rags. Cypress Semiconductor sent me a nice T-shirt and a clear body demo USB mouse.

      It was clear at the time: this $h1t was gonna take over and make life miserable for people who actually use RS232 UARTs. Shortly before that we had just made a product that used a 16554 4 port 232 buffer chip, transmitted data out from one central source into two buffers where the two peripherals consumed "the stream" each for their own purposes, with a little bit of intermittent command / control messaging coming back in the other direction. 3rd port connected to an off the shelf accessory we built in, and the 4th port was to connect a PC to the system for a big display if you wanted that.

      I have been pleasantly surprised at how well USB-232 converters work, most of the time, but they can be a source of trouble too, nowhere near as reliable and easy to debug as a basic UART buffer chip.

      --
      🌻🌻 [google.com]
      • (Score: 2) by Opportunist on Monday March 13 2023, @06:14PM (7 children)

        by Opportunist (5545) on Monday March 13 2023, @06:14PM (#1295946)

        You know what a USB-2-serial converter actually is? A USB device that can output level-shifted UART. That's it. Nothing more. That's trivial to implement even with a crappy ATmel MCU. And I mean one that doesn't have "built in" USB capability. A friggin' ATTiny is good enough, at least for USB1.1.

        • (Score: 4, Informative) by JoeMerchant on Monday March 13 2023, @06:49PM (6 children)

          by JoeMerchant (3937) on Monday March 13 2023, @06:49PM (#1295955)

          It is that simple, and yet: the commercial off-the shelf ones try to cost optimize them down from $0.83 total assembled cost to $0.74 total assembled cost, and in so doing they start screwing up simple things like the clock rates and whatever, and since it "works when they test it" with their one physical test counterpart, they ship it. No such thing as: verifying the timing is not only "within spec" but "within a small window near the middle of the spec" - they'll ship that crap as long as they can demo it working on on thing somewhere.

          Same for voltage levels: spec? schmeck. It worked for me, vs my 232 device, I'm sellin' it to you.

          --
          🌻🌻 [google.com]
          • (Score: 3, Informative) by Opportunist on Monday March 13 2023, @08:58PM (5 children)

            by Opportunist (5545) on Monday March 13 2023, @08:58PM (#1295981)

            I would recommend treating yourself to the "luxury" that is a FTDI based system for 3-4 bucks rather than 1-2. I don't know how much your time is worth, but 2 bucks barely buy a minute of mine, and I have wasted FAR more on Chinese crap than a minute.

            • (Score: 4, Informative) by JoeMerchant on Monday March 13 2023, @09:31PM (4 children)

              by JoeMerchant (3937) on Monday March 13 2023, @09:31PM (#1295985)

              Thankfully, I haven't had to play such RS232 USB translation games often in the past 10+ years, but when I do play similar games, it's often hard to find out what's the "legit, we take specs seriously" part vs. the "legit, we ripped off the good stuff and are selling you an exact copy for 1/4 the price" vs. the "eh, we made something that barely works but put it in a case that looks like the good stuff" parts that may sell for low prices or high.

              --
              🌻🌻 [google.com]
              • (Score: 2) by Opportunist on Tuesday March 14 2023, @03:04PM (3 children)

                by Opportunist (5545) on Tuesday March 14 2023, @03:04PM (#1296092)

                My solution has long been to just simply rolling my own from chips from a reputable source. In the end, it's just faster. And I have the production means at hand to just do it easily.

                Quite frankly, if you calculate it all in, the few 100 bucks for a sensible production environment quickly become pennies when you consider the time wasted on cheap knockoffs.

                • (Score: 2) by JoeMerchant on Tuesday March 14 2023, @03:49PM (2 children)

                  by JoeMerchant (3937) on Tuesday March 14 2023, @03:49PM (#1296102)

                  Agreed... if you've got the space for it. My garage does house and yard/garden maintenance, car mechanics, laundry, woodworking, minor construction, cycling and other hobbies, and I try to keep a car in there too in a 20'x24' space that just doesn't leave much for a proper solder station, etc.

                  --
                  🌻🌻 [google.com]
                  • (Score: 2) by Opportunist on Sunday March 19 2023, @11:42AM (1 child)

                    by Opportunist (5545) on Sunday March 19 2023, @11:42AM (#1297033)

                    That just takes a bit of space organization. I lived in a 300 sqft apartment, you learn to squeeze every single cubic inch out of that space. There's usually a lot of unused space above things like beds or desks. Back in that apartment, my "tinkering station" was above my bed, mounted on a spring loaded board that I could drag down to about bed-level to use it and return up to the ceiling when I needed to sleep. You want to make ABSOLUTEY sure, though, that the wall you mount it to can handle that and that you know how to mount something like that... or you may be in for a rude awakening. Quite literally so.

                    • (Score: 2) by JoeMerchant on Sunday March 19 2023, @03:05PM

                      by JoeMerchant (3937) on Sunday March 19 2023, @03:05PM (#1297052)

                      In my last apartment I had the 25" tube TV in the closet on a shelf with pulleys to raise and lower it as desired. The reverse loft idea is cool, no climbing into bed, but I never could get comfortable sleeping under ceiling anchors, too many heavy things (all mounted by others) have fallen without warning around me over the years.

                      The problem with the woodwork shop is the dust, it gets everywhere. Dean Kamen once gave me & two others a tour of his home. One of his (many) points of pride was the in living space workshops, plural, because you need negative pressure ventilation on the sanders and grinders to keep the dust away from the clean cutters, lathes, drills etc.

                      --
                      🌻🌻 [google.com]
    • (Score: 2) by driverless on Tuesday March 14 2023, @09:56AM

      by driverless (4770) on Tuesday March 14 2023, @09:56AM (#1296065)

      has an UART interface baked into the silicone.

      I've seen a bit of silicone bakeware in my time but never one with a UART. Does wish.com sell it?

    • (Score: 3, Interesting) by stormreaver on Wednesday March 15 2023, @12:33AM

      by stormreaver (5101) on Wednesday March 15 2023, @12:33AM (#1296175)

      RS232 was my first project when I was learning about interrupts and wanted to make an ANSI terminal program in MS-DOS. The entire protocol is terribly easy to implement, and I turned the MS-DOS serial software interrupt vector into a hardware interrupt vector in no time at all. I think it took a few hours to implement in Turbo C between research and implementation. It was also my first introduction to ring buffers, which I absolutely fell in love with.

      It took me WAY more time to implement the ANSI terminal codes (I don't remember how much time, though) than to implement the RS232 interrupt, and the codes really weren't hard to implement either.

  • (Score: 5, Interesting) by GloomMower on Monday March 13 2023, @04:19PM (4 children)

    by GloomMower (17961) on Monday March 13 2023, @04:19PM (#1295919)

    There are lots of places were high data rates are not needed. Just giving simple commands. At the lower speeds the signal can be pretty robust. No reason to complicate everything if you don't need to.

    If you need longer distance serial you can put full duplex RS485 transceivers on both ends. This is a lot easier than using active USB extension cables, which are pretty bulky and still can't go that far.

    The usb to serial chips seem to work pretty good though, which was not the case the usb to parallel because many parallel port devices were very dependent on timing and didn't work well the USB packets.

    • (Score: 4, Informative) by GloomMower on Monday March 13 2023, @04:26PM (2 children)

      by GloomMower (17961) on Monday March 13 2023, @04:26PM (#1295920)

      Anyway I guess I've seen it used on:

      routers, switches, multimeters, astronomy equipment, industrial controls, uninterruptible power supplies.

      Thought a lot of them are switching to USB, but it is a usb to serial chip in them usually, so they just slapped usb on it.

      • (Score: 1, Interesting) by Anonymous Coward on Monday March 13 2023, @05:18PM

        by Anonymous Coward on Monday March 13 2023, @05:18PM (#1295932)

        Don't forget printers. I amazed the owners of the first Apple LaserWriter in this area (a print shop) by connecting it to my MS-DOS portable PC... over the serial port. Printed a 900 page book/draft just fine, this was early 1990s.

      • (Score: 2) by driverless on Tuesday March 14 2023, @09:59AM

        by driverless (4770) on Tuesday March 14 2023, @09:59AM (#1296067)

        Yup. Near-universal standard is 9600 8N1, if you hit an unknown serial port on something that's the first thing to try. Occasionally 19200. I keep a pile of USB-to-serial adapters, null modems, DB9 cables, DuPont connectors, pogo pins, and other paraphernalia handy because when things are totally FUBAR'd there's always a serial interface somewhere that'll let you get back in.

    • (Score: 2) by JoeMerchant on Monday March 13 2023, @08:14PM

      by JoeMerchant (3937) on Monday March 13 2023, @08:14PM (#1295974)

      A friend worked in ocean research, communicating with water sampling containers lowered MILES below ships on cables. Most of their digital communications were "modified RS-232"... They'd have "words" that would transmit following a "start bit" - but sometimes 8 bits was more, or less than they needed in that application, so they might shrink the word size for better reliability, or stretch it for that little extra data without having to fool with multi-word protocols. Then the whole +/-9V level thing was right out the porthole. More often, they'd have some kind of frequency modulation representing the 0 and 1 levels. Sometimes when they were moving a lot of data they'd hold it to a common protocol like 8N1 or 8E1 and a common baud rate like 150 or 300 so they could translate their crazy FM or whatever signal over to "standard" RS232 for handling by an off the shelf computer at some point.

      He always said, well, yeah, it's sort of like RS-232 protocol, but at what point does it stop being RS-232?

      --
      🌻🌻 [google.com]
  • (Score: 2) by progo on Monday March 13 2023, @05:08PM (4 children)

    by progo (6356) on Monday March 13 2023, @05:08PM (#1295929) Homepage

    It makes sense for industrial equipment to have RS-232. The connectors are big and the protocol has a wide tolerance range for operating parameters.

    Computers don't need RS-232 ports on the main board. They don't need every possible port for low-bandwidth applications. USB to RS-232 adapters are cheap, easy to buy, and can be used on even the smallest and most portable computers, as long as they support USB.

    • (Score: 3, Touché) by Ingar on Monday March 13 2023, @05:18PM (3 children)

      by Ingar (801) on Monday March 13 2023, @05:18PM (#1295931) Homepage

      Is that a 3.3V or 5V TTL adapter?

      • (Score: 2) by JoeMerchant on Monday March 13 2023, @05:32PM (1 child)

        by JoeMerchant (3937) on Monday March 13 2023, @05:32PM (#1295934)

        +/-9V if you're gonna be "real" about your 232.

        Nasty problem we had with 232 cables in one location, they were supposed to be 50' max but they ran them 75-100' anyway. Even at +/-9V "true" RS-232, we were getting spurious noise on the lines, and the geniuses that developed our C&C protocol thought their clever 8 bit checksum was all they needed.

        The infinite number of monkeys attack on a 4 byte RS-232 message with just one byte of checksum, running at 9600 baud, will break that checksum once a second... Our noise wasn't 100%, but we were getting spurious commands through those lines about twice a day.

        --
        🌻🌻 [google.com]
        • (Score: 0) by Anonymous Coward on Tuesday March 14 2023, @01:13AM

          by Anonymous Coward on Tuesday March 14 2023, @01:13AM (#1296025)

          RS-422 would've solved it.

      • (Score: 0) by Anonymous Coward on Tuesday March 14 2023, @06:23AM

        by Anonymous Coward on Tuesday March 14 2023, @06:23AM (#1296052)

        > Is that a 3.3V or 5V TTL adapter?

        The beauty of 3.3V TTL is a logic "1" is 2.7 V or more, so you're covered either way.

  • (Score: 3, Interesting) by turgid on Monday March 13 2023, @05:50PM (5 children)

    by turgid (4318) Subscriber Badge on Monday March 13 2023, @05:50PM (#1295939) Journal

    And I was right. Whenever I have been doing embedded development and needed to use one of these USB to RS232 adapters, I have always been disappointed and frustrated. The drivers are invariably unreliable and you need to unplug and reconnect the USB device every so often. In addition, because of Linux's super wonderful device randomisation layer (udev) the tty number often changes. Now don't get me started on machines with multiple NICs or GPUs...

    • (Score: 5, Interesting) by Opportunist on Monday March 13 2023, @06:22PM (1 child)

      by Opportunist (5545) on Monday March 13 2023, @06:22PM (#1295949)

      Get FTDI instead of the Chinese crap. Yeah, I'm not too fond of their "brick-the-competition" policy either, but I can see their point when you have people who write what you just did. And yes, all of that (and even more...) is true with the crap that is the godforsaken CH340s.

      • (Score: 1, Interesting) by Anonymous Coward on Monday March 13 2023, @07:09PM

        by Anonymous Coward on Monday March 13 2023, @07:09PM (#1295963)

        Yeah, I'm not too fond of their "brick-the-competition" policy either

        To be fair, FTDI's driver update disabled counterfeit FTDI chips, not real competitors that have their own USB IDs, drivers, etc. It was a dick move because the policy didn't actually hurt the counterfeiters (fuck them) but rather it directly hurt people who in all likelihood were the victims of fraud.

        As far as I know, the drivers that did this have all been pulled and hopefully FTDI has learned from this mistake, because their reputation as the best in the business was well-earned.

    • (Score: 2) by pe1rxq on Monday March 13 2023, @07:01PM (1 child)

      by pe1rxq (844) on Monday March 13 2023, @07:01PM (#1295959) Homepage

      Stop developing embedded stuff for 5 minutes and use them to read about persistent udev rules.

    • (Score: 3, Insightful) by sjames on Tuesday March 14 2023, @07:26AM

      by sjames (2882) on Tuesday March 14 2023, @07:26AM (#1296058) Journal

      Use /dev/serial/by-id to pick the right USB serial device.

  • (Score: 1, Insightful) by Anonymous Coward on Monday March 13 2023, @06:07PM (7 children)

    by Anonymous Coward on Monday March 13 2023, @06:07PM (#1295943)

    Simpler machines use RS232/RS485 all the time for things like PLC programming, PLC to HMI interface and PLC to VFD interface etc.

    Personally wouldn't mind to moving to ethernet based communications for everything, but manufacturers keep charging more for that.

    • (Score: 2) by turgid on Monday March 13 2023, @07:00PM (6 children)

      by turgid (4318) Subscriber Badge on Monday March 13 2023, @07:00PM (#1295957) Journal

      Oh how I wish CAN Bus would die a death and be replaced by Ethernet.

      • (Score: 3, Informative) by GloomMower on Monday March 13 2023, @07:17PM (5 children)

        by GloomMower (17961) on Monday March 13 2023, @07:17PM (#1295965)

        I don't think that will happen. The benefit with CAN Bus or RS485 is you can have multiple devices on the same wires, and half duplex. With one twisted pair line you can chain dozens of devices, saving on weight and wiring. Each devices doesn't need it own wires to some central switch/hub.

        • (Score: 3, Interesting) by turgid on Monday March 13 2023, @07:38PM

          by turgid (4318) Subscriber Badge on Monday March 13 2023, @07:38PM (#1295967) Journal

          The problem is CAN Bus is becoming fashionable in some applications just because it's CAN Bus, not because it's the best solution. It's very heavy on protocol overhead. It also has problems with contention. It was designed for electric windows and windscreen wipers.

        • (Score: 0) by Anonymous Coward on Monday March 13 2023, @10:01PM (2 children)

          by Anonymous Coward on Monday March 13 2023, @10:01PM (#1295991)

          I don't think that will happen. The benefit with CAN Bus or RS485 is you can have multiple devices on the same wires ... devices doesn't need it own wires to some central switch/hub

          This is not a significant limitation of ethernet.

          The older ethernet media (the ones using coaxial cables) work in exactly this way too, there is no switch/hub required to support multiple stations on a cable run. If you really wanted to, today, you could easily build out a 10base2 ethernet segment and use a media convertor like this one [amazon.com] to connect that network segment directly to modern twisted pair equipment. This will handily achieve its rated 10Mbit/s half-duplex data rate with a 200 metre segment length (this is much faster than either CAN or RS-485 can be expected to do at these distances).

          With ethernet over twisted pair, you can almost as easily install a 3-port switch next to each device and daisy chain them in order to avoid redundant cabling back to a central switch. If it was really important, such switches could be pretty easily integrated into machinery. This will run at modern ethernet speeds, and this should operate at much more than 200m from end to end without any trouble (as long as your devices are not more than 100m apart). From a cabling perspective, this is similar to how some CAN networks are actually built (with daisy chained devices).

          No, the real reason why we don't usually use ethernet like this is that it is simply more expensive than the alternatives. You need (relatively) expensive controllers and PHYs at each station, plus software to run these. RS-485 communication essentially just requires a UART and some differential amplifiers at each device, cheap and easy.

          • (Score: 0) by Anonymous Coward on Tuesday March 14 2023, @06:07AM (1 child)

            by Anonymous Coward on Tuesday March 14 2023, @06:07AM (#1296049)

            I like your thinking. I used to deal with "Thinnet" it a lot, including where idiot morons would "crimp" the outer braid sleeve by squashing it completely flat. They or other morons would add an extra "T" somewhere in the middle of the run just to add another termination resistor. It's likely someone wanted to extend the cable and didn't understand you must have only 2 terminators- one at each end. Sigh.

            IIRC you can only use 4 (or 5?) Ethernet switches in a single segment before you need a router. Thinnet with Ts can have many many devices, but good luck finding Ethernet with BNC any more! I have some, I should see if they're worth anything. Those converters you linked look awesome, but aren't cheap.

            I've been working in industrial control. Everything new is running Ethernet everywhere. IMHO RJ-45 aren't the greatest / most reliable connector, esp. if there's any moisture or mild "stuff" in the atmosphere. Of course a dab of silicone grease is your friend there...

            Some older stuff used (still in use) mostly variations on RS-485 (DeviceNet, Modbus, several other brand-specific varities). There's COAX ControlNet [wikipedia.org], CANBus is used a lot.

            • (Score: 0) by Anonymous Coward on Tuesday March 14 2023, @07:43AM

              by Anonymous Coward on Tuesday March 14 2023, @07:43AM (#1296060)

              IIRC you can only use 4 (or 5?) Ethernet switches in a single segment before you need a router.

              There is no such limit, at least not if you're using ordinary "dumb" switches.

              As each switch will add some small but nonzero forwarding delay the latency will of course get worse and worse as you go further down the chain. Eventually if you keep adding more and more this latency would be so extreme that the network is unusable for the protocols you want to use, but of course that depends on the protocol. For something like say, telnet, that limit will be a lot more than 5 switches.

              Fancy "smart" switches might be a different story, as they implement protocols like STP to react to changes in the network topology. I'm not too familiar with this equipment but I can believe it if you say it chokes up with a relatively small number of daisy chained switches.

        • (Score: 0) by Anonymous Coward on Tuesday March 14 2023, @06:31AM

          by Anonymous Coward on Tuesday March 14 2023, @06:31AM (#1296053)

          I hate to break it to you, but everything industrial control has gone to Ethernet for many years. Standard Ethernet wiring, switches, routers, etc. I/C companies make Ethernet switches that are DIN rail mount ready, run on 24V (standard for industrial stuff). All newer (10 years or less) PLCs, VFDs, HMIs, etc., have Ethernet ports.

          Nothing wrong with the older stuff, but you'll get that bad attitude from pretty much any I/C engineer / technician how your stuff is "obsolete", ancient, slow, unreliable, can't get parts...

  • (Score: 2, Informative) by bubbageek on Monday March 13 2023, @08:06PM (1 child)

    by bubbageek (17085) on Monday March 13 2023, @08:06PM (#1295973)

    I work on printing presses for a living. Pretty much all of the motor controllers and PLCs use serial ports for communications and programming.

    • (Score: 2) by RS3 on Tuesday March 14 2023, @06:13AM

      by RS3 (6367) on Tuesday March 14 2023, @06:13AM (#1296051)

      Must be older stuff. Everything new, and less than 10 or so years old has become Ethernet, including PLC to remote I/O, VFDs, several other I/C devices, HMI, SCADA, etc. Personally I like the older stuff because it works and I'm not a huge fan of RJ-45 connectors, although they can be okay if protected, not overly strapped down, silicone greased, ...

  • (Score: 5, Informative) by Mojibake Tengu on Monday March 13 2023, @09:18PM (1 child)

    by Mojibake Tengu (8598) on Monday March 13 2023, @09:18PM (#1295982) Journal

    There is no substitute for a real serial datalink.

    USB is mechanically inferior to serial, connectors are weak, fragile and without proper fixation arrest. Anybody walking around it can pull that out accidentally or by malice.

    USB is electrically inferior, proper signalling lengths are very short in compare to serial. Speed is not a god. You have troubles putting your desktop computer too far from your desktop. Physical attacks on machine power supply are possible. Long sized true serial cable were built with optical bridge, resistant to transfer of power surges.

    USB is a security nightmare, all kind of monsters can hide in any USB peripheral, including network interfaces. I have already seen keyboards and monitors (with embedded USB hub for user convenience) with USB network sploiters built-in. I can build one too. If I can do that, everyone can do that too.

    Whoever invented such kind of universalism was a complete fool. Bluetooth exhibits its own madness ethereally so a real enemy can kill you from a distance.

    --
    Respect Authorities. Know your social status. Woke responsibly.
    • (Score: 1, Insightful) by Anonymous Coward on Tuesday March 14 2023, @05:20AM

      by Anonymous Coward on Tuesday March 14 2023, @05:20AM (#1296045)

      Your upmods tell the story. For many reasons I don't use Bluetooth. Some systems I work on have Bluetooth keyboard and mouse, but not my doing.

      One memorable Mac and keyboard would regularly lose connection and have to re-pair. You'd always need a wired keyboard to get it to work again because it would require a security code just to pair. I didn't try to improve it- politics situation (not willing to step on the toes of very grumpy IT people at that place...)

      As an EE, one of the bigger worries I've had about USB is seeing fairly important chips, like your main MCU, directly driving the USB port. Maybe some low-value resistors between the physical port connectors and the chip, but extremely easy to fry a critically important chip due to some external surge, grounding problem, etc.

      You forgot to mention one of the most frustrating things about USB A, B, mini, micro connectors- they only go in one way, and it's not easy to know which way is correct unless you have a good view and light. At least USB C, like Apple's "Lightning" can go either way.

      I hate how fragile most of them are. I've seen various devices rendered useless because the incredibly tiny thin fragile actual connector tab in the middle gets broken off, especially with micro-USB.

      Not touting USB, but I've seen signal boosters that have allowed it to work for dozens and hundreds of feet, reliably.

      From a practical standpoint the protocol must be terrible. "Firewire 400" will significantly outperform USB 2.0 (480 Mbps).

  • (Score: 4, Interesting) by PinkyGigglebrain on Monday March 13 2023, @10:50PM (4 children)

    by PinkyGigglebrain (4458) on Monday March 13 2023, @10:50PM (#1295999)

    Serial pots are easy to work with, surprisingly adaptable, flexible, very robust and above all cheap. A lot of industrial control and sensor devices still use simple serial protocols, RS-232 or the lesser know RS-485, RS-422 [contec.com] and CAN bus [wikipedia.org]. Two of the big advantages of these old standards is they can work over a cheap and easy to maintain 2-3 wire cables over longer distances than USB, ethernet. Plus they are "mature" and don't keep getting upgraded or tweaked every other year.

    At home I've got 3 Samsung LCD TVs set up as displays for my 4 computers. All the displays have RS-232 ports ('EZ-link') that can be used to control the TVs. Power, input, volume, and mute being the ones I use the most. With a simple control demon running on my old AMD Athlon (also serves as a NFS NAS) that reads a small keypad I made next to my mouse pad. The keypad is wired to the lpt port so I can control all the displays from a single point, The demon reads the lpt then sends the appropriate command over the serial links. Took a little effort to set up but is much easier than trying to use the TV's remotes.

    personally I hope serial, and parallel too, ports are around for a long time. I don't mind having to install a card to get them but they are too useful to let completely fade away.

    --
    "Beware those who would deny you Knowledge, For in their hearts they dream themselves your Master."
    • (Score: 3, Insightful) by ChrisMaple on Tuesday March 14 2023, @12:12AM (3 children)

      by ChrisMaple (6964) on Tuesday March 14 2023, @12:12AM (#1296016)

      I'd love to have a parallel port. Set an output and it stays forever. 8 pins of data output plus some control signals, several input pins.

      • (Score: 0) by Anonymous Coward on Tuesday March 14 2023, @05:41AM

        by Anonymous Coward on Tuesday March 14 2023, @05:41AM (#1296047)

        I can't tell you how often I've used that wonderful bidirectional 8-bit port, "parallel port", AKA IEEE 1284.

        It's great to use with a 6522 port expander chip.

        It's extremely similar to IEEE-488 (GPIB / HPIB) [wikipedia.org], which is used a lot in laboratory equipment for data gathering and control (including "LabView" software). Somewhere I have an IEEE-488 to parallel adapter...

        20-ish years ago our dishwasher quit working. Very bizarre custom MCU seems to have fried. Mfgr. wanted $280 for a new control board. DW wasn't worth it, but relays were on a separate board, so I build a simple transistor relay-driver interface, cable to old laptop parallel port, fairly simple timer program in C, and it just worked. And, bonus, _I_, the user, could actually control my own machine. I know, I'm a subversive.

        I'm a huge fan of parallel port and will always keep machines that have them.

        Tons and tons of experiments and projects out there with proto-boards and PC software to control them. Just know, they're only 'LS TTL outputs, so not protected, nor have much drive capability. Speeds generally up to 2 MHz (2 MB/s).

      • (Score: 2) by sjames on Tuesday March 14 2023, @07:29AM

        by sjames (2882) on Tuesday March 14 2023, @07:29AM (#1296059) Journal

        That was a hyge screw-up in the USB spec. They COULD have had a way to use it fo DIO, but instead, USB-parallel ports are practically useless since even printers rarely use them anymore.

      • (Score: 2) by stormwyrm on Tuesday March 14 2023, @04:14PM

        by stormwyrm (717) on Tuesday March 14 2023, @04:14PM (#1296108) Journal
        If you have a real, physical parallel port, you can easily program stuff that has a JTAG interface. A USB to parallel port adapter will not do because the translation generally screws up the timing for the protocol, even if it works fine for a printer. The Xilinx parallel port JTAG adapter is very cheap, only a few dollars, while their USB JTAG adapter is much more expensive (~ $60).
        --
        Numquam ponenda est pluralitas sine necessitate.
  • (Score: 3, Informative) by inertnet on Monday March 13 2023, @11:05PM

    by inertnet (4071) on Monday March 13 2023, @11:05PM (#1296002) Journal

    With a simple serial port tester you can see what's going on in the wires. Very handy if you need to debug communication.

  • (Score: 4, Informative) by MrNerdHair on Tuesday March 14 2023, @01:03AM

    by MrNerdHair (5930) on Tuesday March 14 2023, @01:03AM (#1296023)

    The primary reason boards, especially server boards, still have built in serial ports (or headers for attaching them) is for outputting debug logs and controlling the machine when things start going wrong on the driver or kernel level. Windows calls this EMS (Emergency Management Services), and the advantage of serial is that it's very easy to operate in a single-threaded, largely lock-free manner that ensures that even if various drivers lock up you can still get a shell.

    In USB, everything you plug in hangs off a root port somewhere; a malfunctioning device or bad cable can, for example, cause a tight loop of bus resets that hoses everything connected to that controller. In contrast, serial output is handled (on x86, at least) by a UART controller with a dedicated FIFO buffer via special I/O assembly instructions. With serial, you can get debug info from so early in the boot process that the kernel hasn't even enumerated the PCI bus yet -- try doing *that* with USB!

  • (Score: 2) by jb on Tuesday March 14 2023, @03:01AM

    by jb (338) on Tuesday March 14 2023, @03:01AM (#1296033)

    "Why do people buy toy computers that don't even come with any serial ports?"

    As many others have said, RS-232 (or RS-422 or even RS-485 if you really need it) is simple and reliable. Far more so than anything that has come since.

    I'll go one step further and say that for me, a computer is pretty useless unless it has serial *console* support. Stick a bunch of computers in a rack somewhere and they very quickly become a nuisance to manage, unless you can access the pre-boot environment (OpenFirmware, uboot, pc-bios, or whatever) remotely. Serial muxes are still the most reliable way to do that (assuming one isn't gullible enough to use the spyware embedded in pretty much all network-based "lights out" management systems these days).

  • (Score: 0) by Anonymous Coward on Wednesday March 15 2023, @06:10AM

    by Anonymous Coward on Wednesday March 15 2023, @06:10AM (#1296213)

    Stage lighting systems, including robotics, pyrotechnics, etc., use DMX512 [wikipedia.org] protocol over RS-485.

(1)