Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Oh, wait, that was Randal...nevermind... -- Larry Wall in <199709261754.KAA23761@wall.org>


computers / comp.arch.embedded / Re: Shared Communications Bus - RS-422 or RS-485

Re: Shared Communications Bus - RS-422 or RS-485

<daeb9fd7-344e-4a9b-a05f-2cb2d7d11a0bn@googlegroups.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=1156&group=comp.arch.embedded#1156

  copy link   Newsgroups: comp.arch.embedded
X-Received: by 2002:a0c:f00f:0:b0:4bb:6167:d338 with SMTP id z15-20020a0cf00f000000b004bb6167d338mr36040921qvk.11.1667639383132;
Sat, 05 Nov 2022 02:09:43 -0700 (PDT)
X-Received: by 2002:a0d:cd02:0:b0:341:a401:4630 with SMTP id
p2-20020a0dcd02000000b00341a4014630mr37400632ywd.293.1667639382852; Sat, 05
Nov 2022 02:09:42 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch.embedded
Date: Sat, 5 Nov 2022 02:09:42 -0700 (PDT)
In-Reply-To: <tk4ma3$s3v$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=65.207.89.54; posting-account=I-_H_woAAAA9zzro6crtEpUAyIvzd19b
NNTP-Posting-Host: 65.207.89.54
References: <6b8c6b92-a2ca-4849-ba68-f03060bc41fcn@googlegroups.com>
<tjul46$18dkn$3@dont-email.me> <ec91ddbe-6777-494f-8001-cf57fc15deeen@googlegroups.com>
<tk09ev$1f0de$1@dont-email.me> <tk0e27$1f1rv$1@dont-email.me>
<tk0mih$1g2fh$1@dont-email.me> <tk2fuo$1nau3$1@dont-email.me>
<tk2n7g$1o0ct$1@dont-email.me> <05989871-748b-4b08-b564-84a323418b45n@googlegroups.com>
<tk4558$1i99$1@gioia.aioe.org> <e130818b-2e12-4dbc-b8a3-ee72a6ef42b3n@googlegroups.com>
<tk4ma3$s3v$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <daeb9fd7-344e-4a9b-a05f-2cb2d7d11a0bn@googlegroups.com>
Subject: Re: Shared Communications Bus - RS-422 or RS-485
From: gnuarm.d...@gmail.com (Rick C)
Injection-Date: Sat, 05 Nov 2022 09:09:43 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 16626
 by: Rick C - Sat, 5 Nov 2022 09:09 UTC

On Friday, November 4, 2022 at 11:46:16 PM UTC-4, anti...@math.uni.wroc.pl wrote:
> Rick C <gnuarm.del...@gmail.com> wrote:
> > On Friday, November 4, 2022 at 6:53:34 PM UTC-4, anti...@math.uni.wroc.pl wrote:
> > > Rick C <gnuarm.del...@gmail.com> wrote:
> > > >
> > > > How long is a piece of string? By keeping the interconnecting cables short, 4" or so, and a 5 foot cable from the PC, I don't expect problems with reflections. But it is prudent to allow for them anyway. The FTDI RS-422 cable seems to have a terminator on the receiver, but not the driver and no provision to add a terminator to the driver.
> > > It is pointless to add terminator to driver, there will be mismatch
> > > anyway and resistor would just waste transmit power. Mismatch
> > > at driver does not case trouble as long as ends are properly
> > > terminated. And when driver is at the near end and there are no
> > > other drivers, then it is enough to put termination only at the
> > > far end. So FTDI cable seem to be doing exactly what is needed.
> >
> > Yes, that's true for a single driver and multiple receivers. The point is that with multiple drivers, a terminator is needed at both ends of the cable. You have two ends to terminate, because drivers can be in the middle.
> With 100 Ohm line driver in the middle sees two parts in parallel, so
> effectively 50 Ohm. Typical driver impedance is about 40 Ohm, so
> while mismatched, mismath is not too bad. Also, with multiple
> devices on the line there will be undesirable signals even if you
> have termination at both ends.

I don't want to get into a big discussion on termination, but any time a driver is in the middle of the line, it will see two loads, one for each direction of the cable. The termination only impacts the behavior of the reflection. So every driver that is not at the end of the line, will see the characteristic impedance divided by two. However, since the driver is not impedance matched to the line, that should not matter. But to prevent reflections, each end needs to be terminated, to prevent reflections from that end.

The disruptions from the driver/receiver connections of intermediate chips will be small, since they are high impedance and minimal capacitance compared to the transmission line. These signals have multiple ns rise and fall times, so even with no terminations, it is unlikely to see effects from reflections from the ends of the line, much less the individual connections.

