The CITRIC platform uses TinyOS packets. Please refer to the TinyOS documentation for further information about the packet format, specifically Lesson 4, TEP 113, and Serial.h (located in $TOSROOT/tos/lib/serial). Note that all multiple byte fields are big endian, except the CRC in the serial packet.
The serial packet format is used to transfer packets over UART and is the encompassing packet format of CITRIC. It has the following fields:
delimiter | Serial packet header | AM packet | Serial packet footer | delimiter | ||||
delimiter | protocol byte | sequence number byte | dispatch byte | AM packet header | AM packet payload | CRC (2 bytes) | delimiter | |
7E | 45 | XX | 00 | ... | ... | XX | XX | 7E |
The serial protocol uses 2 special characters, one is the delimiter 0x7E, the other is the escape byte 0x7D. The escape byte is used to send values that are 0x7E or 0x7D and is always followed by a second byte which specificies that value. Thus, a value 0x7E is replaced by the 2 byte sequence 0x7D 0x5E, and 0x7D is replaced by 0x7D 0x5D.
The AM packet is the basic TinyOS packet format and is documented in TinyOS Tutorial Lesson 4. It is divided into 2 parts, header and payload, with the following fields:
AM packet header | AM packet payload | ||||||
dest ID (2 bytes) | src ID (2 bytes) | payload length | group ID | handler ID | payload | ||
XX | XX | XX | XX | XX | XX | XX | ... |
A CB (cameraboard) Packet is contained in the AM packet payload when the CB packet type is specified in the handler ID of the AM packet header. It is split into header and payload and has the following fields:
AM packet payload | |||
CB packet header | CB packet payload | ||
type | actual src ID (2 bytes) | payload | |
XX | XX | XX | ... |