3.2.1.1.1 Wrapping AVR Commands

So to SEND an AVR command to the EDBG, it is wrapped as:

Table 3-3. AVR_CMD Command
FieldSizeDescription
AVR_CMD1 byte0x80
FragmentInfo1 byteFragment number
Size2 bytes, MSB firstNumber of bytes in the wrapped AVR packet
CommandPacketN bytesEnveloped AVR packet

Large packets must be chopped up according to the HID interface’s REPORT_SIZE. The fragment number envelope field is two 4-bit nibbles indicating a "packet m of n packets" relationship:

(packet_number << 4) | total_number_of_packets.

Each SEND fragment responds with:

Table 3-4. AVR_CMD Response
FieldSizeDescription
AVR_CMD1 byte0x80
FragmentCode1 byte

0x00: More fragments required (m < n)

0x01: Full packet received, will be processed (m == n)

This is not to be confused with the AVR_RSP, which is the response to the command itself, which is detailed next.

For example, to wrap a 100B AVR command packet when the REPORT_SIZE is 64B:
Table 3-5. AVR_CMD Example
Packet#DirectionData
1PC to Tool0x80 0x12 0x00 0x3C ...First 60B of AVR command packet...
2Tool to PC0x80 0x00
3PC to Tool0x80 0x22 0x00 0x28 ...Remaining 40B of AVR command packet...
4Tool to PC0x80 0x01