Cochran DC Data Structures

John Van Ostrand john at vanostrand.com
Sun Nov 2 18:45:53 PST 2014


The Cochran DCs have a distinct data download and format.

Basic communication;

Recent model Cochran computers (Commander, EMC and probably the Gemini) use
a 3 pin interface to a custom USB<->RS-232 FTDI chip interface provided by
Cochran.

Initial connections to the device are made at 9600, n, 8, 2, with no flow
control. The DC will not respond to commands until it is first prompted.
Prompting the device with 1 flush of output queues and 6 flushes of input
queues triggers the device to send a heartbeat byte of 0xAA every second.
Commands sent before an AA byte is issued are ignored.

Most commands respond using the same serial parameters as used to send the
command however large data transfers like logbook and sample download
responses are sent at a higher rate. The rate depends on the DC model. The
EMC baud rate is 825,600bps while the Commander is 115,200.

For example, to download a typical command, like a configuration block one
would do this:
     Open port @ 9600, n, 8, 2, no fc
     Flush output
     Flush input (repeat 6 times)
     Wait to receive 0xAA heart beat byte
     send 0x96 0x00
     receive 512 bytes

However for a logbook download:
    Open port @9600, n, 8, 2, no fc
    Flush output
    Flush input (repeat 6 times)
    Wait to receive 0xAA heart beat byte
    send 0x15 (4 byte address) (4 byte size) 0x05
    reconfigure port to 825600
    receive bytes
    set port back to 9600

There is one exception to this protocol. To download the miscellaneous
block of data we send one byte, wait for a heart beat then send the
remaining command and wait for a response.

The example shows opening the port for every command only to illustrate the
settings. In practice the port is opened only once and all blocks of data
can be downloaded.

The series of reads are as such:

67 byte "id" block (cmd: 0x05, 0x9D, 0xFF, 0x00, 0x43, 0x00)

if this id block doesn't have the string "(C)" then read another id block

67 byte "id" block (cmd: 0x05, 0xBD, 0x7F, 0x00, 0x43, 0x00)

Read 2 or 4 config blocks

512 bytes "config" block (cmd 0x96, 0x00)
512 bytes "config" block (cmd 0x96, 0x01)
512 bytes "config" block (cmd 0x96, 0x02)
512 bytes "config" block (cmd 0x96, 0x03)

Within the config block will be the settings of the computer. In some cases
the owner's information is there. More importantly the first block contains
the number of dives in computer memory. This number can be as high as 1024.

A miscellaneous block can be read.

1500 bytes "misc" (cmd: 0x89, 0x05, 0xCA, 0xFD, 0x00, 0xDC, 0x05)

Using information from the config we can read the logbook. Logs for each
dive are 256 bytes for an older computer and 512 bytes for a new computer.
Each log has a dive start section containing the information known at the
dive start, like date/time, SIT, temp, starting tissue pressures, and much
of the computer's configuration at the time the dive started. Importantly
it contains the byte offset into sample memory where the dive samples
begin. This start section is exactly half the size of the log so 128 or 256
bytes. The second half is the end-dive section that contains summary
information about the dive itself. It contains the ending memory offset of
the dive samples, dive time, avg depth, max depth, min temp, etc.

NOTE: The cmd below shows an EMC command. The Commander command uses 3 byte
addresses and sizes.

??? bytes "logbook" (cmd 0x15 (4 byte address), (4 byte size) 0x05

Sample data occurs every second during the dive, off-gassing seconds and
inter-dive events like altitude and temperature changes and unit-on events.

Sample data is delivered in either 2 bytes/second (commander) or 3
bytes/second (EMC). Bits 0-6 of the first byte is always the change in
depth in 1/4ft increments, with bit 6 indicating negative.Bit 7 is a flag
bit, 0 indicated a depth sample 1 indicates a dive event, like ascent
warning, or gas change. The second byte varies. On the first sample it's
the ascent rate/min in 1/4ft units. Bit 7 indicates a negative. On the
second sample it's the temperature, in 1/2 degrees F above 20. These two
alternate throughout the dive.

On the EMC there is a third byte which is also overloaded. Twenty four
seconds of samples are needed to assemble the third sample. The first 20
bytes of this sample contain the tissue pressures, the next four contain
the NDL minutes (in 2 bytes)  (if not in deco) or deepest stop deco time (2
bytes) plus the total deco time (last two bytes).

So a full cycle of samples on an EMC takes 24 seconds which contains 24
depth samples, 12 ascent rate samples, 12 temp samples, one set of tissue
pressures, and the NDL or Deco time remaining.

??? bytes "sample" (cmd 0x15 (4 byte address) (4 byte size) 0x05

There is more detail to this protocol but this describes the basics.
Examples use EMC protocol.

The base memory for samples and for logbook varies based on the model. The
size of memory varies based on model and based on the features enabled for
the model. The date format varies between models.

I suspect that lots of other parts of memory can be read using these
commands. I haven't explored that.


-- 
John Van Ostrand
At large on sabbatical
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://libdivecomputer.org/pipermail/devel/attachments/20141102/2c13165d/attachment-0001.html>


More information about the devel mailing list