EEVblog Electronics Community Forum
Electronics => Projects, Designs, and Technical Stuff => Topic started by: laejf on March 24, 2022, 10:31:57 am
-
Hi,
At work we are going to have approximately 1Mbps communication over a 1.8m 3.5mm audio-cable in which the shield will be used as ground, and we will also support the use of extensions of this cable to about 3-5m. I am fairly fresh from school and takes advice from a more experienced engineer when designing the circuit. He says that I absolutely should go with a differential protocol which I also believe is the safest route, therefore I chose to implement RS-485.
However, there is another person at the company with a hobby-level knowledge of electronics, who loudly insists on that we go with a cheaper, single ended alternative such as RS-232 or simply just skip the transceivers and send TTL levels to save the money. He backs this up with that he has seen this on other instruments and it works fine, and that the shielded cable together with the high voltages on RS-232 will not be affected enough by noise.
How would you argue in this matter?
-
A few quick google searches:
- RS232 communication (with transceiver, TTL levels would be less):
Communication Mode Full duplex
Distance (max) 50 feet at 19.2kbps
Data Rate (max) 1Mbps
- RS485 communication:
MAX14783E is 42Mbps
MAX22500E up to 100Mbps
Max 10Mbps up to 30 meters
Do you want to be at the very top of the speed capabilities for RS232?
-
Differential has substantially higher noise rejection than SE. It is less susceptable to EMI and emits far less EMI back into the invironment. The signal is not returned via ground. Its a win win.
Its probably not necessary for very short runs <5m though.
It really depends on the equipment the serial link it connects. From one PC to a perpheral, it probably doesnt make much difference. If conecting PC to a big power hungry system like a motor controller I'd go Diff.
Use off the shelf modules
-
Need EMI and compliance environment
TX and RX equipment on same earth reference?
most consumers grade coax is junk, use RG/58 or RG/59/U
RCA audio connection also mostly junk.
Depending on the needs for a reliable link
Search my papers for AES digital audio and the excellent applications nots of Steven Lampen at Belden Wire
Bon courage
Jon
-
… I am fairly fresh from school and takes advice from a more experienced engineer when designing the circuit. He says that I absolutely should go with a differential protocol which I also believe is the safest route, therefore I chose to implement RS-485.
However, there is another person at the company with a hobby-level knowledge of electronics, who loudly insists on that we go with a cheaper, single ended alternative such as RS-232 …
Why is this even a question? (In the sense of, “why does Other Person even have a say in the matter to begin with?”) Does the Other Person have more power within the organization? Other than that there’s no question the experienced engineer should be followed.
Ask Other Person why it is, then, that practically every signal type used for longer distances (and many that are used for short ones!) are differential, if he thinks that SE isn’t susceptible to noise, or is easily protected with shielding and voltages. USB, Ethernet, DisplayPort and HDMI, but also pro audio (analog) all use differential signaling. Does he think they do that for shits and giggles?
Ok, at 1.8m, I’m sure SE would be fine for low bit rates like this. But at longer distances — and with who knows what kinds of cables used as extensions by customers — you can’t guarantee it. Do you want a product that may not perform in the field when a customer has a noisier environment?
-
Why a 3.5mm audio cable? Rather poor choice for the application IMHO. There is no standard when it comes to such cables, except for the connector, and even then huge variations in quality and reliability between different connectors. Some audio cables aren't even shielded at all!
Connectors can also be susceptible to contamination and oxidation (who hasn't experienced crackly audio on a set of headphones and had to twirl the 3.5mm connector around or pull it out give it a wipe and stick it back in).
Not to mention the physical weakness of the 3.5mm audio connector, both the male and female connectors can be easily damaged if the cable is accidentally tugged on sideways.
-
IMO, one should always identify the enemy- are you in an environment with significant EMI? Could you be in the future? Is it an unknown?
There is one solution that will work most of the time for shorter distances. There is another solution that's far more robust.
If you were building a bridge would you design based on "probably good enough" or "guaranteed to work under worst case conditions"?
If it works, you'll get no reward (at best). If it fails, people will notice, and it will have your name on it.
Stuff every engineer should know! (BTW, RCA connectors' only claim to fame is being one of the cheapest connectors ever designed. Most of the 3.5 plugs are only marginally better.)
-
RS485 is the way to go.
The differential pair is much more robust while a RS485 transceiver chip can be had for less than a dollar. Not only does it make the communication more resilient to interference but it also can handle quite a bit of voltage on the input before that RS485 transceiver gets damaged. In comparison it is pretty easy to kill a 3.3V MCU by simply sending 5V power into its pin.
As for the 3.5mm connector, its fine,
Sure it might not be the type of connector for the job but it works and you can get lots of ready made cables for it. There are products out there that use TRS jacks for RS232. There is no denying it is a pretty compact connector out of the standard commercial connectors you can buy everywhere.
The bad thing about a jack connector is that it does not connect ground first (static discharge hazard) and shorts pins together during mating/unmating. So this is all the more reason to not use direct TTL UART as it exposes the contacts to a fair bit of abuse.
-
Seems like your friend has been lucky with use of bad signalling techniques. TTL from one place to another, in particular from one chassis to another, really BAD idea. TTL doesn't really even like being shipped from one pcb to another within the same housing and instrument because it has a poor noise immunity for signals in the 'low' state. RS-232 quality would depend on what speed/distance/implementation you do. Will it be done with +/- 5 volt levels or +/- 12 volt levels? There have been so many different implementations of RS-232 signalling over the decades. I do have some +/- 5 volt 4800 baud NMEA 0183 data traveling around on the typical 'Radio Shack stereo T.R.S. miniplug' cables, the longest run being maybe 10 feet. RS-485 would work great on that type of a cable. As others have mentioned differential signalling over distance is the best route.
-
Why is this even a question? (In the sense of, “why does Other Person even have a say in the matter to begin with?”) Does the Other Person have more power within the organization? Other than that there’s no question the experienced engineer should be followed.
I've worked with "experienced engineers" who knew less than some hobbyists. But in this case, the engineer is right.
In general, the big issue is the relative grounding of the connected devices. There are many ways to screw up a single-ended connection with ground-loops and noise. Differential signaling is relatively immune to this, and gives you more options when dealing with these issues.
Then, there is the speed and distance capability of the drivers and receivers. As has been mentioned, RS232 is running out of steam at the 1 MHz rate. RS485/RS422 or similar drivers/receivers are designed for this job.
-
Full or half duplex? Or unidirectional, for that matter?
RS-485 is bidirectional, but you can only drive one direction at a time, else the levels collide and data corruption results. So, half duplex is the usual way. If it's only ever one-way, then the source can be left transmitting all the time, and it's technically (i.e. more specifically) RS-422.
Note that RS-485 still needs a common ground. It is tolerant of up to some volts (+11/-7 or so) common mode offset, so you can get away without ground in some situations (many, even?), but at some point it'll run out, and along with it, your noise margin (due to ambient noise sources coupled between the device grounds, or induced on the cable). Expect a couple volts of noise in the average case: this includes ground loop between outlets, poorly behaved devices (unfiltered power supplies, anyone?) and nearby radiotransmitters at low power (~mW). At the extremes, there are also transients of some thousands of volts (ESD), but only briefly (~50ns) -- enough to corrupt single data bits, easily detected/corrected with fairly simple protocols.
If you do need extra CM range, then, an isolator is probably required. This adds a few bucks cost, but is quite standard; there are whole ICs for it, even. (Usually they don't include DC-DC power supply so you need to add a one of those beside it.)
You don't get much shielding in typical headphone cable (usually something terribly leaky like a spiral-wound ground) so the differential will definitely help. The downside is, a phono jack only contains two wires and a ground, so you only get one differential lane. Whereas with RS-232, you could have RX and TX together (and indeed this is a, fairly old standard, but one nonetheless).
And yeah, 232 is definitely too slow.
There are ways to use logic level signals, but they generally require good shielded cables (braided). In fact, for example, USB (Full Speed mode) is just logic-level; it's also differential, but that's only used for coding a few special symbols, and other than that, could be a single wire in this mode. The connectors and cables are all shielded, a necessity for the low signal levels (especially the low voltage High Speed mode).
Tim
-
So coworker #2 may think that RS232is 'good enough' so why use anything else? My question is why not use something better?
Personally, the only time I would use RS232 for anything is if I literally had no other reasonable option. OTOH, if you're designing the system from scratch, then an RS485/422 transceiver costs no more than an RS232 transceiver (probably less), is no more difficult to use, and requires only one additional wire.
This might be the easiest question to answer that I've seen on EEVBlog.
-
optical RS232
80m
https://www.wut.de/e-81009-ww-daus-000.php (https://www.wut.de/e-81009-ww-daus-000.php)
-
I wouldn't use logic level serial for anything that was going to be mated and unmated in the field. Not because it won't work, but because the EMI, ESD, and general robustness. It's fine for connecting modules within a chassis that share a common ground and are mostly permanently installed together. A standard RS232 driver will have controlled rise/fall times, relatively robust ESD protection, and better noise immunity. Over short ranges like a a few meter RS232 is probably fine. It isn't particularly cheaper than an RS485/422 driver, so if you need a driver chip you should consider those. The determining factors are: do you need full duplex? If you need full duplex and you are really set on using a 3.5 mm TRS jack that only has two signals plus ground you are probably going to be stuck with RS232. If half-duplex is OK, RS485 will work over 2 wires and have better noise immunity, faster speed, and longer range than RS232. If you need full duplex and want the better noise immunity and range of differential signalling you will want to look at a 4-wire + ground bidrectional RS422 signal and may have to look for a new cable.
-
I wouldn't use logic level serial for anything that was going to be mated and unmated in the field. Not because it won't work, but because the EMI, ESD, and general robustness.
Agreed.
RS-485 transceivers (or similar) are not just less susceptible to interference due to the differential signaling, they also usually embed proper protection.
For good measure, I usually still add ESD protection diodes close to the connectors. They are cheap.
Direct connection of IOs through cables of several meters? Uh yeah, sure. Let's see how long it takes before you fry your circuit.
As said already, sure RS485 is half-duplex, but it's rarely a problem. Full-duplex communication (really full duplex) is rarely used where UARTs would be used anyway - protocols most often never send and receive at the same time. But having a separate RX and TX can make things a bit easier to implement on a software level - with RS485, you need to release the bus when "not talking". That requires a bit more work. But yes if you really want full-duplex, just use two transceivers and two pairs, and call it a day.
There are tons of such transceivers out there. You can alternatively go for "LVDS" transceivers too. Cost is irrelevant IMHO, unless you were a chinese company designing very cheap toys sold by millions. You can find such transceivers for under $1.
-
In my experience, RS-485 devices are more resistant to ESD problems than RS-422, for similar differential performance.
Specifically, when connecting to long differential lines, they can easily get charged during installation (if made from good dielectrics) which, if not connected first to a resistor termination (at the receiver) to discharge the line, can destroy an RS-422 transmitter.
-
"Real" RS-232 (i.e. swinging lot of volts) is totally bogus.
Serial, logic level, unbalanced over a foot or so of cable, 1.8V, 3.3V, even anachronistic 5V, whatever.
RS-485, although as old as the dinosaurs still rocks (in certain applications).
-
Rebonjour!
In 2011..2017, we surveyed many RS-485 PHY TX/RX and transceivers and found several with 15 kV ESD, and baud rates 25 ...100 MHz or higher.
In our broadcast equipment production design, the Intersil (Reneses) ISL3259E has proven to be reliable and solved many issues.
https://www.mouser.com/c/semiconductors/interface-ics/rs-422-rs-485-interface-ic/?m=Renesas%20Electronics&series=ISL3259E (https://www.mouser.com/c/semiconductors/interface-ics/rs-422-rs-485-interface-ic/?m=Renesas%20Electronics&series=ISL3259E)
For superior CMRR and to break ground loops, use a pulse transformer with the RS-485.
Jon
-
RS232 does help since larger signal levels are more resilient. At the same time RS232 transceiver chips employ some slew rate limiting and filtering trough slow propagation delays. They also tend to have pretty good ESD protection built in. So it is quite a bit better than just 3.3V CMOS levels.
But when it comes to a simple 2 wire protocol for high-ish speed over a decent distance it is hard to beat RS485. Differential signaling is superior in both preserving a clean signal over a long distance and solving common mode noise/ground issues.
In fact using a common mode choke you can even enhance the noise rejection capability of an existing RS485 chip. You can have a lightning strike that rises your local ground to 500V for a moment and yet the choke can bring that down to normal levels where the RS485 chips keeps transferring data without even noticing there was a lightning strike. Obviously a large enough strike would corrupt data and even fry stuff, but if you ware using single ended TTL signaling your chips would all be dead in the example above.
-
Rebonjour Berni,
We achieved IEC EN 61000-4-5 level 3 transients compliance with beads, CM choke, Shielded low capacity pulse transformer and RD-485 the Intersil parts mentioned.
We added Schottky clamps diodes at the TX/RX ports on the IC.
This eliminates field failures due to transients on the data lines. The design is bulletproof and installation worldwide.
Bon courage
Jon
-
In fact using a common mode choke you can even enhance the noise rejection capability of an existing RS485 chip. You can have a lightning strike that rises your local ground to 500V for a moment and yet the choke can bring that down to normal levels where the RS485 chips keeps transferring data without even noticing there was a lightning strike. Obviously a large enough strike would corrupt data and even fry stuff, but if you ware using single ended TTL signaling your chips would all be dead in the example above.
Actually not -- CMCs regularly saturate from mere ESD, let alone surge. These are impressively large signal levels, some kV; even the flux capacity of a high-value power line choke struggles with IEC 61000-4-5 surge. Let alone the 10/700us or longer surges typical of telecom lines (induced or direct lightning).
Their function is more that, by delaying the surge, its risetime is slowed, giving less coupling into circuit traces (via stray capacitance); and by introducing series impedance (leakage inductance* and DCR), the value of protective devices is enhanced (reducing the peak current into TVS/MOV/etc.).
*A saturated CMC has inductance about equal to half the differential leakage inductance. Basically, the two windings act as independent air-cored inductors; in differential mode, they act in series of course. Here they act in parallel, which would give 1/4 Ldiff if uncoupled, but some coupling will occur (depending on type), plus whatever permeability remains in the core.
Tim
-
this thread remembers me of a consulting company where i was tasked with a small redesign previous to a large batch of a new product. They used a RJ45 UART connector with just TX,RX and GND directly connected to the chip to transmit over 1 Mb/s.
When asking why they didnt use at least a rs-232 transceiver or any king of TVS or protection I was almost fired because that was questioning the lead engineer.
Obviously didn't last long there...
-
"It's always worked like that"
Did they even do EMC testing on it? ::)
Tim
-
[thread drift warning]
I was almost fired because that was questioning the lead engineer.
I read this a lot here. Where do you people work??? My personal experience as a young pup was that senior engineers have been helpful and open to questions / suggestions. When I became a senior or lead engineer I certainly encouraged an open dialog (and occasionally learned something in the process).
-
I would guess that the senior engineer being full of themselves and not accepting any design criticism is also the reason why it just used straight UART with no safety precautions. He never listened to anyone that tried to tell him why its not quite the best solution. It is also difficult for management to know how good of an engineer he actually is. The logic is that if he was leading the engineering department for the last 15 years ever since the beginning of the company then he surely knows what he is doing and is to be listened to (Even if he never actually learned a thing in the 15 years because he refuses to listen to anyone).
Tho sometimes a legacy protocol monster is summoned by accident. Those sort of things where you have to quickly throw together a thing for some niche costumer where only 10 units will ever be made in the entire universe. Yet then 20 more get sold to another costumer that needed a similar thing and 100 more to another. Then the next costumer needs a version 2,0 with some extra spice added to it. Suddenly the thrown together bodge is now a actual product family with multiple models on the market in the wild and you need to design even more devices for his ecosystem. Yet your hands are tied to using that quick dirty protocol it communicates over, since it was good enough for those 10 units
Tho RS232 over RJ45 is used quite a bit in the wild. For example it is the standard way for connecting FLARM radios to things in general aviation (This is a collision warning system for light aircraft and gliders).
-
We build adapter cards for the PC industry and work with interfaces in isolated & non-isolated versions.
1) The 3-5 m length is not huge for RS232 use.
2) For RS232 use, be sure the xcvr is 1Mbps rated (we know that they can operate to 1.2Mbps under load). Suggest the ZT3243LFEA xcvr of choice. There are other versions that will be similar like from Maxim / Intersil (Renesas) but more $$. We purchase the ZT3243LFEA in volume and they are < $ 1 USD each.
3) Now, IF your environment is with interference / inductive loads then consider RS485 WITH ISOLATION. There are many methods to galvanically isolate the HOST from the slave including new devices from TI that feature the RS485 with internal power supply with digital isolator in a single package. Worth a look. They offer 2 speed versions of this part.
If using RS485, you will need to code the firmware for both sides of the cable to make this work as a group.
On the host side, are you on a PC or an embedded controller ? If on the PC, a new can of worms - ping me and we can support this. You will need a host adapter with proper device (signed) drivers for Windows use or Linux support.
If embedded, you will have to write the software to communicate over the RS485 network - ie. you decide when to ENABLE the RS485 transmitter, etc.
If your work environment is without noise, RS232 can work for the 3-5m lengths. Just test and retest to confirm this is the case.
-
[thread drift warning]
I was almost fired because that was questioning the lead engineer.
I read this a lot here. Where do you people work??? My personal experience as a young pup was that senior engineers have been helpful and open to questions / suggestions. When I became a senior or lead engineer I certainly encouraged an open dialog (and occasionally learned something in the process).
worked, before I had worked in other companies for over 4 years and this was the first and so far worst experience of this kind. In the other places the seniors were really open and you could talk everything as long as it was justified but that situation just baffled me, it took 2 months more to left that company...
-
I would guess that the senior engineer being full of themselves and not accepting any design criticism is also the reason why it just used straight UART with no safety precautions. He never listened to anyone that tried to tell him why its not quite the best solution. It is also difficult for management to know how good of an engineer he actually is. The logic is that if he was leading the engineering department for the last 15 years ever since the beginning of the company then he surely knows what he is doing and is to be listened to (Even if he never actually learned a thing in the 15 years because he refuses to listen to anyone).
Tho sometimes a legacy protocol monster is summoned by accident. Those sort of things where you have to quickly throw together a thing for some niche costumer where only 10 units will ever be made in the entire universe. Yet then 20 more get sold to another costumer that needed a similar thing and 100 more to another. Then the next customer needs a version 2,0 with some extra spice added to it. Suddenly the thrown together bodge is now a actual product family with multiple models on the market in the wild and you need to design even more devices for his ecosystem. Yet your hands are tied to using that quick dirty protocol it communicates over, since it was good enough for those 10 units
Tho RS232 over RJ45 is used quite a bit in the wild. For example it is the standard way for connecting FLARM radios to things in general aviation (This is a collision warning system for light aircraft and gliders).
in this case it was a engineering manager who didn't practise electronics for a really long time and when discussing projects you could tell that he didn't know the basics (still remember when trying to explain what was a pull down not kidding) but as i was told for the upper levels he was looked as a really good engineer because he lowered the cost and sold himself really well (later i found that I was the 6th engineer in that position in a year because of this conditions). So finally after talking to HR i was fired.
So far i know that 3 more people have gone through there... and i'm speaking of a company of 50 people
Regarding the Project is exactly as you said a prototipe was liked by the client ans asked first 100 and then was 2000 for commercial product and as the manager didn't like changing the design because didn't have any idea about advantages of the change and increasing the cost would look bad.... well you know the outcome..
Several years have passed and I cant still understand what was happening there.
As final note I was told that the device gave a lot of problems in the deployment,
-
If embedded, you will have to write the software to communicate over the RS485 network - ie. you decide when to ENABLE the RS485 transmitter, etc.
Yep, but as I mentioned, if this is inconvenient, you can just use two transceivers instead of one, one for TX, one for RX, and call it a day. Fully transparent for UART communication. Of course, in this case, the only thing you keep from RS485 are the differential transceivers, and, also as I mentioned, you can use any other differential transceivers, such as anything LVDS. As to the cables, sure you'd need two pairs instead of just one, but if cost is a concern, that's not a big problem. These days, ethernet cables are cheap and contain 4 pairs. Just a thought.
-
Also as I mentioned, you can use any other differential transceivers...
Go full-on retro, use ECL (emitter-coupled logic)!
You've always been looking for a use for that -5.2V supply.
(I once did 400 feet with ECL at 27 MHz.)