Content originally posted in LPCWare by etunnel on Fri Sep 19 00:48:55 MST 2014
I am learning about writing USB bulk transfer. I noticed something that I don't understand.
On LPC4370 (the device), I setup a 4KB transfer buffer. I found in debugger that I have to issue 1KB transfer 4 times on the PC host (running in Windows 7 using WINUSB API) before the EP OUT event handler is called with USB_EVT_OUT on the device. Each time when 1KB transfer is issued, the host function call returns successful. When I change the transfer size to be an odd size, for example 1000 bytes. Immediately, EP OUT event handler is called with USB_EVT_OUT. Is this an expected behavior?
Is there a flag I can modify the behavior such that the event handler is called for each 1KB transfer?
Should I design a data flow protocol to send a small packet containing the length of transfer from host first? Then, setup the transfer size in exact size on the LPC43xx device, subject to the max dma buffer allowed. Finally, initiate the data transfer from the host.
Thanks!