> In unterminated line there will be some loss, so after each reflection
> reflected signal will be weaker, in rough approximation multiplied
> by some number a < 1 (say 0.8). After n reflections signal will
> be multiplied by a^n and for large enough n will become negligible.
> Termination at given end with 1% resistor means that about 2% will
> be reflected (due to imperfection). This 2% is likely to be negligible.
> If transmitter is in the middle, there is still reflection at the
> end opposite to termination and at the transmitter. But mismatch
> at transmitter is not bad and the corresponding parameter a is
> much smaller than in unterminated case. So termination at one
> end reduces number of problematic reflections probably about 2-4
> times. Which means that you can increase transfer rate by
> similar factor. Of course, termintion at both ends is better,
> but in multidrop case speed will be lower than in point-to-point
> link.

Multidrop is a single driver and multiple receivers. Multipoint is multiple drivers and receivers. One line will be multidrop (from PC) and the other multipoint (to the PC). The Multidrop will be single terminated since the driver needs no termination, it's impedance is well below the line impedance. The Multipoint line has a termination in the FTDI device on the receiver. Another termination will be added to the far end of the run. This is mostly insurance. I would not expect trouble if I used no terminators. I could probably use a TTL level serial cable and no RS-422 interface chips. But that's going a bit far I think. Using RS-422 is enough insurance to make the system work reliably.

> > You could not use FTDI RS-422 cables in the arrangement I am implementing. Every receiver would add a 120 ohm load to the line. Good thing I only need one!
> Well, multiple receivers on RS-422 have limited usefulness (AFAIK your
> use case is called 4-wire RS-485), so no wonder that FTDI does not
> support it. Maybe they have something more expensive that is
> doing what you want.

??? Who said FTDI does not support multiple receivers? Oh, you mean their cables only. I'm not sure why you say this has limited usefulness. But whatever. That's not a thing worth mentioning really.

I'm not using FTDI anyplace other than the PC, so their device does exactly what I want. The only other, differential cable is RS-485, which I don't want to use as you have to pay more attention to timing of the driver enables.

> > > > Oddly enough, the RS-485 cable has a terminator that can be connected by the user, but that would be running through the cable separately from the transceiver signals, so essentially stubbed! I guess at 1 Mbps, 5 feet is less than the rise time, so not an issue. Since the interconnections between cards will be about five feet as well, it's unlikely to be an issue. The entire network will look like a lumped load, with the propagation time on the order of the rise/fall time. Even adding in a second chassis, makes the round trip twice the typical rise/fall time and unlikely to create any issues.
> > > >
> > > > They sell cables that have 5 m of cable, with a round trip of 30 ns or so.
> > > Closer to 50 ns due to lower speed in cable.
> > > > I think that would still not be significant in this application. The driver rise/fall times are 15 ns typ, 25 ns max.
> > > Termination is also to kill _multiple_ reflections. In low loss line
> > > you can have bunch of reflection creating jitter. When jitter is
> > > more than 10% of bit time serial communication tends to have significant
> > > number of errors. At 9600 or at 100000 bits/s with short line bit
> > > time is long enough that jitter due to reflections in untermined
> > > line does not matter. Also multidrop RS-485 is far from low loss,
> > > each extra drop weakens signal, so reflections die faster than
> > > in quality point-to-point line.
> >
> > How do RS-485 drops "weaken" the signal? The load of an RS-485 device is very slight. The same result will happen with multiple receivers on RS-422.
> That is general thing, not specific to RS-485. If RS-485 receiver
> puts 24 kOhm load on line, that is about 0.4% of line impedance.
> When signal passes past receiver there is corresponding power loss.

If you are talking about the load resistance, that is trivial enough to be ignored for signal loss. The basic RS-422 devices are rated for 32 loads, and the numbers in the FTDI data sheet (54 ohms load) are with a pair of 120 ohm resistors and 32 loads.

> There is also second effect: receiver created discontinuity, so
> there is reflection. And beside resitive part receiver impedance
> has also reactive part which means that discontinuity and reflection
> is bigger than implied by receiver resistance. With lower load
> recevier effect is smaller, but still there is fraction of percent
> lost or reflected. Single loss is "very slight", but they add up
> and increase effective line loss: with single receiver reflecting/losing
> 0.5 after 40 receivers 20% of signal is gone. This 20% effectively
> adds to normal line loss.

The "reactive" part of the receiver/driver load is capacitive. That does not change with the load value. It's mostly from the packaging is my understanding, but they don't give a value in the part data sheet. I expect there's more capacitance in the 6 foot cable than the device. I don't know how you come up with the loss number.

> > I expect to be running at least 1 Mbps, possibly as high as 3 Mbps.
> You probably should check if you can get such rate with short messages.
> If did little experiment using CH340 and CP2104. That was bi-drectional
> TTL level serial connection using 15 cm wires. Slave echoed each
> received character after mangling it a little (so I knew that it
> really came from the slave and not from some echo in software stack).
> I had trouble running CH340 above 460800 (that could be limit of program
> that I used). But using 1 character messages 10000 round trips took
> about 7s, with small influence from serial speed (almost the same
> result at 115200 and 230400). Also increasing message to 5 bytes
> gave essentially the same number of _messages_.

