Tool/software: TI-RTOS
There is a following piece of code in USBHCDPipeWrite(uint32_t ui32Pipe, uint8_t *pui8Data, uint32_t ui32Size) function in usbhostenum.c file (revision 2.1.1.71 of the Tiva USB Library):
//
// 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;
}
//
// Start a write request.
//
g_sUSBHCD.psUSBOUTPipes[ui32PipeIdx].iState = ePipeWriting;
//
// Disable uDMA on the USB endpoint
//
MAP_USBEndpointDMADisable(USB0_BASE, ui32Endpoint,
USB_EP_HOST_OUT);
//
// Put the data in the buffer.
//
MAP_USBEndpointDataPut(USB0_BASE, ui32Endpoint, pui8Data,
ui32ByteToSend);
The code runs in a loop. Let’s assume the function is called with ui32Size = 200. In the first pass, ui32ByteToSend is set to 64. In the second pass, because ui32ByteToSend is NOT greater than 64, it’s set to ui32RemainingBytes, that is 136 in our example. The write of more than 64 bytes fails but the function returns a ui32Size number of bytes scheduled for sending. This is a severe bug that prevents sending more than 128 bytes. From searching e2e.ti.com, I see that this bug was reported as early as October 2013 (https://e2e.ti.com/support/microcontrollers/tiva_arm/f/908/p/296947/1035641#1035641, https://e2e.ti.com/support/microcontrollers/tiva_arm/f/908/p/468291/1681349,
https://e2e.ti.com/support/microcontrollers/tiva_arm/f/908/p/491095/1799245).
There was an attempt to fix it as mentioned in the Release Notes:
TivaWare for C Series SW-TM4C-RLN-2.1.4.178 Release Notes Literature Number: SPMU299E May 2015–Revised February 2017
5 Release Notes for Version 2.1.0 (February 7, 2014)
5.9.1 USBHCDPipeWrite() Hangs With Certain Data Sizes If USBHCDPipeWrite() is called with a data size that is greater than 64 and not a multiple of 64 and the USB pipe is not using DMA then the call incorrectly attempted to send the full number of bytes requested. This also caused the call to USBHCDPipeWrite() to hang waiting for more bytes than can be sent. The call now correctly sends only the remaining bytes and returns correctly.
But change from:
ui32ByteToSend = ui32Size;
to:
ui32ByteToSend = ui32RemainingBytes;
that was done for TivaWare release 2.1.0.12573 did not do the job.
A simple fix might be to replace:
if(ui32ByteToSend > 64)
with:
if(ui32ByteToSend >= 64)
But test it please.
Thanks,
Ed