Dive data import error with Hollis DG03

Hamish Moffatt hamish at cloud.net.au
Wed Mar 26 03:31:54 PDT 2014


On 26/03/14 19:17, Jef Driesen wrote:
> On 2014-03-26 07:17, Hamish Moffatt wrote:
>>
>> It works for me, although the first read times out (3 seconds) with no
>> reply at all. I don't remember it before but I just tried your regular
>> "universal" build and it does it too. Hmm. It could be the dive
>> computer though, which I would have to say is pretty dumb.
>
> I've noticed in the past that many dive computers require some delay 
> between open the serial port and sending the first request. That's why 
> in most libdivecomputer backends, you'll find a 100ms delay, followed 
> by a flush of the input buffer (that's another oddity, because I have 
> no idea how there can already be any data in the buffer immediately 
> after opening the serial port). Anyway, without that 100ms delay the 
> communication just fails. Maybe the dive computer needs some time to 
> notice the usb connection? I really don't know.

I think the data already in the buffer is caused by the act of plugging 
the cable into the dive computer, while it's already plugged into the 
USB. You'll get a whole lot of garbage into the buffer as the pins make 
contact, and probably bounce a fair bit. I don't think the VT3 
connection is particularly sound mechanically either.

On the other hand if you plug it into the dc and then the USB port you 
shouldn't get any data.



>
> I wonder if we can get rid of the initial failure by introducing a 
> small delay (for example 50ms or something like that) before sending 
> the first read request? Can you try that? Just add a serial_sleep call 
> near the end of the oceanic_atom2_device_open function

Yes I'll try that and report back later tonight.

>
>> I can try the Mac later too.
>
> That would be great.
>
>> Total runtime on Linux was 170 seconds, 129 on Windows.
>
> With an 8ms delay on all 4096 packets, that gives a total delay of 
> 32s. That explains already most of the difference.
>

The Mac ran fine. Open time for the serial port is even longer.

About 14% in (74 seconds) it had one glitch (NAK from the dc) and 
increased the sleep to 4ms. No problems after that. Total time was 
therefore 180 seconds.

[0.000528] DATETIME 2014-03-26T10:23:36Z (1395829416)
[0.000560] VERSION 0.5.0-devel (fa90009c293a9ca1a4eaf49a478b381477695c0a)
[0.000605] Opening the device (Oceanic VT3, /dev/tty.usbserial-20030001).
[0.000634] INFO: Open: name=/dev/tty.usbserial-20030001
[0.004355] INFO: Configure: baudrate=38400, databits=8, parity=0, 
stopbits=1, flowcontrol=0
[0.004497] INFO: Timeout: value=3000
[0.004511] INFO: Sleep: value=100
[0.105481] INFO: Flush: queue=3, input=10, output=0
[0.105660] INFO: Write: size=2, data=8400
[0.114103] INFO: Read: size=1, data=5A
[0.114122] INFO: Read: size=17, data=4F43452056543320523244203531324BBF
[0.114135] Registering the event handler.
[0.114138] Registering the cancellation handler.
[0.114162] Downloading the memory dump.
[0.114217] Event: vendor=4F43452056543320523244203531324B
[0.114245] Event: progress 0.00% (0/65536)
[0.114375] INFO: Write: size=4, data=B1000000
[0.130065] INFO: Read: size=1, data=5A
[0.130095] INFO: Read: size=17, data=0416041120081001425800730000000075
[0.130107] Event: progress 0.02% (16/65536)
[0.130298] INFO: Write: size=4, data=B1000100
[0.146099] INFO: Read: size=1, data=5A
[0.146144] INFO: Read: size=17, data=6701DA064204E506E206DC06FF0FAAFBF6
[0.146155] Event: progress 0.05% (32/65536)
[0.146407] INFO: Write: size=4, data=B1000200
[0.162035] INFO: Read: size=1, data=5A
[0.162060] INFO: Read: size=17, data=0000DC06FF0FDC06FF0F00000000AA8A14
[0.162065] Event: progress 0.07% (48/65536)
[0.162191] INFO: Write: size=4, data=B1000300
[0.177880] INFO: Read: size=1, data=5A
[0.177923] INFO: Read: size=17, data=890E370D00011B0B670542053250AAE1C2
[0.177935] Event: progress 0.10% (64/65536)
[0.178117] INFO: Write: size=4, data=B1000400
[0.193780] INFO: Read: size=1, data=5A
[0.193808] INFO: Read: size=17, data=300220028003500530BEB0BB0000000085
[0.193815] Event: progress 0.12% (80/65536)
[0.193999] INFO: Write: size=4, data=B1000500
[0.209668] INFO: Read: size=1, data=5A
[0.209690] INFO: Read: size=17, data=A014000300002C01980805A0022100024E
[0.209695] Event: progress 0.15% (96/65536)
[0.209803] INFO: Write: size=4, data=B1000600
[0.225742] INFO: Read: size=1, data=5A
[0.225768] INFO: Read: size=17, data=3899000099003102E9050400000000008F
[0.225774] Event: progress 0.17% (112/65536)
[0.225915] INFO: Write: size=4, data=B1000700
[0.241763] INFO: Read: size=1, data=5A
[0.241808] INFO: Read: size=17, data=0906290000000000003C00000100000277
[0.241819] Event: progress 0.20% (128/65536)
[0.241983] INFO: Write: size=4, data=B1000800
[0.257610] INFO: Read: size=1, data=5A
[0.257636] INFO: Read: size=17, data=A9A6C9AAAAAAAAAAAA0000000000000014
[0.257642] Event: progress 0.22% (144/65536)

