last day (15 days later) » 

5:23 PM
4
A: Cable shielding (best practices)

LundinSince this is an engineering site, I feel obliged to call out that this design is fundamentally flawed: you cannot have plain 3.3V UART signals across a wire which is exposed to heavy EMI. It is an entirely unsuitable bus to ever leave the PCB, let alone to use in noisy environments. Shields, fer...

 
Thanks Lundin, a lot of these decisions are coming from space constraints on the PCB. I am struggling to put external crystal oscillator for my UART micro. I will have to manage somehow because the theory suggests better to have one than to rely on internal oscillator. 24V psu has been ruled out. 5V gives me some advantages. I will rethink on the transceivers. I have thought about this multiple times but I will give it a serious thought once more. For the wire, maybe i can use 2 x 26 or 24 AWG just for the power. Signals can be 28.
 
@Whiskeyjack Some bare minimum for UART is 3% inaccuracy, though I'd design for less. If you pick a good MCU, you can use the internal oscillator. Crystals and transceivers don't take much space at all, either part should be available as 3x3mm DFN and the like.
 
I have conducted a real-world test (I do not want to claim that this gives me the right to ignore the principles just because it worked fine in a test). I used 32 awg enamelled copper wire of length 1.5 meters with a noisy 220 vac wire wrapped around it 20 times, sent a data packet 36 characters long on 500,000 baud every 1 ms. I didn't find any data corruption. Now 1.5 m gets reduced to 25 cm and 500,000 reduces to 9600 or even lower if required. With acknowledgement, retries and checksum, do you think I can achieve reliability?
 
Sure you can. I would expect this application would work fine, if the UART signals are heavily filtered -- 9600 baud is quite low, and perhaps even lower could be used. Preferably RS-232 would be used, though. || In what way are shields a "desperate attempt"? Shields are a design requirement in many effective commercial standards: USB, HDMI, SATA and more are impossible without them; even just grounding (at both ends, maybe even just one) the foil of a multiconductor cable is helpful in industrial settings, and may be here as well.
 
@Whiskeyjack VAC is only noisy if it draws current. If you want to do home-brewed EMC testing then hook up some motors or contactors etc. No I don't think you can achieve reliability, forget about raw UART. I have RL experience from a similar quackery product from the 1980s that used 5V UART across a few meters in an industrial application. It was simply not reliable and should never have be designed in the first place. RS485 is bare minimum, CAN is preferable.
@TimWilliams RS-232 is an indoors standard for year 1960 desktop applications. Just like UART, it should never be used in environments with lots of EMI. There is literally no reason not to use RS-485 transceivers. You can't compare USB and SATA etc with UART, the baudrates are thousand times higher and those also use high currents mixed with the signals.
 
5:23 PM
[Plain, unfiltered] RS-485 has as much noise immunity as RS-232, and the range advantage is irrelevant at this distance. I'm not sure where your calculation of "100 times cheaper" comes from either; if this is a one-off, cost will be dominated by, well, reading all these comments for one, but also just applying terminals and whatnot. If production, the cost of adding two pins and two wires to the connectors and cables is... probably about equal to adding the transceivers?
 
@TimWilliams That's simply not correct, because the key no noise immunity is the differential signals. And as anyone who has worked with production of electronic products know, shielded cables tend to add significant cost. You can't buy cable in lengths of mm, you buy it in lengths of meters. Some 7 signal AWG24-28-something with shield and connectors will likely cost more than the PCBs themselves.
 
@Whiskeyjack At 9600 bauds and packets of only 36 characters, do you really need a UART?
@Lundin Shielded CAT5 or CAT6 are not that expensive because they are massively produced. I don't even try to look for less than 8 wires cables anymore because they are all more expensive. Sometimes twice more.
 
@Lundin I'm not sure what you're working off of; RS-422/485 has a +12/-7V input common mode range, RS-232 has a noise margin of 7.5V; they're very comparable standards, and this is no accident. (Well, it'll be 3V with common MAX232/clones at 3.3V, lol, but with a Proper-True-Scotsman RS-232 it can be.) Anyway, noise margin depends on filtering, which it appears you aren't considering at all? Why not?
 
@Fredled - 36 characters (ABCD...012..9) was a packet used for my test. Regular packet might even be simpler than this. I prefer UART for its simplicity. 2 way, 2 wires, flexible in terms of data transfer. I am not using it currently, but I can use a bootloader and another signal line to somehow use the UART for doing FW updates as well (similar to arduino bootloader). I do not want to use it in this product. Just an idea.
 
@Lundin - As Tim Williams hinted at, the noise immunity of RS-422/485, or LVDS for that matter all go out the window if the common mode range of the receiver is exceeded.
 
5:23 PM
@TimWilliams Modern RS485 transceivers are usually rated +/-25V. Modern CAN transceivers higher yet. But if you know a good antiquities dealer who can get you them dank RS232 transceivers who am I to stop you... And as for filtering, yeah you'd usually add a common mode choke on top of the transceiver and that's sufficient for industrial purposes.
@SteveSh So don't buy transceivers from the 1970s, problem solved.
 
@Whiskeyjack I don;t know the level of simplicity you are talking about. UART are, IMO, very complicated to use; You have to program it, and then read in and out from its memory... Can't the micro controller get the data immediately? Sharing the clock, SPI style?
 
@Fredled ...because the only thing that would be worse EMC-wise than raw UART would be SPI... I'm getting seriously depressed by all these comments.
Although it should perhaps be noted a general 50Hz-something hum from mains is by no means "a tough EMI environment".
 
If I knew what "raw UART" is...
 
@Fredled - The microcontrollers that I am using have hardware UART peripherals. And libraries are available. Just need to define some parameters (baud rate, parity, etc) and send the data to the peripheral. The peripheral will serialize it, and send it to the other MCU, the peripheral there will receive it and put it in the buffer. Feels relatively simple to me. Also, less wires. It just seems very intuitive and simple to me. I started from Arduino, maybe that's why.
 
@Lundin Sure, they could be rated 100V even; but what does it do with conducted EMI? Radiated? EFT? ESD? Each one must be considered. And the latter two will blow out pretty much any signal in existence, short of a shielded low-C transformer-coupled interface (which would need more work than just transceivers to apply to a UART). And at commercial test levels, the former won't blow out RS-232, or, I maintain, even filtered GPIO. So what advantage is RS-485 in this case, if all three will pass?
 
5:23 PM
@TimWilliams And in every single case a modern RS-485 transceiver will perform better than some dinosaur part. As an example, the one I glanced at just some is rated for class for commerical ESD 8kV contact/15kV air. I doubt you'll find a RS-232 transceiver with that. But the bottom line is that differential signals are enormously more rugged than single lines. Additionally, RS-485 transceivers just need 1 standard decoupling cap whereas the dino part needed 5 of them. Cheaper BOM for better immunity. The only remaining argument for using RS232 was that PC used to have it some 15 years back.
@SteveSh The on-board communication bus with no transceiver, aka "TTL levels". Except in this case it is actually 3.3V so even worse.
 
Well, LVCMOS levels. Which are essentially TTL (by voltage). Since ~no one uses TTL per se anymore, the term has been colloquially reused (at least in context) to mean logic-level UART.
@Lundin I've seen RS-232 transceivers with 8/15kV before; or 30+ trivially by adding a TVS. But that's not important, neither device is likely to survive such a hit without some malfunction, and needless to say the received signal is corrupted for the duration of the pulse; zero of these standards offer 100% reliable communication under all test conditions.
 

last day (15 days later) »