Packet Format
The external system sends command messages to the MC and receives telemetry from the MC. Command and telemetry messages use the proprietary protocol listed below.
Byte Length | Value | |
---|---|---|
Start byte | 1 | 0x02 for short packets that are 255 bytes or less0x03 for long packets |
Packet length | 1 if short packet 2 if long packet | Number of bytes of the Data section of the packet. |
Data | 1..n | First byte is always PID. Any number of bytes may follow. |
CRC | 2 | 16-bit CRC of the Data portion of the packet |
Stop byte | 1 | 0x03 |
All variables transmitted over this interface are transmitted in Most Significant Byte order, also referred to as big-endian.
All packets start with a Start Byte that is determined by the length of the packet. A typical packet is less than 255 bytes, so the start byte is usually 0x02. If the packet is longer than 255 bytes, then the start byte is 0x03
.
The packet length is the number of bytes contained within the Data portion of the packet. The packet length is 1 byte long if the Data length is 255 bytes or less, and 2 bytes long if the Data length is more than 255 bytes.
The Data section of the packet is always started with the Packet Identifier. An arbitrary number of packet data bytes may follow.
The CRC calculation and associated implementation is documented on the CRC Calculation page.
The stop byte is always 0x03
.