I ran the numbers in one of my posts (here or in another group). My messages are around 10 char with the same echo or three more characters for a read reply. Assuming 8 kHz for the polling rate, an exchange would happen at 4 kHz. A total of 25 char gives 100 kchar/s or 800 kbps on USB or 1,000 kbps on the RS-422/RS-485 interface. So I would probably want to use something a bit faster than 1 Mbps. I think 4k messages per second will be plenty fast enough. With 128 UUT in the system that's 32 commands per second per UUT.

I may want to streamline the protocol a bit to incorporate the slave selection in every command. This will be more characters per message, but more efficient overall with fewer messages. The process can be to send the same command to every UUT at the same time. Mostly this is just not an issue, until the audio tests. They take some noticeable time to execute, as they collect some amount of audio data. I might add a test for spurs, since some UUT failures clip the sinewaves due to DC bias faults and harmonic distortion would be a way to check for this. I want the testing to diagnose as much as possible. This would add another slow test. So these should be done on all UUT in parallel.

> CP2104 was better, here I could go up to 2000000. Using 5 byte
> messages 10000 round trips needed 2.5s up to 1500000, at
> 2000000 time dropped to about 1.9. When I increased message
> to 10 bytes it was back about 2.5s.
>
> I must admit that ATM I am not sure what this means. But this 2.5s
> looks significant: this means 4000 round trips per second, which
> is 8000 messages, which in turn is number of USB cycles. So,
> it seems that normally smallish messages need USB cycle (125 uS)
> to get trough USB bus. It seems that sometimes more than one
> message may go trough in a cycle (giving smaller times that I
> observed), but it is not clear if one can do significantly better.
> And CH340 shows that it may be much worse.

I used to use CH340 cables with my test fixture, but they would stop working after some time, hours I think. I think the cable had to be unplugged to get it working again. Once I realized it was the CH340 cable/drivers, I got FTDI devices and never looked back. They are triple the price, but much, much cheaper in the long run.

> FTDI is claimed to be very good, so maybe it is better, but I would
> not count on this without checking. Actually, I remember folks
> complaining that they needed more than millisecond to get message
> trough USB-serial.

It's too early to be testing, but I will get to that. I suppose I could do loopback testing with the RS-232 cable I have now.

> OTOH, your description suggest that you should be able to do what
> you want with much smaller message traffic, so maybe USB-serial
> speed is enough for you.

If it doesn't run at the speed I'm thinking, it's not a big loss. There's no testing at all done with the current burn in chassis. The UUTs are tested one at a time. You can't get much slower than that. Even if it takes a minute to run a full test, that's on all 128 UUTs in parallel and it will be around 1000 times faster than what we have now! The slow part will be getting all the UUTs loaded on the test fixtures and getting the process started. Any bad UUTs will need to be pulled out and tested/debugged separately. Once they are pulled out, the testing runs until the next day when the units are labeled with a serial number and ready to ship!

> > One thing I'm a bit confused about, is the wiring of the EIA/TIA 568B or 568A cables. Both standards are used, but as far as I can tell, the only difference is the colors! The green and orange twisted pairs are reversed on both ends, making the cables electrically identical, other than the colors used for a given pair. The only difference is, the different pairs have different twist pitch, to help reduce crosstalk. But the numbers are not specified in the spec, so I don't see how this could matter.
> >
> > Why would the color be an issue, to the point of creating two different specs???
> >
> > Obviously I'm missing something. I will need to check a cable before I design the boards, lol.
> You may be missing fact that most folks installing network cabling
> do not know about transmission lines and reasons for matching pairs.
> And even for folks that understand theory, it is easier to check
> that colors are in position prescribed in the norm, than to check
> pairs. So, colors matter because using colors folks can get correct
> connetion without too much thinking.

The people using the cables don't see the colors. They just plug them in.

> Why two specs? I think
> that this is artifact of history and way that standard bodies work.
> When half of industry is using one way and other half is using
> different but equally good way standard body can not say that
> one half is wrong, they must allow both ways.

But it's not different, really. It's just colors that mean nothing to anyone actually using the cables. They just want to plug them in and make things work. The color of the insulator won't change that at all.

If there was something different about the wiring, then I'd say, I get it. But electrically they are identical.

It's also odd, that the spec doesn't say how many turns per foot/meter are in the twisted pair. But it is different in each pair to give less crosstalk.

--

Rick C.

---+ Get 1,000 miles of free Supercharging
---+ Tesla referral code - https://ts.la/richard11209

SubjectRepliesAuthor
o Shared Communications Bus - RS-422 or RS-485

By: Rick C on Wed, 2 Nov 2022

93Rick C
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor