The RS-232 serial communications was first introduced in 1960s (and amended and changed numerous times after that) and its death has been proclaimed over and over again, lately by ubiquitous USB. New computers haven't shipped with RS-232 ports for years now, unless you deliberately seek out specialized motherboards for some extra cash.
On paper just about anything else is superior to RS-232. Data speed is very limited. It is point-to-point link (no multiple devices on same wire). And cable length will quickly limit transmit rate even further. And so on and on.
Yet I still find myself building RS-232 cables even today. Simply because one very - nay, extremely - important factor:
It just works.
Just about my entire career I've been dealing with devices that carry certain expectations. When customer pays more than 100k€ for device, you just can't tell them to turn it off and then on again, just because some stupid peripheral device connected internally with USB decided to crap out. Dealing with that was one of my first lessons on reliability (*snicker*) of USB. Not exactly fun, and when dealing with COTS components, not much you can do about it either. But somehow we managed.
Lately the price tag of devices I work with is smaller but issues are the same. When USB link hiccups, it just doesn't reset itself and carry on, but it will need to explicitly power cycled to recover. Small thing but still annoying, and frustrating to user (even if the reset itself happens automatically and semi-transparently).
Granted, RS-232 isn't immune to broken connection problems either, but at least it is easy (relatively speaking) to build fail-safes and recovery to protocol code, and I have to admit, a lot of my protocol code is fairly paranoid nowadays, at least in places where it matters. Framing, timeouts, connection resets and what not everywhere.
Now someone might ask why don't I use CAN or other such bus that is designed for reliability. The answer is availability. RS-232 is everywhere. Every single MCU you pick (except maybe the tiniest ones like PIC10 I wrote about earlier) will have it. All you have to do is connect two (or three) wires and write simple routines (typically about 20-30 lines of C - and I mean C that directly uses hardware registers, no libraries involved) and you will be good to go (okay, you might need MAX2323 or other such chip there somewhere unless you want to fiddle with (LV)TTL link - and for reliability some nicer protocol on top, but sometimes simple commands is all you need to hack something together).
So there, you'll have to pry RS-232 link from my cold, dead fingers before I'll give it up. Because there is nothing that can beat its simplicity and reliability.
Ei kommentteja:
Lähetä kommentti