I2C Protocol
Applies only to models with the -I2C suffix (such as HI05-I2C). I2C shares the CAN pins, so -I2C models have no CAN interface. Pull-up resistors are not populated inside the module and must be placed on the host board. Use COM1 for bulk debugging and firmware upgrades.
Bus Parameters & Addressing
| Item | Specification |
|---|---|
| 7-bit device address | Default 0x50 (80), shared with MD_ID (0x0005); range 0x08–0x77, takes effect immediately. Shares the address of common 24Cxx EEPROMs — connect the module alone to change its address if an EEPROM is on the same bus |
| Bus speed | 100 kHz or 400 kHz (1 MHz Fm+ not supported) |
| Clock stretching | Host must support it; allow at least 20 ms when Flash writes or activity on other ports overlap a transaction |
| Recommended poll rate (default 74 B frame) | ≤ 200 Hz at 400 kHz; ≤ 100 Hz at 100 kHz |
Basic read/write rules:
- Register addresses count 16-bit words (2 bytes each, big-endian / MSB first); addresses auto-increment within a read transaction.
- The module infers the operation from the write transaction length. Split every request and read into two separate transactions (Write+STOP, then Read+STOP) — do not use Repeated START.
| Address Space | Purpose |
|---|---|
0x0000–0x0FFF | Register area (same map as Modbus Registers, max 32 words per read) |
0x1000 and up | Complete HI83 frame of the latest sample (same layout and CRC as Serial HI83, little-endian payload) |
| Write Payload | Meaning |
|---|---|
ADDR_H ADDR_L (2 bytes) | Set read pointer; writing 10 00 also latches the latest HI83 frame |
ADDR_H ADDR_L COUNT (3 bytes) | Request register read, COUNT in 1–32 |
ADDR_H ADDR_L DATA... (even length, 4–66 bytes) | Write contiguous registers (invalid values are silently ignored; read back to confirm) |
Reading the Latest HI83 Frame
I2C has no fixed output rate; each request to 0x1000 snapshots the latest sample (-I2C default HI83_MAP = 0x0000003B, 74 bytes):
- Write
10 00+ STOP to latch the latest sample. - Read the 6-byte header (
5A A5+ LEN + CRC). While packing, the module returns NACK — retry the read every 1 ms for up to 1 s. - Write
10 03+ STOP to move the pointer to the payload start. - Read
LENpayload bytes. - Verify CRC-16/XMODEM and decode using
data_bitmap.
- If no sample is ready right after boot, bytes read
0(first byte ≠0x5A); skip and retry. - If header CRC and LEN match the previous frame, no new sample arrived yet (polling faster than internal rate) — skip steps 3–4. When frame size is known, you may read all
6 + LENbytes in one read after10 00, or read in chunks by moving the pointer; reads past the end return0. - Use the official C driver
hipnuc_i2c.c/.h(handles NACK retry, boot wait, register access, and deduplication); see the C SDK README.
Common Configuration Registers
In addition to shared Modbus registers (0x0000 CTRL, 0x0005 MD_ID, 0x0006 PROFILE, 0x0007 COORD, 0x0008–0x000B magnetic calibration, 0x00A5 ATT_RST, 0x00A6 URFR, 0x0070–0x0082 version), -I2C models expose two extra registers:
| Registers | Name | Type | R/W | Description |
|---|---|---|---|---|
0x0408–0x040F | SN_STR | ASCII | R | Product serial number (first 16 chars of SN= in LOG VERSION, 2 chars/word, MSB first) |
0x00B8–0x00B9 | HI83_MAP | u32 | R/W | HI83 bitmap: 0x00B8 high 16 bits, 0x00B9 low 16 bits; must be written in one 4-byte write transaction (single-word writes are ignored) |
Example: set HI83_MAP = 0x0000013B (adds temperature; frame grows 74 → 78 bytes) and read back ([0x50] is the 7-bit address). Takes effect and saves immediately for the next 10 00 request:
→ [0x50] Write 00 B8 00 00 01 3B write 0x00B8–0x00B9 together
→ [0x50] Write 00 B8 02 request 2 registers
← [0x50] Read 00 00 01 3B confirm valueExample: change device address 0x50 → 0x60 (immediate and auto-saved):
→ [0x50] Write 00 05 00 60 update MD_ID
→ [0x60] Write 00 05 01 read back at new address
← [0x60] Read 00 60NACK Retry & Reset Timing
- NACK means busy: the module NACKs its address while packing data or writing Flash. Retry every
1 msfor up to1 s. When a read is NACKed, retry only the read transaction — do not resend the read request. - Reset recovery: after power-up, reboot, or factory reset, keep the bus idle for ≥ 150 ms, then poll
0x0005(MD_ID) until it returns the device address. After a factory reset, the address may revert to0x50: poll the old address first, then0x50if silent. - Transaction timeout & integrity: finish each transaction (START to STOP) within
50 ms; wait100 msafter any timeout or bus error before retrying. Register reads have no CRC — read critical parameters twice and compare in noisy environments.
