[Coco] Socat drivewire relay to CoCo1

jon bird news at onastick.clara.co.uk
Sat Feb 28 06:21:02 EST 2015


Hi,

Now I've got my CoCo 1 up and running again I thought I'd give Drivewire
a go. A couple of initial queries then - I made the cable up iaw with
the diagram here:

http://www.cocopedia.com/wiki/index.php/Getting_Started_with_DriveWire

I'm not entirely sure of the significance of the CD/"turbo mode" option
and there seems to be some differences in the baud rate you need to set
the server end to - either 38400 or 57600. Currently the only
configuration I get anything sensible with is 38400 with or without CD
connected.

That aside, I can get something basic up and running.

For logistical reasons though, I can't really run it near the same
machine that is hosting the Drivewire server. So my plan was to hook the
CoCo up to a Raspberry Pi, then have the protocol relayed over TCP using
something like 'socat'.

I've configured Drivewire to use TCP client mode & run on the Pi the
following:

socat -v tcp-l:65505,reuseaddr,nodelay,fork file:/dev/ttyUSB0

The server connects up to it ok however all I get on the CoCo end is an
I/O Error.

Running up a Wireshark trace does show semi-sensible things happening -
I see what looks like a read sector request go in, the response back but
the checksum computed by the CoCo is bounced by the server:

>>>>>>>>>> ---------START--------------------- <<<<<
>>>>>>>>>> ----------------------------------- <<<<<
>>>>>>>>>> ----------------------------------- <<<<<
>>>>>>>>>> ----------------------------------- <<<<<
>>>>>>>>>> ----------------------------------- <<<<<

No.     Time        Source                Destination           Protocol
Length Info
    628 2.426343    192.168.0.109         192.168.0.201         TCP 68
65505 > 49552 [PSH, ACK] Seq=1 Ack=1 Win=453 Len=2 TSval=44814
TSecr=229029303

Data (2 bytes)
0000  d2 00                                             ..
    Data: d200
    [Length: 2]

No.     Time        Source                Destination           Protocol
Length Info
    632 2.428268    192.168.0.109         192.168.0.201         TCP 69
65505 > 49552 [PSH, ACK] Seq=3 Ack=1 Win=453 Len=3 TSval=44814
TSecr=229032266

Data (3 bytes)
0000  00 01 42                                          ..B
    Data: 000142
    [Length: 3]

No.     Time        Source                Destination           Protocol
Length Info
    634 2.430765    192.168.0.201         192.168.0.109         TCP 322
49552 > 65505 [PSH, ACK] Seq=1 Ack=6 Win=115 Len=256 TSval=229032267
TSecr=44814

Data (256 bytes)

0000  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................
0010  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................
0020  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................
0030  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................
0040  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................
0050  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................
0060  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................
0070  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................
0080  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................
0090  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................
00a0  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................
00b0  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................
00c0  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................
00d0  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................
00e0  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................
00f0  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................
    Data: ffffffffffffffffffffffffffffffffffffffffffffffff...
    [Length: 256]

No.     Time        Source                Destination           Protocol
Length Info
    645 2.499146    192.168.0.109         192.168.0.201         TCP 68
65505 > 49552 [PSH, ACK] Seq=6 Ack=257 Win=498 Len=2 TSval=44821
TSecr=229032267

Data (2 bytes)

0000  fb 6d                                             .m
    Data: fb6d
    [Length: 2]

No.     Time        Source                Destination           Protocol
Length Info
    646 2.502481    192.168.0.201         192.168.0.109         TCP 67
49552 > 65505 [PSH, ACK] Seq=257 Ack=8 Win=115 Len=1 TSval=229032285
TSecr=44821

Data (1 byte)

0000  f3                                                .
    Data: f3
    [Length: 1]

>>>>>>>>>> --------END------------------------ <<<<<
>>>>>>>>>> ----------------------------------- <<<<<
>>>>>>>>>> ----------------------------------- <<<<<
>>>>>>>>>> ----------------------------------- <<<<<
>>>>>>>>>> ----------------------------------- <<<<<


Now of interest, is if I take the Pi out of the equation and use the
same approach but on the machine running the Drivewire server (ie. socat
is relaying on the localhost) it works:


