13.3.5.3 Framing Packet
The framing packet is used for flow control and error detection, and it (the framing
packet) wraps command and data packets as well.
The framing packet described in this section is used for serial peripherals including
UART, I2C and SPI. The USB HID peripheral does not use framing packets. Instead, the
packetization inherent in the USB protocol itself is used. Please refer to the USB
peripheral section for details.
Table 13-5. Framing Packet Format
Byte # Value Parameter
0 0x5A start byte
1 packetType
2 length_low Length is a 16-bit field that specifies the entire
command or data packet size in bytes.
3 length_high
4 crc16_low This is a 16-bit field. The CRC16 value covers entire
framing packet, including the start byte and command
or data packets, but does not include the CRC bytes.
See the CRC16 algorithm after this table.
5 crc16_high
6 . . .n Command or Data packet
payload
A special framing packet that contains only a start byte and a packet type is used for
synchronization between the host and target.
Table 13-6. Special Framing Packet Format
Byte # Value Parameter
0 0x5A start byte
1 0xAn packetType
The Packet Type field specifies the type of the packet from one of the defined types
(below):
Table 13-7. packetType Field
packetType Name Description
0xA1 kFramingPacketType_Ack The previous packet was received successfully; the sending
of more packets is allowed.
0xA2 kFramingPacketType_Nak The previous packet was corrupted and must be re-sent.
0xA3 kFramingPacketType_AckAbort Data phase is being aborted.
0xA4 kFramingPacketType_Command The framing packet contains a command packet payload.
0xA5 kFramingPacketType_Data The framing packet contains a data packet payload.
Table continues on the next page...
Chapter 13 Kinetis Flashloader
K22F Sub-Family Reference Manual, Rev. 4, 08/2016
NXP Semiconductors 303