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

Pelagic i330R protocol (Aqualung i330R, Apeks DSX)

The newest Pelagic generation, the Aqualung i330R (wrist and console) and the Apeks DSX, has a Bluetooth LE interface and stores dives in a large serial flash. The host pairs once with a 6-digit PIN shown on the device and receives a 16-byte access code. It presents that code at the start of every later session. Communication uses small packets with a start byte, a command byte, an 8-bit CRC and a length. Memory is read by absolute flash address and length. Ring-buffer pointers come from a “flash map” record instead of a pointer page. The logbook/profile model and the dive record layout follow the rest of the Pelagic family; see pelagic-common.md.

Devices

VendorModelModel codeTransportsNotes
ApeksDSX4741 (“GA”)BLElayout L-DSX, multi-gas, CCR mode
Aqualungi330R4744 (“GD”)BLElayout L-I330R
Aqualungi330R Console474D (“GM”)BLElayout L-I330R

Identification: the advertised BLE name starts with the two model-code letters, followed by digits (see BLE identification). After the wake-up command, the device reports its model code directly.

Confidence: likely.

Transport parameters

BLE only. See ../transports/ble.md.

ItemValue
Serviceca7b0001-f785-4c38-b599-c7c5fbadb034
Notify characteristic (device → host)ca7b0002-f785-4c38-b599-c7c5fbadb034
Write characteristic (host → device)ca7b0003-f785-4c38-b599-c7c5fbadb034
Write typewrite with response
Response timeout3000 ms

One packet can carry up to 255 payload bytes plus a 5-byte header. One implementation expects every packet to arrive in a single notification. It therefore needs an ATT MTU of at least 5 + payload + 3. Another implementation requests an MTU of 263 in one code path. Devices seem to send data packets with at most 96 payload bytes (101-byte notifications).

Confidence: uncertain for UUIDs (single source; the notify/write UUIDs are given only as a shared prefix with the service), MTU and packet sizes; likely for the timeout.

Framing and integrity

Packet

Both directions use the same packet layout:

ByteContent
0CD start byte
1Flags (see below)
2Command code. A device packet echoes the command it answers
3CRC-8 over the whole packet, computed with this byte set to 00
4Payload length n (0..255)
5..5+n−1Payload

Flags:

ValueDirectionMeaning
40H→DRequest (command phase)
80H→DData phase: carries a parameter block such as an access code or PIN
00H→DFlash read request
any value with (flags AND C0) ≠ C0D→HData packet; append the payload to the response
C0 (bits 7 and 6 both set)D→HFinal status packet; payload byte 0 is the response code. It carries no response data

Response codes in the final status packet:

CodeMeaning
1Ready: the device expects the data phase or the next step
2Done: the command completed
13Access code invalid

A response is: zero or more data packets, followed by exactly one final status packet. The host MUST check, for each received packet, that byte 0 is CD, byte 2 equals the command sent, the length fits the received bytes, and the CRC matches. The total data length must equal the length the command implies.

CRC-8

ParameterValue
Width8
Polynomial0x12 (x⁸ + x⁴ + x), non-reflected
Init0x00
RefIn / RefOutfalse / false
XorOut0x00
Check (“123456789”)0xEA
Coverageall packet bytes, with byte 3 set to 00

This polynomial is not in the RevEng catalogue. See ../common/checksums.md#crc-8-msb-0x12. A byte-wise form that gives the same result: x = crc XOR byte; t = x XOR (x >> 4) XOR (x >> 7); crc = ((t << 4) XOR (t << 1)) AND 0xFF.

Data CRC-16

The hardware-calibration and flash-map records (256 bytes each) end with a 16-bit CRC over the first 254 bytes, stored big-endian in the last two bytes: CRC-16/IBM-3740 (poly 0x1021, init 0xFFFF, no reflection, xorout 0x0000, check 0x29B1). Example: 254 zero bytes give 0x592D, so the record would end with 59 2D. Flash reads (0D) carry no extra CRC beyond the per-packet CRC-8.

Worked frames

All CRCs were computed with the CRC-8 above:

H→D  CD 40 FA F6 09 00 00 00 00 00 00 00 00 00        access request, command phase
H→D  CD 80 FA 92 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                                                       access request, data phase (all-zero code)
H→D  CD 40 FB 8E 09 00 00 00 00 00 00 00 00 00        PIN request, command phase
H→D  CD 80 FB F4 06 01 02 03 04 05 06                 PIN "123456", data phase
H→D  CD 40 22 4A 09 00 00 00 00 0C 00 00 00 00        wake-up, read/write
H→D  CD 40 21 C2 09 00 00 00 00 0C 00 00 00 00        wake-up, read-only
H→D  CD 40 97 12 09 37 30 31 55 00 00 00 00 00        authentication, i330R
H→D  CD 40 97 6E 09 FF FF FF FF 00 00 00 00 00        authentication, DSX
H→D  CD 40 27 32 09 00 00 00 00 00 01 00 00 00        read hardware calibration
H→D  CD 40 2F C2 09 00 00 00 00 00 00 00 00 00        read flash map
H→D  CD 00 0D F0 09 00 20 10 00 40 00 00 00 00        read 0x40 bytes at 0x00102000
D→H  CD C0 FA 94 02 01 00                              final status "ready" (illustrative)

