CAN Protocol
Use J1939 for all new projects (CAN FD models can also enable CANFD83). CANopen is a custom-firmware feature; contact HiPNUC if required, and see "CANopen (Custom Firmware)" at the end of this chapter.
Bus Parameters & Wiring
| Item | J1939 | CANFD83 (CAN FD models only) |
|---|---|---|
| Factory bit rate | Nominal 500 kbit/s | Nominal 500 kbit/s, data phase 4 Mbit/s |
| Node address SA | 8 (range 1–127, avoid host address 0x55) | Same |
| Frame format | 29-bit extended, 8 bytes | FD + BRS extended, up to 64 bytes |
| Data format | Fixed-point integers (G, deg/s) | float32 (m/s², rad/s) |
- Termination & ACK: place 120 Ω resistors at both ends of the bus and ensure at least one node sends ACK (without ACK, the transmitter retries and stops).
- Bus load: one classic 8-byte extended frame is ~131 bits (~13 kbit/s at 100 Hz); the 4 default PGNs use ~52 kbit/s (~10% of a 500 kbit/s bus). Scale linearly with node count.
- Multiple nodes: all modules ship with node address
8. Connect one at a time to assign unique addresses and reboot before joining the shared bus.
J1939 Data Protocol
CAN_ID = (P << 26) | (R << 25) | (DP << 24) | (PF << 16) | (PS << 8) | SAAll data PGNs use priority P = 3 and broadcast format PF = 0xFF, giving CAN ID = 0x0CFF[PS][SA] (e.g. 0xFF41 from node 8 is 0x0CFF4108).
WARNING
J1939 payloads are little-endian (opposite to Modbus big-endian): a 32-bit value 0x12345678 is sent as 78 56 34 12.
PGN List & Field Definitions
Periods are in ms (1–32767, 0 = off). Unlisted bytes are reserved and should be ignored.
| PGN | Factory Period | Period Addr | Byte Layout & Fields | Type | Scale & Unit |
|---|---|---|---|---|---|
0xFF2F | Off | 0x012F | 0–5: year-2000 / mo / day / hr / min / sec; 6–7: ms | u8×6, u16 | Date populated when UTC synced; 0 when unsynced |
0xFF34 | 10 ms | 0x0134 | 0–1 / 2–3 / 4–5: Acc X / Y / Z | i16 | × 0.00048828 G (16/32768) |
0xFF37 | 10 ms | 0x0137 | 0–1 / 2–3 / 4–5: Gyro X / Y / Z | i16 | × 0.061035 deg/s (2000/32768) |
0xFF3A | Off | 0x013A | 0–1 / 2–3 / 4–5: Mag X / Y / Z | i16 | × 0.030517 μT (1000/32768) |
0xFF3D | 10 ms | 0x013D | 0–3: Roll; 4–7: Pitch | i32 | × 0.001 deg |
0xFF41 | 10 ms | 0x0141 | 0–3: Compass heading (0–360° CW); 4–7: Raw yaw (±180° CCW) | i32 | × 0.001 deg |
0xFF43 | Off | 0x0143 | 0–1: Temperature (2–7 reserved) | i16 | × 0.01 °C |
0xFF46 | Off | 0x0146 | 0–1 / 2–3 / 4–5 / 6–7: Quaternion qw / qx / qy / qz | i16 | × 0.0001 |
0xFF4A | Off | 0x014A | 0–3: X inclination; 4–7: Y inclination (fixed RFU) | i32 | × 0.001 deg |
0xFF5B | Off | 0x015B | CANFD83 variable frame (CAN FD models only, below) | — | — |
J1939 acceleration, angular rate, and magnetic field saturate at ±16 G, ±2000 deg/s, and ±1000 μT; pressure and MRU fields are not output. 0xFF2F is output-only and cannot set module time — use PPS Time Sync.
Decoding Examples & SDK
| CAN ID (SA=8) | 8-Byte Payload (Hex) | Decoded Result |
|---|---|---|
0x0CFF3408 | EC FF 23 00 00 08 00 00 | Acc: X = −0.0098 G, Y = 0.0171 G, Z = 1.0000 G |
0x0CFF4108 | 6D DE 01 00 93 21 FE FF | Compass 122.477° (CW); raw yaw −122.477° (CCW) |
0x0CFF2F08 | 1A 06 12 0E 1E 2D 58 02 | 2026-06-18 14:30:45.600 UTC |
Official C99 decoder and tools: c/hipnuc/hipnuc_can.c, Linux SocketCAN example read_can.c, and signal database dbc/J1939.dbc.
CANFD83 Variable Frame
Applies only to CAN FD models. Default nominal rate is 500 kbit/s and data-phase rate is 4 Mbit/s. PGN = 0xFF5B, priority 3, extended ID = 0x0CFF5B00 | node_id, FD=1, BRS=1.
Bit timing: nominal sample point is 80% across all rates; data-phase sample point is 80% (75% at 5 Mbit/s). Match the host's nominal sample point to the module, otherwise BRS bit-rate switching skews the data phase and corrupts frames.
CANFD83 Frame Format
Starts with an 8-byte fixed header followed by fields packed from LSB to MSB of MAP (little-endian, IEEE-754 float32):
| Offset | Bytes | Field | Type | Description |
|---|---|---|---|---|
| 0 | 4 | MAP | uint32 | Bitmask of fields present in this frame |
| 4 | 2 | main_status | uint16 | Main status word (bit12 always 0) |
| 6 | 1 | ins_status | uint8 | INS status (ignore on IMU / AHRS) |
| 7 | 1 | sequence | uint8 | Rolling frame counter (0–255 wrap, for drop detection) |
| bit | Field | Type | Bytes | Unit | Order / Meaning |
|---|---|---|---|---|---|
| 0 | ACC_B | float32×3 | 12 | m/s² | X, Y, Z |
| 1 | GYR_B | float32×3 | 12 | rad/s | X, Y, Z |
| 2 | MAG_B | float32×3 | 12 | μT | X, Y, Z (requires magnetometer) |
| 3 | RPY | float32×3 | 12 | deg | roll, pitch, yaw (±180°) |
| 4 | QUAT | float32×4 | 16 | — | w, x, y, z |
| 5 | SYSTEM_TIME | uint64 | 8 | μs | Monotonic sample timestamp since boot |
| 6 | UTC | packed | 8 | — | year-2000:u8, month:u8, day:u8, hour:u8, minute:u8, second*1000+ms:u16le, reserved:u8=0; valid when UTC_UNSYNC=0 |
| 8 | TEMPERATURE | float32 | 4 | °C | Module temperature |
Supported MAP mask is 0x0000017F. Configured MAP must be nonzero, contain no reserved bits, and satisfy logical length 8 + sum(selected fields) ≤ 64 (selecting all bits of 0x17F requires 92 bytes and is rejected).
Default MAP = 0x0000012B (56 logical bytes, padded on the wire to 64 bytes / DLC=15; ignore trailing zero padding):
| CAN FD data bytes | 12 | 16 | 20 | 24 | 32 | 48 | 64 |
|---|---|---|---|---|---|---|---|
| DLC code | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
CANFD83 Configuration Parameters
Configured via the protocol below using classic 8-byte frames (FD=0, BRS=0). Data-phase bit-rate index: 0=1 Mbit/s, 10=2 Mbit/s, 11=4 Mbit/s, 12=5 Mbit/s.
| Parameter | Address | Default | Effective |
|---|---|---|---|
| CANFD83 MAP | 0x0180 | 0x12B | Next frame |
| CANFD83 period | 0x015B | 0 (off) | Immediate (ms) |
| Periodic output master switch | 0x009D | 1 (on) | Immediate (0/1) |
| Data-phase rate index | 0x009B | 11 | Save and reboot |
Common requests for node 8, host 0x55 (request ID 0x0CEF0855, reply ID 0x0CEF5508):
| Action | Request Data (8 bytes) |
|---|---|
| MAP = 0x12B | 80 01 06 00 2B 01 00 00 |
| Read MAP | 80 01 03 00 00 00 00 00 |
| Period = 10 ms | 5B 01 06 00 0A 00 00 00 |
CANFD83 Frame Example
Example frame (constructed test data, not a hardware capture), ID=0x0CFF5B08, FD=1, BRS=1, DLC=15:
2B 01 00 00 00 00 00 7E
00 00 80 3F 00 00 00 C0
00 00 18 41 00 00 80 3E
00 00 00 BF 00 00 80 3F
00 00 20 41 00 00 A0 C1
00 00 F0 41 40 42 0F 00
00 00 00 00 00 00 CC 41
00 00 00 00 00 00 00 00Decoded: ACC_B=[1, -2, 9.5] m/s², GYR_B=[0.25, -0.5, 1] rad/s, RPY=[10, -20, 30] deg, SYSTEM_TIME=1000000 μs, TEMPERATURE=25.5 °C, trailing 8 bytes are padding.
Configuration Protocol
The host reads and writes parameters via point-to-point extended frames 0x0CEF[DA][SA] (DA = module node address, SA = host address 0x55; module replies on 0x0CEF[SA][DA]). Send one request at a time, wait for the reply or timeout, and keep ≥ 10 ms between requests. Parameter addresses share the Modbus register map (e.g. status 0x0009, magnetic calibration 0x0008/0x000A/0x000B).
| Bytes | Field | Type | Description |
|---|---|---|---|
| 0–1 | ADDR | u16 | Parameter address (little-endian) |
| 2 | CMD | u8 | 0x06 write, 0x03 read |
| 3 | Reserved | u8 | Write 0 |
| 4–7 | VAL | u32 | Parameter value (little-endian); set upper 16 bits to 0 when writing 16-bit params; compare only the low 16 bits on readback (may be sign-extended) |
Common Configuration Frames (DA=8, Request ID 0x0CEF0855)
| Data (8 bytes, little-endian) | Parameter Address & Function |
|---|---|
[PS] 01 06 00 [VAL] | Set PGN period (ms, 0 = off, immediate), e.g. 37 01 for 0x0137 (gyro) |
9D 00 06 00 [VAL] | 0x009D periodic output switch: 1 on (default), 0 off (immediate) |
9A 00 06 00 [VAL] | 0x009A nominal rate code: 0=1M, 2=500k, 3=250k, 4=125k (save & reboot) |
9C 00 06 00 [VAL] | 0x009C node address 1–127 (save & reboot) |
06 00 06 00 [VAL] | 0x0006 operating mode (0/1/4/5/7, save & reboot) |
07 00 06 00 [VAL] | 0x0007 output axes (0 RFU / 4 ROS, save & reboot) |
A6 00 06 00 [VAL] | 0x00A6 mounting code (e.g. 024 → 18 00 00 00, save & reboot) |
A5 00 06 00 [VAL] | 0x00A5 attitude zeroing (0/1/2/3/5) |
00 00 06 00 00 00 00 00 | 0x0000 save (0x01 = factory reset, 0xFF = reboot) |
Example: change node address from 8 to 9.
→ 0x0CEF0855 9C 00 06 00 09 00 00 00 write node address 9
← 0x0CEF5508 9C 00 06 00 09 00 00 00 echo
→ 0x0CEF0855 9C 00 03 00 00 00 00 00 read back
← 0x0CEF5508 9C 00 03 00 09 00 00 00 value is 9 (takes effect after reboot)
→ 0x0CEF0855 00 00 06 00 00 00 00 00 save
→ 0x0CEF0855 00 00 06 00 FF 00 00 00 reboot (wait ~1 s)
→ 0x0CEF0955 9C 00 03 00 00 00 00 00 read back at new address 9
← 0x0CEF5509 9C 00 03 00 09 00 00 00 confirmed node address 9CANopen (Custom Firmware)
CANopen uses 11-bit standard frames, shares the node ID with J1939 (default 8), uses little-endian payloads, and ships with all TPDO periods set to 0 (disabled).
TPDO mapping (scale factors differ from J1939 and Modbus — do not mix):
| Channel | COB-ID | Period Index (Subindex 5) | DLC | Content & Scaling |
|---|---|---|---|---|
| TPDO1 | 0x180+ID | 0x1800 | 6 | Acc XYZ: i16 × 0.001 G (mG) |
| TPDO2 | 0x280+ID | 0x1801 | 6 | Gyro XYZ: i16 × 0.1 deg/s |
| TPDO3 | 0x380+ID | 0x1802 | 6 | Euler R/P/Y: i16 × 0.01 deg |
| TPDO4 | 0x480+ID | 0x1803 | 8 | Quaternion W/X/Y/Z: i16 × 0.0001 |
| TPDO6 | 0x680+ID | 0x1804 | 4 | Pressure: i32, Pa |
| TPDO7 | 0x780+ID | 0x1805 | 8 | Inclination X/Y: i32 × 0.01 deg |
SDO configuration: host sends to 0x600+ID, module replies on 0x580+ID (8 bytes: CS | Index_L | Index_H | SubIndex | Data0..3; read 0x40, 4-byte write 0x23, 2-byte write 0x2B). Manufacturer object index = 0x2000 + parameter address (same address map as J1939 configuration). Common frames (node 8, sent to 0x608):
| Operation | Data (Hex) |
|---|---|
Read node ID (0x209C) | 40 9C 20 00 00 00 00 00 |
Set node ID (1–127, save & reboot) | 23 9C 20 00 [ID] 00 00 00 |
Set CAN bit rate (0x209A: 0=1M / 2=500k / 3=250k / 4=125k, save & reboot) | 23 9A 20 00 [VAL] 00 00 00 |
Disable J1939 periodic broadcast (0x209D, save & reboot) | 23 9D 20 00 00 00 00 00 |
Set TPDO1 period 10 ms (0x1800:05; other channels per table above) | 2B 00 18 05 0A 00 00 00 |
Set heartbeat 100 ms (0x1017:00, 0 disables) | 2B 17 10 00 64 00 00 00 |
Save / Factory reset / Reboot (0x2000 = 00 / 01 / FF) | 23 00 20 00 [00|01|FF] 00 00 00 |
Notes:
- Manufacturer objects (
0x2000and above) require 4-byte writes (CS=0x23). - For factory reset, write
0x2000 = 1(do not use0x1011); CAN bit rate and node ID revert to defaults. - For reset, write
0x2000 = 0xFFor send NMT Reset Node (0x000: 81 <ID>). Do not use NMT Reset Communication — it clears active TPDO periods and heartbeat.