>>>>>>>>>> ---------START--------------------- <<<<<
>>>>>>>>>> ----------------------------------- <<<<<
>>>>>>>>>> ----------------------------------- <<<<<
>>>>>>>>>> ----------------------------------- <<<<<
>>>>>>>>>> ----------------------------------- <<<<<


No.     Time        Source                Destination           Protocol
Length Info
     17 2.567686    127.0.0.1             127.0.0.1             TCP 67
65505 > 56229 [PSH, ACK] Seq=1 Ack=1 Win=400 Len=1 TSval=228967531
TSecr=228963225

Data (1 byte)

0000  d2                                                .
    Data: d2
    [Length: 1]

No.     Time        Source                Destination           Protocol
Length Info
     18 2.568189    127.0.0.1             127.0.0.1             TCP 68
65505 > 56229 [PSH, ACK] Seq=2 Ack=1 Win=400 Len=2 TSval=228967531
TSecr=228963225

Data (2 bytes)

0000  00 00                                             ..
    Data: 0000
    [Length: 2]

No.     Time        Source                Destination           Protocol
Length Info
     20 2.568789    127.0.0.1             127.0.0.1             TCP 68
65505 > 56229 [PSH, ACK] Seq=4 Ack=1 Win=400 Len=2 TSval=228967532
TSecr=228963225

Data (2 bytes)

0000  01 42                                             .B
    Data: 0142
    [Length: 2]

No.     Time        Source                Destination           Protocol
Length Info
     25 2.572117    127.0.0.1             127.0.0.1             TCP 322
56229 > 65505 [PSH, ACK] Seq=1 Ack=6 Win=342 Len=256 TSval=228967532
TSecr=228967532

Data (256 bytes)

0000  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................
0010  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................
0020  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................
0030  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................
0040  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................
0050  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................
0060  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................
0070  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................
0080  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................
0090  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................
00a0  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................
00b0  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................
00c0  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................
00d0  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................
00e0  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................
00f0  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff   ................
    Data: ffffffffffffffffffffffffffffffffffffffffffffffff...
    [Length: 256]

No.     Time        Source                Destination           Protocol
Length Info
     29 2.646025    127.0.0.1             127.0.0.1             TCP 67
65505 > 56229 [PSH, ACK] Seq=6 Ack=257 Win=409 Len=1 TSval=228967551
TSecr=228967532

Data (1 byte)

0000  ff                                                .
    Data: ff
    [Length: 1]

No.     Time        Source                Destination           Protocol
Length Info
     30 2.646903    127.0.0.1             127.0.0.1             TCP 67
65505 > 56229 [PSH, ACK] Seq=7 Ack=257 Win=409 Len=1 TSval=228967551
TSecr=228967532

Data (1 byte)

0000  00                                                .
    Data: 00
    [Length: 1]

No.     Time        Source                Destination           Protocol
Length Info
     32 2.647339    127.0.0.1             127.0.0.1             TCP 67
56229 > 65505 [PSH, ACK] Seq=257 Ack=8 Win=342 Len=1 TSval=228967551
TSecr=228967551

Data (1 byte)

0000  00                                                .
    Data: 00
    [Length: 1]

>>>>>>>>>> --------END------------------------ <<<<<
>>>>>>>>>> ----------------------------------- <<<<<
>>>>>>>>>> ----------------------------------- <<<<<
>>>>>>>>>> ----------------------------------- <<<<<
>>>>>>>>>> ----------------------------------- <<<<<

The exchange looks good, it's just a duff checksum in the first case.
The only obvious difference is how the serial data is packeted up which
would cause some subtle timing differences maybe...?

In both instances I'm using the same Prolific USB serial port converter.
I've also tried swapping out the Rasperry Pi with a Linux laptop and get
the same behaviour.

Does anyone have any experience of this or can explain the behaviour I'm
seeing?

Rgs,


Jon.
-- 
== jon bird - software engineer
== <reply to address _may_ be invalid, real mail below>
== <reduce rsi, stop using the shift key>
== posted as: news 'at' onastick 'dot' clara.co.uk



More information about the Coco mailing list