On 2/21/2023 2:59 AM, pozz wrote:
> Il 20/02/2023 22:52, Paul Rubin ha scritto:
>> pozz <
pozz...@gmail.com> writes:
>>> Is there something already available that I can use?
>>
>> There is a traditional hack where you make or buy a Y cable that lets
>> you tap the serial i/o and listen to both directions from a PC. Then
>> just log the data going in and out. When I did it I used a simple
>> Python script and it was able to keep up with the device we were dealing
>> with (might have been 1200 bps, I don't remember). It's possible
>> something like that already exists for Wireshark.
>
> Do you mean "joining electrically" (AND for UART TTL levels) the two signals
> and connect the result to the RX signal of a single serial port on the PC?
No. That won't work as the two transmitters could be trying to drive the
line (that they think only *they* own!) to different potentials.
Instead, you end up with 4 connectors -- the original two connecting your
"two communicating devices". Plus, two more that each have a single
connection to the RxD inputs of two serial ports on your PC (i.e., the
TxD connections from those two PC ports go nowhere).
This is a kludge as you have two receivers on each signal -- the receivers
on each of your two devices PLUS the receivers on the two PC ports.
And, you've got an extra ground involved -- the PC (but that won't typically
cause problems except in some special cases).
Alternatively, you can route the data *through* the PC; device A talks to
PC's port 1. PC echoes the stream to device B (keeping a log of the
content). At the same time, device B talks to PC's port 2 and the PC
similarly echoes the stream to device A (logging it).
The risk, here, is that the PC can introduce a delay in the transmission
between A and B. Likely this is not important in the example you cited.
And, if the PC can't keep up (because other things are happening in the
PC, at the time), then you risk losing characters.
Finally, this approach can be harder to implement completely if the
comms take advantage of other signalling means (like BREAKs). The
PC would have to recognize these in the data stream and reproduce them
in the same manner and in the same relationship to the surrounding
character transmissions.
> It couldn't work in my case, because the protocol could be full-duplex, so both
> nodes could transmit at the same time. The AND result would be corrupted.
Start simple. Monitor *one* device's output. See if it presents the
information of interest to you in a form that you can easily recognize
(or *extract* if you have to handle a control and data channel
sharing the same stream).
Then, the other to determine that it contains what you want/expect.
Finally, use a pair of PC ports wired to the two different transmitters
and collect both streams simultaneously.
Note that if you don't have genuine serial ports (e.g., USB), there may be
some delays in the delivery of the observed data to the PC (e.g., buffering
in the device as well as in the stack in the PC). This could introduce
jitter in the timestamps. Just something to watch for. It *won't* alter
the order in which data from each transmitter arrives at the PC but
could affect the skew between the two devices... if large enough,
you may see replies to commands (in your log) before you see the commands!