I'm adding DFU Host support to a project.
DFU uses control transfers for data delivery. USBHCDControlTransfer() supports writes to USB devices, and its working fine for small transfers. If I write 63 bytes or less to my device, the USBHCDControlTransfer() returns valid data.
USBHCDControlTransfer() (in usbhostenum.c) locks out USB interrupts and then spins on the INT_EVENT_ENUM | INT_EVENT_SOF interrupt bits. When these bits are both set, it calls USBHCDEnumHandler(), which then calls USBHCDEP0StateTx(). That routine sends at most 64bytes at a time to the device.
I need to write kilobytes of data to to the USB device.
System Setup:
The USB interrupt is priority 0x20
Systick calls USBHCDMain(), at priority 0x40 (lower)
I'm calling USBHCDControlTransfer() from main(). Before I call it, I disable the sytick call to USBHCDMain(). One thing I see that seems a bit odd is this code from
USBHCDControlTransfer():
USBHostEndpointConfig(USB0_BASE, USB_EP_0, 64, 0, 0,
(USB_EP_MODE_CTRL | psDevice->ui32Speed |
USB_EP_HOST_OUT));
Thats setting ui32NAKPollInterval to 0. I know from looking at USB traces that my USB device does NAK some frames. I don't see any code that handles the timeout case.