Skip to content

Protocol notes

Observations, ambiguities and decisions that go beyond the wiki text ("Livox LiDAR Communication Protocol – Mid360", rev v1.4.12, 2026-09-21). Hardware results are from a Mid-360 with firmware 13.18.0244, the minimum supported version (#11). Items still marked [unverified] have not been checked on hardware.

Data packet header, bytes 12–23

The table defines offset 12, size 12 as reserved. The accompanying diagram, and the v1.4.3 changelog ("Add tag_type to the point cloud frame header"), show a pack_info field before reserved. Neither the size of pack_info nor the encoding of tag_type is documented. The library exposes the 12 bytes verbatim as DataPacketHeader::reserved and decode_tag() assumes the single documented tag layout. Measured on a Mid-360 with firmware 13.18.0244 (#11): the 12 bytes are 0 in every packet, frame_cnt and time_type are 0, and the point cloud crc32 is 0 (the IMU packets carry a valid one). The documented tag layout fits points with a return, but the reserved bits 6–7 are not always 0: about 20 % of the points without a return carry 0x80 or 0xC0, and about 0.07 % of the returns 0x40 or 0x48. is_noise() does not read them.

Discovery ACK dev_type

The wiki does not list the enumeration for dev_type. A Mid-360 with firmware 13.18.0244 reports 9 and cmd_port 56100 (2026-10-04, #110). The library keeps the raw uint8_t and maps it with DeviceType: 9 is kMid360, every other value kUnknown (#58).

Discovery ACK destination

A Mid-360 (firmware 13.18.0244) sends the 0x0000 ACK to 255.255.255.255, at the source port of the request, for a broadcast request and for a unicast one alike; the other ACKs (0x0101 checked) go unicast to the sender. A socket bound to a unicast address never receives the discovery ACK, so discover() with a bind_address also listens on 255.255.255.255:<its port> (#217). That bind is refused on BSD / macOS, where only a bind_address of 0.0.0.0 receives the ACK.

Unaligned fields

0x0101 ACK has key_num at offset 1 and the key-value list at offset 3, so most 16/32-bit fields are misaligned. All parsing uses memcpy-based reads; never cast the buffer to a struct.

Point cloud CRC coverage

crc32 at offset 24 covers timestamp (offset 28, 8 bytes) followed by data. These are contiguous on the wire, so the CRC is computed over packet[28 : 28 + 8 + data_len].

A Mid-360 with firmware 13.18.0244 leaves crc32 at 0 in every point cloud packet (data type 1 checked), while its IMU packets carry the CRC. A crc32 of 0 is therefore not checked (#219); a real CRC of 0 goes unchecked with probability 2^-32.

Per-point timestamps

t_i = timestamp + i * time_interval * 100 ns / (dot_num - 1). Integer division is used (truncation, sub-nanosecond). With 96 points and the typical ~103.5 µs interval this is a ~1.09 µs point spacing.

Command frame CRC32 with empty data

The spec says CRC32 "needs to be padded with 0" when the data length is 0. The library writes 0 in that case and requires 0 when parsing. (CRC-32 of an empty buffer is also 0, so an implementation that computes it anyway is compatible.)

Sequence numbers

seq_num is a free-running 32-bit counter per host; ACKs echo it. Wrap-around is not special. The LiDAR-originated 0x0102 push is a REQ with sender_type = 1 and, per the sequence diagram, is not acknowledged by the host. The wiki does not enumerate the keys it carries. A Mid-360 (firmware 13.18.0244, #235) pushes the writable keys 0x0000, 0x0001, 0x0004–0x0007, 0x0012, 0x0015–0x0019, 0x001A, 0x001C followed by 0x8000–0x800C, 0x800E, 0x8010, 0x8011 (not 0x0009 nor the keys from 0x0021 on), once per second on a fixed phase plus once, within about 20 ms, after every work-state change and every 0x0100 request whatever its result (not after 0x0101). Its seq_num advances by about 26 per second, so gaps in it do not mean lost pushes. The SDK merges every status key (0x8006–0x8011) into Device::pushed_status(), tolerating any missing key. Key 0x800E lidar_diag_status is read as four 2-bit-wide nibbles (system, scan, ranging, communication; 0 normal, 1 warning, 2 error, 3 safety error). Only 0 has been seen on hardware, so the decoding is still open (#111). Every push of a Mid-360 on 13.18.0244 carries every supported settings and status key (#11); the SDK carries the last value over anyway.

Working state

The protocol wiki (section 1.2.1.2.2) shows the LiDAR state machine as a figure (Mid360_state_machine_english.png) next to the enumeration table. The figure, redrawn:

stateDiagram-v2
    direction LR
    [*] --> SELFCHECK : power on
    SELFCHECK --> work : self-check succeeded
    SELFCHECK --> UPGRADE : need to upgrade
    UPGRADE --> SELFCHECK : update succeeded
    work --> UPGRADE : upgrade request
    work --> ERROR : abnormal
    ERROR --> work : abnormal disappearance
    ERROR --> UPGRADE : upgrade request
    UPGRADE --> ERROR : exception during upgrade

    state work {
        direction LR
        [*] --> IDLE : enter idle
        IDLE --> MOTORSTARTUP : target is 1 or 9
        MOTORSTARTUP --> READY : scan module startup completed
        READY --> SAMPLING : target is 1
        SAMPLING --> READY : target is 2 or 9
        READY --> IDLE : target is 2
        READY --> MOTORSTARTUP : scan mode changed
        SAMPLING --> MOTORSTARTUP : scan mode changed
    }
cur_work_state Value Requestable via work_tgt_mode Meaning (figure)
SAMPLING 1 yes scan module and laser on, point cloud and IMU streaming
IDLE 2 yes laser off (scan module off)
ERROR 4 no laser off, error reported (HMS)
SELFCHECK 5 no software / hardware self-check, firmware check
MOTORSTARTUP 6 no scan module warm-up (if required) and start
UPGRADE 8 via the upgrade entry only firmware update
READY 9 yes scan module on, laser off

Consequences for the SDK:

  • IDLE → SAMPLING passes through MOTORSTARTUP and READY; SAMPLING → IDLE passes through READY; READY ↔ SAMPLING is direct. wait_for_state() polls through the intermediate states, so start_sampling() from IDLE takes at least the motor start-up time. Measured on a Mid-360 with firmware 13.18.0244 by polling 0x8006 every 50 ms (#221): MOTORSTARTUP lasts 6.1 s from a stopped motor and 10.1 s when SAMPLING is requested 0.3 s after a stop; SAMPLING → IDLE shows READY for about 60 ms.
  • work_tgt_mode is a stored parameter that the machine chases; decode_work_state() accepts the seven values above and rejects everything else. 0x07 (kLivoxLidarMotorStoping in the Livox-SDK2 enum, which is shared with the HAP) is not in the Mid-360 table and is rejected too. Key 0x0020 (work mode after boot) exists for the HAP only (Livox-SDK2 changelog 1.2.5) and is not modelled.
  • After a reboot request the LiDAR keeps running (and answering) for about 1.25 s, sends pushes reporting ERROR, then is silent; on firmware 13.18.0244 the first push came 8.9 s after the ACK and reported MOTORSTARTUP (SELFCHECK and IDLE were never pushed), READY followed at 13.5 s and then the work_tgt_mode target (#236). udp_cnt, the timestamp and the debug raw data stream do not survive. The wiki marks work_tgt_mode as not persisted (default SAMPLING), but firmware 13.18.0244 keeps it: a LiDAR set to IDLE came back IDLE, one set to SAMPLING came back sampling (#12). The other written keys (pcl_data_type, install_attitude, FOV 0, fov_en, detect_mode, imu_data_en and the host ip / dst port of 0x0005–0x0007) persist too; the src_port of 0x0005–0x0007 reads back as 0, while the LiDAR keeps sending from its fixed ports (56200 / 56300 / 56400).

Settled by the figure: the states, the edges and which targets are requestable. Still unverified (#11) and therefore assumptions in the simulator: the duration of SELFCHECK and whether commands are answered during it; whether the pass-through READY is visible in the push (it is in a 0x0101 poll, see above); the return code for a work_tgt_mode write of 8 (assumed 0x03) and for any write in ERROR / UPGRADE (assumed 0x02).

Measured on firmware 13.18.0244 (#11): - work_tgt_mode 0, 3, 4, 5, 6, 7 and 10 answer 0x03 with error_key 0x001A. - A write during MOTORSTARTUP answers 0x00 and is followed once the start-up ends. - 0x07 is never reported, and SELFCHECK is not seen in the push. - pattern_mode 1 and 2 are accepted (0x03 for 3); a changed value restarts the motor ("scan mode changed" edge): MOTORSTARTUP for 1.0 s, READY, SAMPLING. The same value does not. The simulator models this.

Return code 0x21 (PARAM_REBOOT_EFFECT)

Treated as success-with-note by callers: the parameter was stored but needs a reboot (lidar_ipcfg is the obvious case; Device::set<K>() reports it as SetResult::reboot_required). On firmware 13.18.0244 no key answered 0x21 (#11): writing the current value answers 0x00 for all 14 supported writable keys, and a changed value answers 0x00 and reads back at once for 0x0000, 0x0001, 0x0005, 0x0012, 0x0015, 0x0017, 0x0018, 0x0019 and 0x001C. [unverified] whether a changed lidar_ipcfg answers 0x21, which needs a reboot to check (#12); the simulator answers 0x21 only for that case.

FOV keys 0x0015 / 0x0016 / 0x0017

fov_cfg0 / fov_cfg1 are int32 yaw start / stop in [0, 360] and pitch start / stop in [-10, 60], all in degrees and both ends included, plus a reserved uint32; fov_cfg_en is a bit mask (bit 0 / bit 1). Measured on a Mid-360 (#11): a value outside the ranges or a reversed window (start > stop) answers 0x03 with the key as error_key, so there is no wrap-around; an equal yaw start / stop is accepted and crops every point. Yaw is the azimuth atan2(y, x), counter-clockwise from +x. Both windows combine as a union. A change answers 0x00 and applies from the next packet, without a reboot or a motor restart. The library checks the same in fov_in_range() (Device::set_fov(), HostSetup::fov). See #11 and #39.

Debug raw data collection (0x0303)

Command 0x0303 ("debug raw data collection configuration", protocol document rev v1.4.12; "debug point cloud" in Livox-SDK2) switches on a diagnostic stream that Livox support asks for (#93). The request is enable (u8), host_ip (u8[4]), host_port (u16) and two reserved bytes; the ACK is a ret_code. The SDK treats the stream as opaque bytes.

Measured on a Mid-360, firmware 13.18.0244 (#106), host sockets only (no pcap):

  • 0x0303 is accepted on the log port 56500. The command port 56100 does not answer it.
  • The stream leaves port 60301 (kDebugDataPort) towards host_ip:host_port of the request. SDK2 listens on host port 44332 (kDefaultHostDebugDataPort). Every datagram was 1114 bytes, about 4000 per second (about 4.5 MB/s, 36 Mbit/s). The datagrams start with 0xA5, 0x07 and a u16 equal to the datagram size. The rest of the layout is unknown.
  • The stream flows only while the LiDAR is SAMPLING. An enable in IDLE is ACKed with 0x00 and sends nothing until sampling starts (#225).
  • The point cloud (about 2090 packets/s) and IMU (200 packets/s) keep flowing at their usual rate while the stream is on.
  • The ACK is 0x00 in each of these cases:
  • a repeated enable;
  • an enable with another port, which moves the stream;
  • an enable with port 0, after which nothing more arrived;
  • a disable;
  • a disable while disabled.
  • Offset 7 (reserved in the protocol document, bandwidth (Mbps) in SDK2) had no visible effect with 1 or 0xFFFF: the rate stayed the same. DebugDataControlRequest::reserved defaults to 0, like SDK2.
  • The stream did not stop on its own within 30 s.

The layout of the file SDK2 writes (.LivoxDebugPointCloudData) was compared byte for byte with a real one (#107, debug_data.md).

The setting does not survive a reboot (#106): after 0x0200, the host setup and SAMPLING again without a new 0x0303, no debug datagram arrived in 5 s. The Device's reconnect replay re-enables it when it was requested.

HMS table

The wiki lists 0x0210–0x0219 twice (error: "trying to recover"; fatal: "abnormal"). The level byte in the code distinguishes them; the library carries one description for the range.

Codes seen on hardware (#111, firmware 13.18.0244). All were warning level; lidar_diag_status (0x800E) stayed zero and cur_work_state stayed SAMPLING with up to four of them active.

Cause Raw code Appears Clears
Window fully or partly covered 0x01040002 within about 6 s within 3.5 s of uncovering
No GPS / PPS connected 0x04070002 10 s to about 2 min after power-up or sampling sometimes by itself, otherwise at a power cycle
ptp4l at PTP v2.1 (linuxptp's default) 0x04030002 about 1 s after ptp4l started not by itself (90 min seen); at a power cycle
PTP master stopped after a lock 0x04020002 within seconds 1 s after the master came back
same 0x04050002 in the same push as 0x04020002 not by itself (88 min seen); at a power cycle
PTP master back after a loss 0x04060002 right after the master came back in the next push
  • A healthy push carries key 0x8011 with eight zero slots; the key is never omitted.
  • The raw slot bytes are level, reserved (0), id low, id high, e.g. 02 00 04 01 for 0x01040002, as decode_hms() assumes.
  • A new code takes the first free slot, and one cause can fill several slots in the same push. Whether the LiDAR moves the remaining codes up when an earlier one clears was not observed.
  • Strong light on the window and an unreachable point cloud host (key 0x0006) gave no code.
  • Not provoked: the 0x0210–0x0219 range, an error-level code and a temperature code.

Variants

v1 targets the base Mid-360. speed_mode (0x0021) and pc_freq_mod (0x0029) exist in the key table but are not given typed helpers. Spherical output (data type 3) is modelled because the base model supports it: set_point_format(), the frame assembler, the lvx2 writer and the simulator all handle it.

Multicast is not implemented and is not a v1 goal. The host IP keys (0x0005–0x0007) accept any address, so a multicast group can be written to them with set<Key>(), but the library does not join the group: SocketOptions::multicast_group is reserved and rejected with kInvalidArgument (transport.md), and the simulator has no multicast mode.