Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Cochran Commander and EMC

Cochran Undersea Technology’s Commander and EMC computers share one serial protocol. It has no packet framing and no checksums. Raw command bytes are sent one at a time, and the device answers with a block of raw memory of the requested length. Bulk memory reads start at 9600 baud, and both ends then switch to a model-specific high speed (115200 or 850000 baud) for the data. The device keeps a logbook ring (fixed-size dive summaries) and a profile ring (variable-length, delta-encoded samples interleaved with event bytes). Profile data includes “inter-dive” events recorded while the diver was on the surface.

The serial link uses no encryption or obfuscation. All memory is read as plain bytes.

No public vendor documentation is known. The only source is libdivecomputer, so most sections here are likely or uncertain.

Devices

VendorModelModel codeModel string (ID block 0x3D..0x3F)Notes
CochranCommander TM00A 31 32 (\x0A “12”)oldest; SRAM; 9600 baud only
CochranCommander I (serial numbers below 21000)111 32 31 (\x11 “21”)115200 high speed
CochranCommander II (Air/Nitrox)211 32 32 (\x11 “22”)115200 high speed
CochranEMC-143“730”, “731”850000 high speed
CochranEMC-164“A30”, “A31”850000 high speed
CochranEMC-20H5“230”, “231”, 40 33 30 (\x40 “30”)850000 high speed

Transport: RS-232 serial through Cochran’s interface cable, commonly through a USB-serial adapter that can run at 850000 baud. There are no USB IDs, Bluetooth names or IrDA nicknames.

Confidence: likely.

Transport parameters

PhaseBaudFormatFlow control
wake-up, ID, config, command bytes96008N2 (two stop bits)none
bulk data, Commander I/II1152008N2none
bulk data, EMC-14/16/20H8500008N2none
bulk data, Commander TM9600 (no switch)8N2none
  • Read timeout: 5000 ms.
  • Command bytes MUST be sent one byte at a time, 16 ms apart. The device has no input buffer and drops a command sent as one burst.
  • The baud switch: the host sends the last command byte at 9600, waits 45 ms, reconfigures its port to the high rate, and reads the data.
  • The host may read in chunks of any size. libdivecomputer reads 1024 bytes at a time for progress reporting.

Confidence: likely.

Session

Wake-up / heartbeat. This step is done at open and again before every bulk read:

  1. Configure 9600 8N2.
  2. Assert BREAK for 16 ms, then clear it.
  3. Flush the input buffer. The device sends heartbeat bytes, and old ones must be discarded.
  4. Read 1 byte. It MUST be AA (heartbeat). Anything else is a protocol error.

Identification. At 9600 baud (no speed switch), read 67 bytes with the low-speed read command (see Commands) from address 0x00FF9D:

H→D  05 9D FF 00 43 00      (one byte at a time, 16 ms apart)
D→H  <67 bytes>

If the block does not begin with ASCII "(C)", the device is a Commander. Repeat the read from address 0x007FBD:

H→D  05 BD 7F 00 43 00
D→H  <67 bytes>

The 3 bytes at offset 0x3D of the block select the model (see Devices). An unknown string means the model is unsupported.

Configuration. Read 512-byte config pages at 9600 baud. Command 96 <page> (2 bytes) for pages 0 and 1, which give 1024 bytes in total. The Commander TM has a single page and takes only the 1-byte command 96.

There is no explicit shutdown.

Confidence: likely.

Commands

CommandH→D bytesArgumentsD→H responseUsed by
Low-speed read05 a0 a1 a2 n0 n124-bit LE address, 16-bit LE lengthn bytes at 9600; length 0 returns 32768 bytesID block (all); all data on the TM
Commander high-speed read15 a0 a1 a2 n0 n1 n2 0424-bit LE address, 24-bit LE length, 04 terminatorn bytes at 115200Commander I/II
EMC high-speed read15 a0 a1 a2 a3 n0 n1 n2 n3 0532-bit LE address, 32-bit LE length, 05 terminatorn bytes at 850000EMC-14/16/20H
Config page96 p (TM: 96)page number 0 or 1512 bytes at 9600all

Every bulk read (low- or high-speed) follows the same sequence: wait 550 ms, run the wake/heartbeat sequence, send the command bytes 16 ms apart, then (high-speed only) wait 45 ms and switch baud, then read exactly n bytes. The reference retries a failed or timed-out read up to 2 more times.

