I am building a DFU Bootloader.
At this point I'm able to read and erase chip, and I have some problems with writing to the xmega.
When I look using usbmon:
ffff8803ddf3b3c0 507570310 S Co:3:118:0 s 21 01 000e 0000 0240 576 = 0100a200 a3ff0000 00000000 00000000 00000000 00000000 00000000 00000000
I see that it receives 576 bits = 64 (USB_PACKET_SIZE) * 9 = (Flip command + 8 packets for data)
but when I try to receive each packet in the request, I am able only to get the first 8.
The mechanism of receiving is:
after handeling the packet content, send ACK:
LACR16(&usb_xmega_endpoints.out.STATUS, USB_EP_SETUP_bm | USB_EP_BUSNACK0_bm | USB_EP_TRNCOMPL0_bm | USB_EP_OVF_bm); [LAC - Load And Clear]
and in the end to send ZLP:
usb_ep_start_in(0x80, ep0_buf_in, 0, false);
as in the dfu document: http://www.atmel.com/Images/doc8457.pdf Page 7 Figure 6-3
The problem is that I get only 7 packets of data.