To RECEIVE an AVR response from the EDBG, an AVR_RSP packet must be sent (i.e.: polling for responses).
Field | Size | Description |
---|---|---|
AVR_RSP | 1 byte | 0x81 |
The response to this send is:
Field | Size | Description |
---|---|---|
AVR_RSP | 1 byte | 0x81 |
FragmentInfo | 1 byte | Fragment number |
Size | 2 byte, MSB first | Number of response bytes |
Response | N bytes | Enveloped AVR response |
FragmentNumber 0x00 indicates that no response data is available, and the rest of the packet is ignored.
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.
Note that the "synchronous" nature of the AVR CMD-RSP functionality must be preserved even when running over this CMSIS-DAP wrapper. This means that every one command results in one and only one response, and that response must be read out before the following command can be issued.
For example, to read 80B AVR response packet when the REPORT_SIZE is 64B:
Packet# | Direction | Data |
---|---|---|
1 | PC to Tool | 0x81 |
2 | Tool to PC | 0x81 0x00 |
3 | PC to Tool | 0x81 |
4 | Tool to PC | 0x81 0x00 |
5 | PC to Tool | 0x81 |
6 | Tool to PC | 0x81 0x12 0x00 0x3C ...First 60B of AVR response packet... |
7 | PC to Tool | 0x81 |
8 | Tool to PC | 0x81 0x22 0x00 0x14 ...Remaining 20B of AVR response packet... |