Example: EMC read of 512 bytes from address 0:

H→D  15 00 00 00 00 00 02 00 00 05   (bytes 16 ms apart, at 9600 8N2)
     (host waits 45 ms and switches to 850000 8N2)
D→H  <512 bytes>

Confidence: likely.

Framing and integrity

None. Responses are raw memory with no header, length or checksum. The host can detect errors only by timeouts and by checking that the data is plausible (pointers inside the ring, dive numbers consistent).

Memory layout

Address map per model

Addresses below are device addresses. Pointers stored in the logbook and config are relative to the logbook base (column “base”), which is 0 except on the TM.

ModelbaseLogbook areaEntries × sizeProfile ring
Commander TM0x0100000x010000–0x01232B100 × 900x01232B–0x018000
Commander I00x000000–0x020000512 × 2560x020000–0x100000
Commander II00x000000–0x020000512 × 2560x020000–0x100000
EMC-1400x000000–0x020000256 × 5120x022000–0x200000
EMC-1600x000000–0x0800001024 × 5120x094000–0x800000
EMC-20H00x000000–0x0800001024 × 5120x094000–0x1000000

The logbook area is a ring of fixed-size entries; entry k is at base + k × size. The profile ring follows it directly, so one read starting at the logbook base covers both. A full dump is the read of [base, profile end).

Integer encodings

Model groupConfig wordsPointers inside logbook entries
Commander TMu16be dive count. 32-bit values are “word big-endian”: bytes b0 b1 b2 b3 mean (b2 b3) as the high word and (b0 b1) as the low word, each word big-endian. Value = b2·2²⁴ + b3·2¹⁶ + b0·2⁸ + b1u16le
Commander I/IIas TMu32le
EMCu16le / u32leu32le

Config fields (offset into the 1024-byte config; 512 for TM)

FieldTMCommander I/IIEMC
total dive count (u16)0x1460x0460x0D2
profile write head: end of the newest profile data, relative to base0x1580x06C0x13E
end of the last inter-dive data (not needed for download)–0x0700x142
serial number (u32)0x15C0x0AA0x1E6

On the TM, the reference reads the write head at 0x158 as u16be in one place and as a word-big-endian u32 in another (see Open questions).

Pointer fields inside each logbook entry

FieldTMCommander ICommander IIEMC
fingerprint (offset, length)15, 412, 40, 60, 6
profile start pointer0 (u16le)066
pointer to the pre-dive data start0283030
profile end pointer (FFFFFFFF = dive end not recorded)none; use the next dive’s start or the write head128128256
dive number (u16le)20687086

Confidence: likely for the address map and offsets; uncertain for the TM encodings.

Download procedure

open; wake; read ID; pick model layout; read config
count = config.dive_count
if count == 0: done
n_entries = min(count, entries_per_ring)
read n_entries × entry_size bytes starting at the logbook base
if count <= entries_per_ring: head = count  else: head = count mod entries_per_ring
write_head = base + config.profile_write_head

# Work out which dives still have profile data (the profile ring may have wrapped
# past older dives even though their logbook entries survive):
capacity = profile_end − profile_begin
prev = write_head
for i in 0 .. n_entries−1:                  # newest to oldest
    idx = (head − 1 − i) mod entries_per_ring
    if entry[idx].fingerprint == known_fingerprint: stop scanning; newer dives only
    pre = base + entry[idx].pre_pointer
    capacity −= ring_distance(pre, prev); prev = pre
    if capacity < 0: dives idx and older have no profile left

# Read and emit, newest first. One backward-moving read cursor starts at write_head:
cursor_end = write_head
for each dive newer than the fingerprint dive, newest first:
    start = base + entry.profile_start
    end   = base + entry.profile_end  (TM: cursor_end)
    if profile still present:
        size = ring_distance(start, end)          # dive samples
        tail = ring_distance(end, cursor_end)     # surface events after the dive
        read the size + tail bytes ending at cursor_end from the profile ring
        cursor_end = start
    blob = entry bytes ++ first `size` profile bytes   (the tail is dropped)
    emit blob, fingerprint = entry bytes at the fingerprint offset

The flash models erase ahead of the write head. When counting capacity, the reference also subtracts the gap between the newest dive’s end pointer and (write_head rounded down to 4096) + 0x2000. On the TM, which uses SRAM, it subtracts the gap up to the write head itself.

