I'm going to go ahead and post this because TI is no longer maintaining the USB library or fixing bugs in it, It took me a while to figure out exactly how to fix the bug. There were hints, but no actual fix.
USBHCDPipeWrite() is broken if you write more than 64 bytes at a time. The root cause is a bug in the library code.
This is the TI code as shipped.
if(bUseDMA == false) { // // Only send 64 bytes at a time if not using DMA. // if(ui32ByteToSend > 64) { ui32ByteToSend = 64; } else { // // Send the requested number of bytes. // ui32ByteToSend = ui32RemainingBytes; }
Heres the fix:
if(bUseDMA == false) { // // Only send 64 bytes at a time if not using DMA. // if(ui32RemainingBytes > 64) { ui32ByteToSend = 64; } else { // // Send the requested number of bytes. // ui32ByteToSend = ui32RemainingBytes; }
I've tested this code an confirmed that it works.