Another implementation independently lists the CRC bytes F6 (access request), 4A (wake-up), 12 (authentication) and C2 (flash map) for the same packets.

Confidence: likely.

Commands

CommandCodeFlagsH→D payloadD→H dataFinal code
Access requestFA409 × 00none1
Access codeFA8016-byte access codenone2 (13 = invalid)
PIN requestFB409 × 00none1
PINFB806 bytes: PIN digits as values 0..9, right-aligned, zero-padded on the left16-byte access code2
Wake-up, read-only214000 00 00 00 0C 00 00 00 0016-byte identity2
Wake-up, read/write224000 00 00 00 0C 00 00 00 0016-byte identity2
Authentication9740i330R: 37 30 31 55 00 00 00 00 00; DSX: FF FF FF FF 00 00 00 00 00none1
Read A/D25not used
Read hardware calibration274000 00 00 00 00 01 00 00 00256 bytes incl. CRC-162
Read general settings29not used
Read flash map2F409 × 00256 bytes incl. CRC-162
Read device record31not used
Read flash0D00u32le address, u32le length, 00length bytes2

The codes 25, 29 and 31 are known names only. Their parameters have not been documented.

Identity record (16 bytes, reply to 21/22): bytes 12..13 = model code, u16be.

Hardware-calibration record: bytes 12, 13, 14 are bcd8. Serial number = bcd(b14) × 10000 + bcd(b13) × 100 + bcd(b12).

Variant: another implementation derives the serial number from bytes 12..14 of the 16-byte access code, with the same formula. It does not send command 27.

Confidence: likely for the command bytes and payloads; uncertain for the serial source.

Session

code = stored access code for this device, or 16 zero bytes
attempts = 0
loop:
    send FA/40 (9 zero bytes)          expect final code 1
    send FA/80 (code)                  expect final code 2
    if final code was 2 and code is not all zero: break
    if final code was 13 or code is all zero:
        attempts += 1; if attempts > 3: fail "no access"
        ask the user for the 6-digit PIN shown on the device
        send FB/40 (9 zero bytes)      expect final code 1
        send FB/80 (PIN digits)        receive 16-byte code, expect final code 2
        store code for this device
        continue loop
send 22/40 (wake-up, read/write)       receive 16-byte identity → model code
send 97/40 (authentication; payload by model code)   expect final code 1
send 27/40                             receive hardware calibration, verify CRC-16 → serial
send 2F/40                             receive flash map, verify CRC-16 → pointers
download (below)

The access code persists across sessions. A host SHOULD store it per device (for example keyed by BLE address or name). The user then enters the PIN only once.

No quit command is defined. The host disconnects.

Variants in another implementation:

  • Without a stored code, it first sends FA/80 with an empty payload. It always runs the PIN flow, then sends FA/80 with the new code.
  • It ends the session with the atom2-style wrapped frame CD 40 <seq> 02 A8 99. The effect on these devices is unknown.

Confidence: likely.

Memory layout

Layouts L-I330R and L-DSX in pelagic-common.md:

i330R / i330R ConsoleDSX
Flash size0x4000000x2000000
Logbook ring0x102000..0x1060000x800000..0x880000
Logbook entry64 bytes512 bytes
Logbook read directionforwardsbackwards
Profile ring0x10A000..0x4000000x1000000..0x2000000
Profile pointers in entryform E4: u32le at +8 (first), u32le at +12 (end, exclusive)same

Flash map

The 256-byte flash map returned by 2F holds the ring descriptors as u32le values:

OffsetMeaning
0x50Logbook ring lowest address
0x54Logbook ring highest address (inclusive)
0x58Logbook first entry
0x5CLogbook last entry
0x70Profile ring lowest address
0x74Profile ring highest address (inclusive)
0x78Profile first byte
0x7CProfile last byte

Rules:

  • If the lowest and highest addresses are both non-zero, the ring end is highest + 1.
  • A host SHOULD check that the ring bounds equal the layout values above, and treat a mismatch as an unknown layout.
  • The logbook span for the download:
    • DSX: [first, last).
    • i330R: [lowest, last + 1). The whole range from the ring start is read.

Variant: another implementation decodes the logbook pointers the same way. It does not mention the profile descriptors.

Confidence: likely.

Download procedure

