x-IMU3 User Manual v0.11
April 6, 2022
ASCII data messages consist of multiple comma-separated values terminated by the control character
sequence: CR, LF. The first value is a single uppercase character indicating the message type. The second
value is the timestamp in microseconds. The remaining values are arguments specific to the message type.
Binary data messages are a sequence of bytes terminated by the control character LF. The first byte of the
sequence indicates the message type. The value of this byte is equal to 0x80 plus the first character of the
equivalent ASCII message. The next eight bytes are the timestamp in microseconds expressed as a 64-bit
unsigned integer. The remaining bytes are arguments specific to the message type. Numerical types use
little-endian ordering. Byte stuffing is used to remove all occurrences of the control character LF prior to the
termination byte.
8.2.1
Byte stuffing
Byte stuffing ensures that the termination byte value, 0x0A, only occurs at the end of a binary data message.
This is achieved by replacing all occurrences of the termination byte prior to termination with an escape
sequence. This process is identical to Serial Line Internet Protocol (SLIP) except that the “END” byte value is
defined as 0x0A. Table 11 lists the values used by the byte stuffing process.
Hex
Decimal
Name
Description
0x0A
10
END
Message termination
0xDB
219
ESC
Message escape
0xDC
220
ESC END
Transposed message termination
0xDD
221
ESC ESC
Transposed message escape
Table 11: Values used by the byte stuffing process
Byte stuffing is achieved by the following:
·
Replace each occurrence of END in the original message with the two byte sequence: ESC, ESC END.
·
Replace each occurrence of ESC in the original message with the two byte sequence: ESC, ESC ESC.
The byte stuffing process will not modify the END that terminates the message. Table 12 demonstrates byte
stuffing for example byte sequences terminated as binary data messages.
Example
Before byte stuffing
After byte stuffing
1
45 58 41 4D 50 4C 45
0A
45 58 41 4D 50 4C 45
0A
2
45
0A
41 4D 50 4C 45
0A
45
DB DC
41 4D 50 4C 45
0A
3
45 58
DB
4D 50 4C 45
0A
45 58
DB DD
4D 50 4C 45
0A
4
45 58 41 4D 50
DB
0A
0A
45 58 41 4D 50
DB DD
DB DC
0A
Table 12: Byte stuffing examples
8.2.2
Inertial message
The inertial message provides timestamped gyroscope and accelerometer measurements. Inertial messages
are sent continuously at the message rate configured in the device settings. The first value of an ASCII
message is the character “I” and the arguments are six numerical values expressed to four decimal places.
The first byte of a binary message is 0xC9 (equal to 0x80 + “I”) and the arguments are six contiguous 32-bit
floats. The message arguments are described in Table 13 on the next page.
23