Reference
Packet Format
General Layout
Kangaroo packets have the following form:
Address (1 byte)
The Kangaroo address. By default, this is 128. Address bytes have the high bit set.
Command (1 byte)
The command number.
Data Length (1 byte)
The number of bytes n of data.
Data (n bytes)
The command data.
CRC (2 bytes)
See the Example Code section.
A 14-bit CRC computed from the address (excluding its high bit), command, data length, and data.
The lower 7 bits are written into the first byte, and the upper 7 bits into the second byte.
The polynomial is 0x21E8 in Koopman notation.
Bit-Packed Numbers
See the Example Code section.
Many numbers sent to and from Kangaroo are larger than 7 bits. As a result they must be packed into
multiple bytes. First, if the number is positive, it is doubled. If it is negative, the absolute value is taken, it is
doubled, and then 1 is added. 6 bits are packed into each byte, starting with the lowest bits and moving up.
The 7th bit is set in a byte if there are more bytes to come. Decoding is the reverse process. This means -64
to 64 is 1 byte, -4096 to 4096 is 2 bytes, and so on.
Echo Code
Echo codes are 1 byte and can optionally be used in Get commands. The reply echoes back the same code
sent with the initial command. You can use these to pair up commands with their replies.
Sequence Code
Sequence codes are 1 byte and can optionally be used in most commands.
When used in any command except Get, they set the sequence code and do the action, unless the last
received sequence code is identical. If it is identical, no action is taken. This prevents a command from
executing more than once.
When used in a Get command, the last received sequence code is sent with the reply. The sequence code is
not modified. You can use this to verify that a command was received.
At startup, the sequence code is 0 on all channels.
5