[74.397162] INFO: Read: size=17, data=6400000310271400980805A0025100024C
[74.397171] Event: progress 14.42% (9056/62800)
[74.397189] Dive: number=7, size=2104, fingerprint=02111F1E1BA689A2
[74.397749] Creating the parser.
[74.397767] Registering the data.
[74.397772] Parsing the datetime.
[74.397779] Parsing the divetime.
[74.397831] Parsing the maxdepth.
[74.397839] Parsing the gas mixes.
[74.397850] Parsing the salinity.
[74.397853] Parsing the atmospheric pressure.
[74.397857] Parsing the sample data.
[74.400117] Destroying the parser.
[74.400315] INFO: Write: size=4, data=B109A500
[74.412875] INFO: Read: size=1, data=5A
[74.412897] INFO: Read: size=17, data=51001502F900A0040051043E000000FF97
[74.412904] Event: progress 14.45% (9072/62800)
[74.413005] INFO: Write: size=4, data=B109A400
[74.428902] INFO: Read: size=1, data=A5
[74.428949] ERROR: Unexpected answer start byte(s). [in 
../../source/src/oceanic_atom2.c:343 (oceanic_atom2_send)]
[74.428962] INFO: Sleep: value=4
[74.433236] INFO: Write: size=4, data=B109A400
[74.444730] INFO: Read: size=1, data=5A
[74.460734] INFO: Read: size=17, data=010C700057023200010C4A20570234000C
[74.460758] Event: progress 14.47% (9088/62800)
[74.460771] INFO: Sleep: value=4
[74.465065] INFO: Write: size=4, data=B109A300
[74.476669] INFO: Read: size=1, data=5A
[74.492594] INFO: Read: size=17, data=010C660057023300010C7B005702310011
[74.492614] Event: progress 14.50% (9104/62800)
[74.492625] INFO: Sleep: value=4

[181.407643] Event: progress 99.97% (62784/62800)
[181.407652] INFO: Sleep: value=4
[181.411905] INFO: Write: size=4, data=B10BE300
[181.423663] INFO: Read: size=1, data=5A
[181.439683] INFO: Read: size=17, data=6400000300001400880805A00251000205
[181.439721] Event: progress 100.00% (62800/62800)
[181.439730] Dive: number=59, size=1656, fingerprint=38881F032AE39BC4
[181.440034] Creating the parser.
[181.440043] Registering the data.
[181.440046] Parsing the datetime.
[181.440050] Parsing the divetime.
[181.440071] Parsing the maxdepth.
[181.440076] Parsing the gas mixes.
[181.440083] Parsing the salinity.
[181.440087] Parsing the atmospheric pressure.
[181.440091] Parsing the sample data.
[181.440934] Destroying the parser.
[181.440981] Closing the device.
[181.440987] INFO: Sleep: value=4
[181.445586] INFO: Write: size=4, data=6A05A500
[181.455478] INFO: Read: size=1, data=A5
[181.455923] Result: Success


Hamish


More information about the subsurface mailing list