Follow the common procedure, with these differences:

  • Reads use command 0D with an absolute address and length. Requests may be large (one implementation reads up to 4096 bytes per request). Read the logbook and profile spans in a few large blocks.
  • If a read fails with a protocol error or timeout, wait 1000 ms, discard pending notifications and retry. One implementation retries up to 3 times. Reads are idempotent.
  • For the i330R the logbook is read forwards from the span start. The entry read first is treated as the newest (see the open questions).
  • The profile size check against the remaining ring capacity is applied as for the other layouts. One source skips it for these models.

Confidence: likely.

Dive data format

A dive record is [logbook entry (L bytes)][profile] with L = 64 (i330R) or 512 (DSX). Sizes:

i330RDSX
Logbook entry L64512
Profile header80256
Samples start (Hdr)144768
Footer4864
Sample size1632
Fieldi330RDSXType, unitConversion
Dive modeb2b45u8see below
Sample intervalb(L + 0x24)b(L + 0x24)u8, seconds
Gas O2b(L + 0x10 + i), i = 0..2b(L + 0x89 + 16·mode + i), i = 0..5u8, %0 → 21 %. i330R: 20 also means air (→ 21 %); 21 is 21 % nitrox
Gas He-see variantsu8, %
Settings wordu32le at L + 0x0C-bit fieldbit 16 set = fresh water, clear = salt water
GF low / GF high-b(L + 0x70), b(L + 0x71)u8, %Bühlmann gradient factors
Dive timefrom samplesu16le at footer + 8seconds
Max depthu16le at footer + 10same1/10 ftm = v / 10 × 0.3048
Average depthu16le at footer + 12same1/10 ft
Min temperature-u16le at footer + 161/10 °F°C = (v/10 − 32) × 5/9
Max temperature-u16le at footer + 181/10 °F

Dive modes:

  • i330R: 0 = normal (open circuit), 1 = gauge, 2 = freedive, as in the atom2 protocol.
  • DSX: 0 = closed circuit (CCR), 1 = open circuit, 2 = sidemount (open circuit), 3 = sidemount gauge, 4 = gauge. In modes 3 and 4 no gas mixes are defined. Modes 0..2 each have their own set of 6 mixes, 16 bytes apart.

Variants:

  • DSX helium: mainline places the He bytes at 0xB9 + 16·mode + i, counted from the record start. The Subsurface fork counts from the profile header: L + 0xB9 + 16·mode + i. The fork’s placement matches the O2 table, which is also relative to L. Treat it as the likely correct one.
  • The Subsurface fork does not decode the DSX dive time, min/max temperature, GF, CNS or TTS, and reads the DSX ppO2 from s9 (1/100 bar) like the i330R. Mainline does as tabled below.
  • Water flag polarity: another implementation reads bit 16 set as salt water.

Samples

Samples run from Hdr to the footer. Skip samples that are all 00 or all FF. Each sample is one interval after the previous one.

FieldOffsetType, unitModelsConversion
Active gas / tanks0 >> 41-based indexDSXgas switch when it changes; tank number for pressure
Depthu16le@21/10 ftbothm = v / 10 × 0.3048
NDLu16le@4minutesbothused when the stop depth is 0
Deco timeu16le@6minutesbothused when the stop depth is not 0
Stop depths8ftboth0 = no stop
ppO2s91/100 bari330R
Temperatureu16le@101/10 °Fboth°C = (v/10 − 32) × 5/9
ppO2u16le@121/100 barDSX
Tank pressureu16le@14psiDSXbar = psi × 0.0689476
CNSs16%DSX
Time to surfaces19minutesDSX

The i330R records no tank pressure.

Date and time

From the logbook entry, all binary, 24-hour clock:

FieldSource
Hourb3
Minuteb4
Dayb5
Monthb6
Year2000 + b7

No seconds, no time zone. Example: xx xx xx 0E 1E 0C 06 18 → 2024-06-12 14:30.

Confidence: likely for fields shared by both sources (date, depth, interval, O2, temperature); uncertain for DSX-only fields (one implementation) and the water flag.

Model-specific variations

  • i330R vs DSX: authentication payload, logbook direction, logbook span rule, entry size, dive record sizes, sample fields.
  • i330R Console behaves like the i330R.

Open questions

  • Exact BLE characteristic UUIDs and the required MTU.
  • Purpose of the authentication command 97 and of its payload (“701U” for i330R). It is not known whether other values are accepted.
  • Whether the serial number is in the hardware-calibration record, the access code, or both.
  • The i330R logbook is read forwards from the ring start up to last + 1. It is not confirmed whether newer entries are at lower addresses or whether the ring simply has not wrapped on known devices.
  • Whether freedive mode on the i330R uses the generic 4-byte freedive samples of the atom2 format.
  • The parameters of commands 25, 29 and 31.
  • Meaning of other response codes besides 1, 2 and 13.

References