ring_distance(a, b) = (b − a) mod (profile_end − profile_begin), with a == b giving 0. Pointers outside the profile ring make a profile invalid; emit the logbook entry only.

Commander TM only: battery-backed SRAM can scramble when power is lost. Skip an entry whose start pointer is outside the ring, or whose dive number mod 100 differs from its ring index.

A dive whose end pointer is FFFFFFFF was not closed properly. Take the end as the next newer dive’s start pointer, or the write head for the newest dive.

Incremental download: stop at the entry whose fingerprint bytes equal the stored fingerprint. Fingerprints: TM and Commander I use the 4-byte dive timestamp; Commander II and EMC use the 6-byte date/time.

Confidence: likely (single source).

Dive data format

The dive blob is the logbook entry (header) followed by the profile bytes.

Offsets in bytes into the logbook entry; “–” = not present.

FieldType / raw unitTMCmdr ICmdr IIEMC
start date/timesee Date and time15800
water conductivityu8, bits 0–1–242424
start depthu16le; ¼ ft (Cmdr), 1/256 ft (EMC)–545642
start temperatureu8, °F83434555
dive numberu16le20687086
altitudeu8, 250 ft steps–737389
sample intervalu8, s72(1 s fixed)(1 s fixed)(1 s fixed)
end temperatureu8, °F–153153293
dive timeu16le, min; FFFF = n/a57166166304
max depthu16le, ¼ ft; FFFF = n/a49168168306
average depthu16le, ¼ ft; FFFF = n/a51170170310
O₂ of mix 1, 2 (EMC: 1–3)u16le each, percent × 25674210210144
He of mix 1–3u16le each, percent × 256–––164
minimum temperatureu8; °F = raw/2 + 20; FF = n/a82232232403
maximum temperatureu8; °F = raw/2 + 20; FF = n/a–233233407

Conversions:

  • feet → m: × 0.3048. °F → °C: (F − 32) / 1.8.
  • Gas: fraction = raw / 256 / 100. Example: 00 20 (u16le 0x2000 = 8192) → 32.0 %.
  • Water: conductivity bits 0–1 equal to 0 mean fresh water; any other value means salt. libdivecomputer assumes density = 1000 + 12.5 × value kg/m³ (value 2 → 1025). This is an assumption, not a documented mapping.
  • Altitude → surface pressure: h = raw × 250 ft × 0.3048; P bar = 1.01325 × (1 − 2.25577×10⁻⁵ × h)^5.25588 (standard atmosphere). Raw 4 → 0.9772 bar.

Samples: Commander TM

The first 2 profile bytes give initial values: temperature in ½ °F and depth in ½ ft. Then each byte is one of:

Byte patternMeaning
0xxxxxxxdepth sample: bit 6 = direction (1 = shallower), bits 0–5 = change in ½ ft. The clock advances by the header interval
100xxxxxtemperature change: bit 4 = direction (1 = colder), bits 0–3 = change in ½ °F. Time does not advance
1xxxxxxx with bits 5–6 not both 0single-byte event (see the event table). Time does not advance

On the TM, ceiling events AB/AD are one byte long and carry no duration.

Samples: Commander I/II and EMC

The sample period is 1 s. Sample record size: 2 bytes (Commander), 3 bytes (EMC). Before each record, check the first byte. If bit 7 is set, it starts an event (see table) and is not a sample. Skip the event’s length and look again; events do not advance the clock.

ByteMeaning
0depth change: bit 6 = direction (1 = shallower), bits 0–5 = change in ¼ ft. Depth = start depth (header) + running sum / 4 ft
1even seconds (0, 2, 4, …): ascent rate, bit 7 = sign (set = positive), bits 0–6 in ¼ ft units; odd seconds: temperature, °F = raw/2 + 20
2 (EMC only)24-second cycle; see below

EMC byte 2, by the sample’s position in a 24-sample cycle (sample index mod 24):

PositionContent
0–19tissue loading values (not decoded)
20 (low), 21 (high)value + 1 = minutes: the no-deco limit when not in deco, otherwise the time at the deepest stop
22 (low), 23 (high)value + 1 = minutes: total deco time (meaningful only in deco)

“In deco” runs from event C5 until event D8. The initial values come from the header: start depth, start temperature, mix 1.

