On Mar 31, 6:14=A0am, D Yuniskis <not.going.to...@seen.com> wrote:
> Hi Shane,
>
> On 3/30/2011 5:12 AM, Shane williams wrote:
>
>
> >> E.g., a start bit error is considerably different than a
> >> *data* bit error (think about it).
>
> > Hmm. =A0I forgot about that. =A0A start or stop bit error means the who=
le
> > message is rejected which is good.
>
> My point was that if you *miss* a start bit, then you have -- at
> the very least -- missed the "first" bit of the message (because,
> if it was MARKING, the UART just ignored it and, if it was SPACING,
> the UART thought *it* was the start bit). =A0If you are pushing
> bytes (characters) down the wire at the maximum data rate (minimal
> stop time between characters), then you run the risk of part of
> the *next* character being "shifted" into this "misaligned" first
> character. =A0I.e., it gets really difficult to figure out *if*
> your code will be able to detect an error (because the received
> byte "looks wrong") or if, BY CHANCE, the bit patterns can conspire
> to look like a valid "something else".
Hmm, ok, if the byte count goes wrong as well I guess it could - I
didn't think of that. The ddcmp protocol actually has a 10 byte
header (can't remember if I mentioned this) with a separate crc for
the header. The count byte for the data is in the header. I suspect
the chance of it morphing into something valid would be pretty low in
our case - e.g. one particular byte must always have the value 0x01.
So the detection of 1,2 and 3 bit errors by crc16-ccitt doesn't allow
for start bit and stop bit errors? I never thought of that either.
>
> >>> However we may end up with 3 ports per node making it a collection of
> >>> rings or a mesh. =A0The loading at the slowest baud rate is approx 10=
%
>
> >> [scratches head] then why are you worrying about running at
> >> a higher rate?
>
> > Because not all sites can wire as a mesh. =A0The third port is optional
> > but helps the propagation delay a lot.
>
> Sorry, the subject wasn't clear in my question =A0<:-(
> I mean, if you were to stick with the slowest rate, your
> "10%" number *suggests* you have lots of margin -- why
> push for a higher rate with the potential for more
> problems?
To get faster request/ response - a shorter propagation delay.
>
> >> Latency might be a reason -- assuming you
> >> don't circulate messages effectively as they pass *through*
> >> a node. =A0But, recall that you only have to pass through
> >> 32 nodes, worst case, to get *a* copy of a message to any
> >> other node...
>
> >>> for 64 nodes. =A0If we decide to allow mixed baud rates, each node wi=
ll
> >>> have the ability to tell its adjacent nodes to slow down when its
> >>> message queue gets to a certain level, allowing it to cope with a
> >>> brief surge in messages.
>
> >> Depending on how you chose to allocate the Tx&Rx devices in each
> >> link -- and, whether or not your baudrate generator allows
> >> the Tx and Rx to run at different baudrates -- you have to:
> >> * make sure your Tx FIFO (hardware and software) is empty before
> >> =A0 =A0 changing Tx baudrate
> >> * make sure your "neighbor" isn't sending data to you when you
> >> =A0 =A0 change your Rx baudrate (!)
>
> > This is assured. =A0It's half duplex and the hardware sends a whole
> > message at a time.
>
> So, for each ring, you WON'T receive a message until you have
> transmitted any previous message? =A0Alternatively, you won't
> transmit a message until your receiver is finished?
This is true for each uart.
>
> What prevents two messages from being "in a ring" at the same
> time (by accident)? =A0I.e., without violating the above, it
> seems possible that node 18 can be sending to node 19 (while
> 19 is NOT sending to 20 and 17 is not sending to 18) at the
> same time that node 3 is sending to node 4 (while neither 2
> nor 4 are actively transmitting).
I don't follow this. It's not a bus. 18 and 19 can talk to each
other and no-one else hears.
>
> Since this *seems* possible, how can you be sure one message
> doesn't get delayed slightly so that the second message ends
> up catching up to it? =A0(i.e., node 23 has no way of knowing
> that node 24 is transmitting to 25 so 23 *could* start sending
> a message to 24 that 24 fails to notice -- in whole or in
> part -- because 24 is preoccupied with its outbound message)
I have a feeling there's a misunderstanding here - not sure what
though.
>
> >> Consider that a link (a connection to *a* neighbor) that "gives you
> >> problems" will probably (?) cause problems in all communications
> >> with that neighbor (Tx& =A0Rx). =A0So, you probably want to tie the
> >> Tx and Rx channels of *one* device to that neighbor (vs. splitting
> >> the Rx with the upstream and Tx with the downstream IN A GIVEN RING)
>
> > Not sure I follow but a single uart does both the tx and rx to the
> > same neighbor.
>
> >> [this may seem intuitive -- or not! =A0For the *other* case, see end]
>
> >> Now, when you change the Rx baudrate for the upstream CW neighbor,
> >> you are also (?) changing the Tx baudrate for the downstream CCW
> >> neighbor (the "neighbor" is the same physical node in each case).
>
> > Yes
>
> >> Also, you have to consider if you will be changing the baudrate
> >> for the "other" ring simultaneously (so you have to consider the
> >> RTT in your switching calculations).
>
> > What is RTT?
>
> Round Trip Time (sorry :< ) =A0I.e., you (each of your nodes) has
> to be aware of the time it takes a message to (hopefully) make
> it around the ring.
>
> >> Chances are (bet dollars to donuts?), the two rings are in different
> >> points of their message exchange (since the distance from message
> >> originator to that particular node is different in the CW ring
> >> vs. the CCW ring). =A0I.e., this may be a convenient time to change
> >> the baudrate (thereby INTERRUPTING the flow of data around the ring)
> >> for the CW ring -- but, probably *not* for the CCW ring.
>
> > I'm lost here.
>
> Number the nodes 1 - 10 (sequentially).
> The CW node has 1 sending to 2, 2 sending to 3, ... 10 sending to 1.
> The CW node has 10 sending to 9, 9 sending to 8, ... 1 sending to 10.
> The nodes operate concurrently.
Yes, they do.
>
> So, assume 7 originates a message -- destined for 3. =A0In the CW ring,
> it is routed as 7, 8, 9, 10, 1, 2, 3. =A0In the CCW ring, it is routed
> (simultaneously) as 7, 6, 5, 4, 3.
>
> *If* it progresses node to node at the exact same rates in each
> ring (this isn't guaranteed but "close enough for gummit work"),
> then it arrives in 8 & 6 at the same time, 9 & 5, 10 & 4, 1 & 3,
> 2 & 2 (though different "rings"), 3 & 1, etc. (note I have assumed,
> here, that it continues around until reaching it's originator...
> but, that's not important).
ok - it actually dies at around about the 2&2 , 3&1 stage
>
> Now, at node 9, if the CW ring decides that the baudrate needs to be
> changed and it thinks "now is a good time to do so" (because it has
> *just* passed it's CW message on to node 10), that action effectively
> interrupts any traffic in the CW ring (until the other nodes make
> the similar baudrate adjustment in the CW direction).
No, the baud rate between any two nodes is independent of any other
two nodes. I'm missing something here.
>
> But, there is a message circulating in the CCW ring -- it was just
> transmitted from node 5 to 4 (while 9 was sending to 10). =A0It will
> eventually be routed to node 9 as it continues it's way around the
> CCW ring. =A0But, *it* is moving at the original baudrate (in the CCW
> ring) while node 9 is now operating at the *new* baudrate (in the
> CW ring). =A0So, any new traffic in the CW ring will run around
> that ring at a different rate than the CCW traffic. =A0If you only
> allow one message to be active in each ring at any given time, then
> this will "resolve itself" one RTT later. =A0But, if the "other"
> ring never decides to change baudrates... ?
>
> And, if it *does* change baudrates at the same time as the "first"
> ring, then you have to wait for the CW message to have been
> completely propagated *and* the CCW message as well before making
> the change. =A0I.e., you have to let both rings go idle before
> risking the switch (or, take considerable care to ensure that
> a switch doesn't happen DOWNstream of a circulating message)
>
> >> [recall, changing baudrate is probably going to result in lots
> >> of errors for the communications to/from the affected neighbor(s)]
>
> >> So, you really have to wait for the entire ring to become idle
> >> before you change baudrates -- and then must have all nodes do
> >> so more or less concurrently (for that ring). =A0If you've split the
> >> Tx and Rx like I described, then this must also happen on the
> >> "other" ring at the same time.
>
> >> Regarding the "other" way to split the Tx&Rx... have the Tx
> >> always talk to the downstream neighbor and Rx the upstream
> >> IN THE SAME RING. =A0In this case, changes to Tx+Rx baudrates
> >> apply only to a certain ring. =A0So, you can change baudrate
> >> when it is convenient (temporally) for that *ring*.
>
> >> But, now the two rings are potentially operating at different
> >> rates. =A0So, the "other" ring will eventually ALSO have to
> >> have its baudrate adjusted to match (or, pass different traffic)
>
> > I think there must be a misunderstanding somewhere =A0- not sure where.
>
> You can wire two UARTs to give you two rings in TWO DIFFERENT WAYS.
> Look at a segment of the ring with three nodes:
>
> =A0 =A0------> 1 AAAA 1 --------> 1 BBBB 1 --------> 1 CCCC 1 ------->
> =A0 =A0 =A0 =A0 =A0 =A0 =A0AAAA =A0 =A0 =A0 =A0 =A0 =A0 =A0 BBBB =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 CCCC
> =A0 =A0<------ 2 AAAA 2 <-------< 2 BBBB 2 <-------- 2 CCCC 2 <-------
>
> vs.
>
> =A0 =A0------> 1 AAAA 2 --------> 1 BBBB 2 --------> 1 CCCC 2 ------->
> =A0 =A0 =A0 =A0 =A0 =A0 =A0AAAA =A0 =A0 =A0 =A0 =A0 =A0 =A0 BBBB =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 CCCC
> =A0 =A0<------ 1 AAAA 2 <-------< 1 BBBB 2 <-------- 1 CCCC 2 <-------
>
> where the numbers identify the UARTs associated with each signal.
We do the second case, except sometimes they mis-wire it so that uart
2 on B connects to uart 2 on C when it should connect to uart 1 on C -
but this doesn't matter (much) currently.
>
> [assume tx and rx baudrates are driven by the same baudrate generator
> so there is a BRG1 and BRG2 in each node]
Yes, there is.
>
> In the first case, when you change the baudrate of a UART at some
> particular node, the baudrate for that segment in *the* ring that
> the UART services (left-to-right ring vs right-to-left ring) changes.
> So, you must change *after* you have finished transmitting and you
> will no longer be able to receive until the node upstream from you
> also changes baudrate.
>
> In the second case, when you change the baudrate of a UART at some
> particular node, the baudrate for all communications with that
> particular neighbor (to the left or to the right) changes. =A0So,
> *both* rings are "broken" until that neighbor makes the comparable
> change.
Yes.
>
> Look at each scenario and its consequences while messages are
> circulating (in both rings!). =A0Changing data rates can be a very
> disruptive thing as it forces the ring(s) to be emptied; some
> minimum guaranteed quiescent period to provide a safety factor
> (that no messages are still in transit); the actual change
> to be effected; a quiescent period to ensure all nodes are
> at the new speed; *then* you can start up again.
Why do all nodes have to be at the same speed?
>
> While it sounds "child-like", you might find making a drawing
> and moving some coins (tokens) around the rings as if they were
> messages. =A0It helps to picture what changes to the rings'
> operation you can make and *when*.
>
> Either try NOT to change baudrates *or* change them at times
> that can be determined a priori.