On 12/03/14 13:17, Linus Torvalds wrote:
[0.187] INFO: Read: size=1, data=5A So the Linux dump sometimes got A5 instead of 5A.
But the *timing* is very vert different. Here's Linux getting the right data:
[0.104540] INFO: Write: size=2, data=8400 [0.104551] INFO: Read: size=1, data=5A
and here's the same thing with the wrong data:
[0.109560] INFO: Sleep: value=1 [0.110624] INFO: Write: size=4, data=B1000000 [0.110634] INFO: Read: size=1, data=A5
Note how it did a two-byte write, and then immediately a read within 10 microseconds.
Which is a bit odd. Jef, shouldn't the sleep be *after* the write, and before the read? If there are any duplex issues, the "read -> write" turnaround isn't the problem (because by the time the read returns, we certainly know the data had been fully sent from the other side), but the "write -> read" turnaround might be problematic if the reader gets confused by DSR coming on while it's still receiving.
That log (with sleeps of 1ms) is from my adding the sleep before write as Jef suggested.
It's only a 3 wire interface at the dive computer, so if DSR is used it's internal to the interface cable. I tried adding 1ms delay after write and I didn't see any change in behaviour. Logically there's no reason to sleep after the write, because it's doing a blocking read and it's receiving a reply (5A, a nak) within the timeout period?
Anyway to clarify matters here's a log from a fresh unmodified check out. It's failing the same as 0.4.2.
[0.000025] DATETIME 2014-03-12T02:26:56Z (1394591216) [0.000048] VERSION 0.5.0-devel (575f2e9016ac9baa2b1b031caa6fe0bc77cdbbee) [0.000053] DEVICE=/dev/ttyUSB0 [0.000061] oceanic_atom2_device_open [0.000069] INFO: Open: name=/dev/ttyUSB0 [0.000864] INFO: Configure: baudrate=38400, databits=8, parity=0, stopbits=1, flowcontrol=0 [0.000970] INFO: Timeout: value=3000 [0.000977] INFO: Sleep: value=100 [0.101052] INFO: Flush: queue=3, input=0, output=0 [0.101494] INFO: Write: size=2, data=8400 [0.102418] INFO: Read: size=1, data=5A [0.106364] INFO: Read: size=17, data=4F43452056543320523244203531324BBF [0.106390] dc_device_dump [0.107273] INFO: Write: size=4, data=B1000000 [3.108674] INFO: Read: size=0, data= [3.108685] ERROR: Failed to receive the answer. [in oceanic_atom2.c:332 (oceanic_atom2_send)] [3.108688] INFO: Sleep: value=100 [3.208757] INFO: Flush: queue=1, input=0, output=0 [3.211274] INFO: Write: size=4, data=B1000000 [3.211283] INFO: Read: size=1, data=5A [3.220967] INFO: Read: size=17, data=0416041120081001425800730000000075 [3.223274] INFO: Write: size=4, data=B1000100 [6.226294] INFO: Read: size=0, data= [6.226306] ERROR: Failed to receive the answer. [in oceanic_atom2.c:332 (oceanic_atom2_send)] [6.226309] INFO: Sleep: value=100 [6.326377] INFO: Flush: queue=1, input=0, output=0 [6.327275] INFO: Write: size=4, data=B1000100 [6.327722] INFO: Read: size=1, data=5A [6.338681] INFO: Read: size=17, data=6701DA064204E506E206DC06FF0FAAFBF6 [6.339275] INFO: Write: size=4, data=B1000200 [9.342297] INFO: Read: size=0, data= [9.342309] ERROR: Failed to receive the answer. [in oceanic_atom2.c:332 (oceanic_atom2_send)] [9.342322] INFO: Sleep: value=100 [9.442390] INFO: Flush: queue=1, input=0, output=0 [9.443290] INFO: Write: size=4, data=B1000200 [9.444317] INFO: Read: size=1, data=5A [9.455334] INFO: Read: size=17, data=0000DC06FF0FDC06FF0F00000000AA8A14 [9.459280] INFO: Write: size=4, data=B1000300 [9.459290] INFO: Read: size=1, data=A5 [9.459292] ERROR: Unexpected answer start byte(s). [in oceanic_atom2.c:338 (oceanic_atom2_send)] [9.459305] INFO: Sleep: value=100 [9.559376] INFO: Flush: queue=1, input=0, output=0 [9.563276] INFO: Write: size=4, data=B1000300 [9.563287] INFO: Read: size=1, data=5A [9.571795] INFO: Read: size=17, data=890E370D00011B0B670542053250AAE1C2 [9.575273] INFO: Write: size=4, data=B1000400 [12.578294] INFO: Read: size=0, data= [12.578306] ERROR: Failed to receive the answer. [in oceanic_atom2.c:332 (oceanic_atom2_send)] [12.578309] INFO: Sleep: value=100 [12.678377] INFO: Flush: queue=1, input=0, output=0 [12.679278] INFO: Write: size=4, data=B1000400 [12.680546] INFO: Read: size=1, data=5A [12.691540] INFO: Read: size=17, data=300220028003500530BEB0BB0000000085 [12.695277] INFO: Write: size=4, data=B1000500 [12.695287] INFO: Read: size=1, data=A5 [12.695289] ERROR: Unexpected answer start byte(s). [in oceanic_atom2.c:338 (oceanic_atom2_send)] [12.695292] INFO: Sleep: value=100 [12.795364] INFO: Flush: queue=1, input=0, output=0 [12.799274] INFO: Write: size=4, data=B1000500 [12.799284] INFO: Read: size=1, data=5A [12.808012] INFO: Read: size=17, data=A014000300002C01980805A0022100024E [12.811273] INFO: Write: size=4, data=B1000600 [12.811281] INFO: Read: size=1, data=A5 [12.811283] ERROR: Unexpected answer start byte(s). [in oceanic_atom2.c:338 (oceanic_atom2_send)] [12.811286] INFO: Sleep: value=100 [12.911358] INFO: Flush: queue=1, input=0, output=0 [12.915277] INFO: Write: size=4, data=B1000600 [12.915291] INFO: Read: size=1, data=5A [12.924526] INFO: Read: size=17, data=3899000099003102E9050400000000008F [12.927275] INFO: Write: size=4, data=B1000700 [12.927285] INFO: Read: size=1, data=A5 [12.927287] ERROR: Unexpected answer start byte(s). [in oceanic_atom2.c:338 (oceanic_atom2_send)] [12.927290] INFO: Sleep: value=100
and here's a log with a 1ms sleep after write:
[0.000029] DATETIME 2014-03-12T02:37:41Z (1394591861) [0.000050] VERSION 0.5.0-devel (575f2e9016ac9baa2b1b031caa6fe0bc77cdbbee) [0.000054] DEVICE=/dev/ttyUSB0 [0.000060] oceanic_atom2_device_open [0.000065] INFO: Open: name=/dev/ttyUSB0 [0.000936] INFO: Configure: baudrate=38400, databits=8, parity=0, stopbits=1, flowcontrol=0 [0.001179] INFO: Timeout: value=3000 [0.001185] INFO: Sleep: value=100 [0.101259] INFO: Flush: queue=3, input=234, output=0 [0.101550] INFO: Write: size=2, data=8400 [0.101557] INFO: Sleep: value=1 [0.103201] INFO: Read: size=1, data=5A [0.107077] INFO: Read: size=17, data=4F43452056543320523244203531324BBF [0.107097] dc_device_dump [0.108720] INFO: Write: size=4, data=B1000000 [0.108727] INFO: Sleep: value=1 [3.112802] INFO: Read: size=0, data= [3.112814] ERROR: Failed to receive the answer. [in oceanic_atom2.c:333 (oceanic_atom2_send)] [3.112817] INFO: Sleep: value=100 [3.212886] INFO: Flush: queue=1, input=0, output=0 [3.216734] INFO: Write: size=4, data=B1000000 [3.216741] INFO: Sleep: value=1 [3.217802] INFO: Read: size=1, data=5A [3.225648] INFO: Read: size=17, data=0416041120081001425800730000000075 [3.228718] INFO: Write: size=4, data=B1000100 [3.228724] INFO: Sleep: value=1 [3.229784] INFO: Read: size=1, data=A5 [3.229787] ERROR: Unexpected answer start byte(s). [in oceanic_atom2.c:339 (oceanic_atom2_send)] [3.229790] INFO: Sleep: value=100 [3.329855] INFO: Flush: queue=1, input=0, output=0 [3.332716] INFO: Write: size=4, data=B1000100 [3.332721] INFO: Sleep: value=1 [3.333782] INFO: Read: size=1, data=5A [3.342275] INFO: Read: size=17, data=6701DA064204E506E206DC06FF0FAAFBF6 [3.344750] INFO: Write: size=4, data=B1000200 [3.344757] INFO: Sleep: value=1 [6.348834] INFO: Read: size=0, data= [6.348845] ERROR: Failed to receive the answer. [in oceanic_atom2.c:333 (oceanic_atom2_send)] [6.348849] INFO: Sleep: value=100 [6.448920] INFO: Flush: queue=1, input=0, output=0 [6.452722] INFO: Write: size=4, data=B1000200 [6.452728] INFO: Sleep: value=1 [6.453794] INFO: Read: size=1, data=5A [6.461925] INFO: Read: size=17, data=0000DC06FF0FDC06FF0F00000000AA8A14 [6.464720] INFO: Write: size=4, data=B1000300 [6.464727] INFO: Sleep: value=1 [6.465792] INFO: Read: size=1, data=A5 [6.465798] ERROR: Unexpected answer start byte(s). [in oceanic_atom2.c:339 (oceanic_atom2_send)] [6.465801] INFO: Sleep: value=100 [6.565869] INFO: Flush: queue=1, input=0, output=0 [6.568718] INFO: Write: size=4, data=B1000300 [6.568724] INFO: Sleep: value=1 [6.569784] INFO: Read: size=1, data=5A [6.578391] INFO: Read: size=17, data=890E370D00011B0B670542053250AAE1C2 [6.580718] INFO: Write: size=4, data=B1000400 [6.580724] INFO: Sleep: value=1 [6.581785] INFO: Read: size=1, data=A5 [6.581789] ERROR: Unexpected answer start byte(s). [in oceanic_atom2.c:339 (oceanic_atom2_send)] [6.581792] INFO: Sleep: value=100 [6.681864] INFO: Flush: queue=1, input=0, output=0 [6.684751] INFO: Write: size=4, data=B1000400 [6.684758] INFO: Sleep: value=1 [6.685823] INFO: Read: size=1, data=5A [6.694910] INFO: Read: size=17, data=300220028003500530BEB0BB0000000085 [6.696738] INFO: Write: size=4, data=B1000500 [6.696745] INFO: Sleep: value=1 [6.697806] INFO: Read: size=1, data=A5 [6.697812] ERROR: Unexpected answer start byte(s). [in oceanic_atom2.c:339 (oceanic_atom2_send)] [6.697814] INFO: Sleep: value=100 [6.797879] INFO: Flush: queue=1, input=0, output=0 [6.800723] INFO: Write: size=4, data=B1000500 [6.800730] INFO: Sleep: value=1 [6.801823] INFO: Read: size=1, data=5A [6.810503] INFO: Read: size=17, data=A014000300002C01980805A0022100024E [6.812718] INFO: Write: size=4, data=B1000600 [6.812723] INFO: Sleep: value=1 [6.813788] INFO: Read: size=1, data=A5 [6.813794] ERROR: Unexpected answer start byte(s). [in oceanic_atom2.c:339 (oceanic_atom2_send)] [6.813797] INFO: Sleep: value=100 [6.913866] INFO: Flush: queue=1, input=0, output=0 [6.916722] INFO: Write: size=4, data=B1000600 [6.916728] INFO: Sleep: value=1 [6.917794] INFO: Read: size=1, data=5A [6.927021] INFO: Read: size=17, data=3899000099003102E9050400000000008F
I'd kill for an RS-232 capable logic analyser right now, so I could see what's actually happening at the dive computer.
Hamish