Events

Event codes have bit 7 set. Each code below is 1 byte long, except where a length is given.

CodeMeaning
A8entered post-dive surface mode (start of surface interval)
A9left post-dive surface mode
ABceiling 10 ft deeper. 5 bytes: code, u16le first-stop minutes, u16le total stop minutes (Commander/EMC)
ADceiling 10 ft shallower. 5 bytes, same layout as AB
B5less than 5 minutes of air left (deco)
BDback to normal ppO₂ setting
BEceiling deeper than 60 ft
C0switched to 21 % FO₂ mode (seen on surfacing)
C1ascent rate above limit, start
C2low battery
C3CNS oxygen toxicity warning
C4depth beyond user limit
C5decompression obligation begins
C7entered gauge mode (lock-out)
C8ppO₂ too high
CClow cylinder 1 pressure
CDswitched to deco blend (treated as mix 2)
CEno-deco limit warning, start
CFoxygen toxicity, start
D0breathing rate alarm, start
D3low gas 1 flow rate
D6depth above ceiling, start
D8decompression obligation ends
E1ascent rate warning, end
E2low SBAT battery
E3switched to FO₂ mode
E5switched to ppO₂ mode
EEno-deco limit warning, end
EFswitched to blend 2 (mix 2)
F0breathing rate alarm, end
F3switched to blend 1 (mix 1)
F6depth above ceiling, end

The meaning of each code is libdivecomputer’s interpretation. An unknown code with bit 7 set is skipped as 1 byte.

Surface (inter-dive) records. After the end of a dive’s samples, the profile ring holds records written on the surface. Their first byte is below 0x80. A normal download cuts the profile at the dive’s end pointer and never needs to parse them. Their lengths are needed only to cut back an unclosed dive:

First byteLength, CommanderLength, EMC
001719
012123
021820
031719
061921
071921
0819–
0919–
0A1921
0B2121
0C19–
0D19–
0E19–
0F–19
102121

For an unclosed dive (end pointer FFFFFFFF), the reference:

  1. walks back from the guessed end over records that match this table, taking the longest consistent match;
  2. while parsing, stops at a byte FF (erased memory) or A8, or at E3/F3 after the first 2 seconds (these appear at the start of the next dive).

The summary fields are unreliable for such dives.

Date and time

ModelEncoding
TM, Commander Iu32le seconds since 1992-01-01 00:00
Commander II6 bytes: minute, second, day, hour, year (2 digits), month
EMC6 bytes: second, minute, hour, day, month, year (2 digits)

Byte fields are binary, not BCD. Two-digit year: > 91 → 1900 + yy, else 2000 + yy. No time zone is stored.

For the seconds count, the reference adds 694242000 to get a Unix time. That is 1992-01-01 05:00 UTC, which is midnight US Eastern Standard Time. It then converts the result with the host’s local time zone. Whether the device’s epoch is local midnight (most likely) or Eastern time is not established.

Confidence: likely for the sample and header structure; uncertain for event meanings, the EMC tissue/NDL cycle, the conductivity → density mapping and the TM epoch.

Model-specific variations

  • The TM has a 90-byte logbook entry, 1-byte samples, a variable sample interval, no surface records, and no high-speed transfer.
  • Commander I and II differ in date encoding (tick count vs fields), fingerprint position, and logbook offsets shifted by 2 bytes.
  • The EMC-14/16/20H differ only in logbook and profile sizes; their dive format is the same.

Open questions

  1. TM write-head encoding: u16be or word-big-endian u32 at config 0x158?
  2. Why pointers in Commander logbook entries are read as u32le when config words are word-big-endian. This needs device data to confirm.
  3. The exact high baud rate of the EMC: the reference uses 850000; a figure of about 850400 has also been mentioned. USB-serial adapters must support non-standard rates.
  4. Meanings of the surface-record types and of the TM’s interpretation of events.
  5. Time zone of the 1992 epoch.
  6. Cochran’s PC software stores downloaded logs in its own file formats, which are reported to be obfuscated. Those formats are outside this specification. The serial protocol itself shows no encryption.

References

  • libdivecomputer (LGPL-2.1), https://www.libdivecomputer.org/, used as a factual reference; no code copied.
  • U.S. Standard Atmosphere 1976 (barometric formula used for the altitude conversion).