<div dir="ltr"><div><div><div><div>The Cochran DCs have a distinct data download and format.<br><br></div>Basic communication;<br><br></div>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.<br><br></div>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.<br><br></div><div>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. <br><br>For example, to download a typical command, like a configuration block one would do this:<br></div><div> Open port @ 9600, n, 8, 2, no fc<br></div><div> Flush output<br></div><div> Flush input (repeat 6 times)<br></div><div> Wait to receive 0xAA heart beat byte<br></div><div> send 0x96 0x00<br></div><div> receive 512 bytes<br><br></div><div>However for a logbook download:<br></div><div> Open port @9600, n, 8, 2, no fc<br><div> Flush output<br></div><div> Flush input (repeat 6 times)<br></div> Wait to receive 0xAA heart beat byte<br></div><div> send 0x15 (4 byte address) (4 byte size) 0x05<br></div><div> reconfigure port to 825600<br></div><div> receive bytes<br></div><div> set port back to 9600<br></div><div><br></div><div>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.<br><br>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.<br><br></div><div>The series of reads are as such:<br><br></div><div>67 byte "id" block (cmd: 0x05, 0x9D, 0xFF, 0x00, 0x43, 0x00)<br><br></div><div>if this id block doesn't have the string "(C)" then read another id block <br><br></div><div>67 byte "id" block (cmd: 0x05, 0xBD, 0x7F, 0x00, 0x43, 0x00)<br><br></div><div>Read 2 or 4 config blocks<br><br></div><div>512 bytes "config" block (cmd 0x96, 0x00)<br>512 bytes "config" block (cmd 0x96, 0x01)<br>512 bytes "config" block (cmd 0x96, 0x02)<br>512 bytes "config" block (cmd 0x96, 0x03)<br><br></div><div>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. <br><br></div><div>A miscellaneous block can be read. <br><br></div><div>1500 bytes "misc" (cmd: 0x89, 0x05, 0xCA, 0xFD, 0x00, 0xDC, 0x05)<br><br></div><div>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.<br><br></div><div>NOTE: The cmd below shows an EMC command. The Commander command uses 3 byte addresses and sizes.<br></div><div><br></div><div>??? bytes "logbook" (cmd 0x15 (4 byte address), (4 byte size) 0x05<br></div><div> </div><div>Sample data occurs every second during the dive, off-gassing seconds and inter-dive events like altitude and temperature changes and unit-on events.<br><br>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. <br></div><div><br></div><div>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).<br><br></div><div>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.<br><br></div><div>??? bytes "sample" (cmd 0x15 (4 byte address) (4 byte size) 0x05<br><br></div><div>There is more detail to this protocol but this describes the basics. Examples use EMC protocol. <br><br></div><div>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.<br><br></div><div>I suspect that lots of other parts of memory can be read using these commands. I haven't explored that.<br></div><div><br></div><div><br></div><div>-- <br><div class="gmail_signature"><div dir="ltr"><div>John Van Ostrand<br></div><div>At large on sabbatical<br></div><br></div></div>
</div></div>