Serial Binary Protocol
RS-232, TTL, RS-485, and USB virtual COM ports all use the same HiPNUC binary framing.
HI91 is the default frame; switch to HI83 when needed:
- HI91: fixed 82-byte frame carrying acceleration, angular rate, magnetic field, air pressure, temperature, timestamp, Euler angles, and quaternion, in
Ganddeg/s. - HI83: bitmap-configurable variable-length frame that trims unused fields to save bandwidth and adds microsecond timestamps, UTC, inclination, and MRU fields, in
m/s²andrad/s(matching ROSsensor_msgs/Imu).
Frame Format & CRC
| Field | Value / Range | Bytes | Description |
|---|---|---|---|
| SOF | 5A A5 | 2 | Start-of-frame sync bytes |
| LEN | 1–512 | 2 | Payload byte count (little-endian), excluding SOF, LEN, and CRC |
| CRC | — | 2 | 16-bit checksum (little-endian) |
| Payload | — | 1–512 | Byte 0 is the frame tag (0x91 = HI91, 0x83 = HI83) |
All multi-byte values are little-endian and floats are IEEE-754 single-precision (float). Maximum frame size is 518 bytes. Skip unknown tag values using LEN.
CRC uses CRC-16/XMODEM (polynomial 0x1021, initial value 0x0000 — not CCITT-FALSE with 0xFFFF), computed over SOF, LEN, and Payload (excluding the CRC field itself). Self-check: ASCII "123456789" yields 0x31C3.
HI91 Floating-Point Frame
Fixed 76-byte payload, 82 bytes total. All values are factory-calibrated and output in the active output coordinate frame.
| Offset | Field | Type | Bytes | Unit | Description |
|---|---|---|---|---|---|
| 0 | tag | u8 | 1 | — | Fixed 0x91 |
| 1 | main_status | u16 | 2 | — | Main status word; see "MAIN_STATUS Status Word" below |
| 3 | temperature | i8 | 1 | °C | Module average temperature (integer) |
| 4 | air_pressure | float | 4 | Pa | Barometric pressure |
| 8 | system_time | u32 | 4 | ms | Milliseconds since boot (wraps every 24 h) when unsynced; UTC ms of day when synced |
| 12 | acc_b | float×3 | 12 | G | 3-axis acceleration XYZ (1 G = 9.8 m/s²) |
| 24 | gyr_b | float×3 | 12 | deg/s | 3-axis angular rate XYZ |
| 36 | mag_b | float×3 | 12 | μT | 3-axis magnetic field XYZ |
| 48 | roll | float | 4 | deg | Roll angle, ±180° |
| 52 | pitch | float | 4 | deg | Pitch angle, ±90° |
| 56 | yaw | float | 4 | deg | Yaw angle, ±180° (counter-clockwise positive from above) |
| 60 | quat | float×4 | 16 | — | Quaternion in W, X, Y, Z order |
HI91 Test Vector
Captured 82-byte HI91 frame under the default axes (COORD 0) for verifying custom decoders and CRC:
5A A5 4C 00 18 4A 91 08 14 23 09 A2 C4 47 08 15 1C 00 CC E8 61 BE 9A 35 56 3E 65 EA 72 3F 31 D0 7C BD 75 DD C5 BB 6B D7 24 BC 89 88 FC 40 01 00 6A 41 AB 2A 70 C2 96 D4 50 41 ED 03 43 41 41 F4 F4 C2 CC CA F8 BE 73 6A 19 BE F0 00 1C 3D 8D 37 5C 3F| Field | Raw Bytes (Hex) | Decoded Value | Unit |
|---|---|---|---|
| SOF / LEN / CRC | 5A A5 / 4C 00 / 18 4A | LEN = 76, CRC = 0x4A18 | — |
tag / main_status | 91 / 08 14 | 0x91 / 0x1408 (WB_CONV, MAG_AIDING, SOUT_PULSE set) | — |
temperature / air_pressure | 23 / 09 A2 C4 47 | 35 / 100676 | °C / Pa |
system_time | 08 15 1C 00 | 1840392 | ms |
acc_b (X / Y / Z) | CC E8 61 BE / 9A 35 56 3E / 65 EA 72 3F | −0.2206 / 0.2092 / 0.9489 (norm ≈ 0.996 G) | G |
gyr_b (X / Y / Z) | 31 D0 7C BD / 75 DD C5 BB / 6B D7 24 BC | −0.0617 / −0.0060 / −0.0101 | deg/s |
mag_b (X / Y / Z) | 89 88 FC 40 / 01 00 6A 41 / AB 2A 70 C2 | 7.892 / 14.625 / −60.042 | μT |
roll / pitch / yaw | 96 D4 50 41 / ED 03 43 41 / 41 F4 F4 C2 | 13.052 / 12.188 / −122.477 | deg |
quat (W / X / Y / Z) | CC CA F8 BE / 73 6A 19 BE / F0 00 1C 3D / 8D 37 5C 3F | −0.4859 / −0.1498 / 0.0381 / 0.8602 | — |
HI83 Variable-Length Frame
An HI83 payload starts with an 8-byte fixed header, followed immediately by the selected segments packed from LSB to MSB of data_bitmap (unselected bits occupy zero bytes):
| Offset | Field | Type | Bytes | Description |
|---|---|---|---|---|
| 0 | tag | u8 | 1 | Fixed 0x83 |
| 1 | main_status | u16 | 2 | Main status word |
| 3 | ins_status | u8 | 1 | INS status (ignore on IMU / AHRS) |
| 4 | data_bitmap | u32 | 4 | Bitmask of segments present in this frame |
| 8 | Segments | — | Variable | Packed in data_bitmap bit0 → bit11 order |
Public data_bitmap Bits
Public bits are bit0–11 (mask 0x00000FFF). Set only public bits when configuring. Always advance offsets dynamically from each frame's data_bitmap rather than hardcoding frame size; drop the frame if an undefined bit is set or the accumulated length exceeds LEN.
| Bit | Name | Type | Bytes | Unit | Description |
|---|---|---|---|---|---|
| 0 | acc_b | float×3 | 12 | m/s² | 3-axis acceleration XYZ (differs from HI91 unit) |
| 1 | gyr_b | float×3 | 12 | rad/s | 3-axis angular rate XYZ (differs from HI91 unit) |
| 2 | mag_b | float×3 | 12 | μT | 3-axis magnetic field XYZ |
| 3 | rpy | float×3 | 12 | deg | Euler angles roll / pitch / yaw (yaw ±180°) |
| 4 | quat | float×4 | 16 | — | Quaternion W, X, Y, Z (reorder to X, Y, Z, W for ROS) |
| 5 | system_time_us | u64 | 8 | μs | Monotonic microseconds since boot, unaffected by UTC sync |
| 6 | utc | packed | 8 | — | year-2000(u8), month(u8), day(u8), hour(u8), min(u8), sec*1000+ms(u16), reserved(u8); valid only when UTC_UNSYNC=0 |
| 7 | air_pressure | float | 4 | Pa | Barometric pressure |
| 8 | temperature | float | 4 | °C | Module average temperature (float, finer than HI91 integer) |
| 9 | inclination | float×3 | 12 | deg | X inclination (roll ±180°, 0–360° on single-axis models), Y inclination (pitch ±90°), raw yaw (±180°); inclination is always computed in Right-Front-Up |
| 10 | heave_surge_sway | float×3 | 12 | m | MRU 3-axis periodic displacement: heave / surge / sway (MRU models only) |
| 11 | heave_surge_sway_frq | float×3 | 12 | Hz | MRU 3-axis dominant frequency: heave / surge / sway (MRU models only) |
MRU displacement tracks periodic wave motion (typical 3–20 s period) and requires 5–20 steady cycles to initialize. It does not apply to one-way translation, step displacements, or ultra-low-frequency motion above 30 s period.
Total frame size = 6 (SOF/LEN/CRC) + 8 (fixed header) + sum of selected segments (138 bytes with all bit0–11 enabled). Example layout for data_bitmap = 0x0000003B (74 bytes total):
Decoding Flow & Official SDK
HI91 and HI83 share a single streaming state machine: scan the byte stream for 5A A5, verify LEN is within 1–512, collect 6 + LEN bytes, and check CRC-16/XMODEM. If valid, decode by tag (0x91 / 0x83) and consume the whole frame; if LEN is out of range or CRC fails, discard only 1 byte and resume scanning for the next header.
Official C99 parser source: c/hipnuc/hipnuc_decoder.c (STM32F407, Linux, Python, and ROS drivers are in the same hipnuc/products repository). In custom parsers, copy floats and multi-byte fields by offset with memcpy to avoid unaligned memory faults on MCUs.
MAIN_STATUS Status Word
MAIN_STATUS is a 16-bit status word present in HI91, HI83, CANFD83, and Modbus 0x0009. Bits are independent; a non-zero value is not a fault. Mask with 0x1EF8 before testing status flags to strip the bit0–2 coordinate code and reserved bits.
| Bit | Name | Meaning When = 1 | Action |
|---|---|---|---|
| 0–2 | COORD | Output coordinate frame reference (0 = RFU, 4 = ROS) | Verify active axes via LOG USRCONFIG |
| 3 | WB_CONV | Gyro bias not converged | Hold stationary 3–5 s until cleared |
| 4 | MAG_DIST | 9-axis magnetic disturbance or unverified since boot (always 0 in 6-axis) | Move away from iron/motors and rotate; recalibrate if persistent |
| 5 | ACC_SAT | Accelerometer saturated now or within the last 2 s | Do not trust acceleration or attitude during this interval |
| 6 | GYR_SAT | Gyroscope saturated now or within the last 2 s | Do not trust angular rate or heading during this interval |
| 7 | ATT_CONV | Roll/pitch not converged (excludes yaw) | Stay still after power-up until cleared |
| 8 | Reserved | — | Mask off |
| 9 | STATIC | Module is stationary | Informational |
| 10 | MAG_AIDING | Magnetometer aiding active (9-axis mode) | Informational; still check MAG_DIST for heading trust |
| 11 | UTC_UNSYNC | UTC not synchronized | utc and HI91 system_time are valid UTC only when cleared |
| 12 | SOUT_PULSE | This serial frame corresponds to an SOUT pulse | HI91/HI83 only; always 0 in Modbus/CANFD83/I2C |
| 13–15 | Reserved | — | Mask off |
Timestamps & Dropped-Frame Detection
| Field | Location | Meaning |
|---|---|---|
system_time_us | HI83 (bit5) / CANFD83 | Monotonic microseconds since boot; unaffected by UTC sync; best for relative timing and drop detection |
system_time | HI91 | Milliseconds since boot (0–86,399,999 wrap) when UTC_UNSYNC=1; UTC+0 ms of day (no date or timezone) when UTC_UNSYNC=0 |
utc | HI83 (bit6) / CANFD83 | Valid only when UTC_UNSYNC=0; see PPS Time Sync |
Frames do not carry a sequence counter. In periodic mode (ONTIME), detect drops from consecutive timestamp deltas: at 10 ms (100 Hz), a 20 ms gap means 1 dropped frame and 30 ms means 2 dropped frames. Use system_time_us / 1000 on HI83; on HI91 handle 24-hour wrap with (t2 - t1 + 86400000) % 86400000 (UTC-synced HI91 deltas have small jitter, so round to the nearest multiple of the period). Reset your baseline after boot, period changes, or UTC_UNSYNC transitions.
Baud Rate & Frame Rate Limits
Output periods use integer milliseconds, so serial rates are 1000 / N Hz (e.g. 500 Hz = 2 ms, 200 Hz = 5 ms; exact 400 Hz is not possible). The table shows recommended / maximum frame rates (Hz) for 8N1, with 20% headroom on recommended values:
| Frame Type | Bytes | 9600 | 115200 | 230400 | 460800 | 921600 |
|---|---|---|---|---|---|---|
| HI91 | 82 | 9.35 / 11.6 | 111 / 125 | 200 / 250 | 333 / 500 | 500 / 1000 |
| HI83 (bit0–7) | 98 | 7.81 / 9.71 | 90.9 / 111 | 167 / 200 | 333 / 333 | 500 / 500 |
| HI83 (bit0–11) | 138 | 5.56 / 6.94 | 66.7 / 83.3 | 125 / 167 | 250 / 333 | 500 / 500 |
When multiple periodic frames are enabled on the same port, sum their byte rates. To change baud rate or period, see ASCII Commands.
WARNING
An OK response does not guarantee the serial link has enough bandwidth. Exceeding the limits above causes the module to drop whole frames, visible as lower frame rate or multiple-period timestamp jumps. Raise the baud rate before raising the frame rate.
