So to SEND an AVR command to the EDBG, it is wrapped as:
Table 29. Wrapping AVR_CMD
Field | Size | Description |
---|---|---|
AVR_CMD | 1 byte | 0x80 |
FragmentInfo | 1 byte | Fragment number |
Size | 2 bytes, MSB first | Number of bytes in the wrapped AVR packet |
CommandPacket | N bytes | Enveloped 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 30. Unwrapping AVR_CMD
Field | Size | Description |
---|---|---|
AVR_CMD | 1 byte | 0x80 |
FragmentCode | 1 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.