This bug manifests itself when trying to issue a Control SET transfer to the AM335x USB device with a data payload of exactly 64 bytes (ie. EP0_MAX_PACKET_SIZE). The USB device driver is not setting DATAEND to the PERI_CSR0 register in this case, which results in failures on subsequent transfers.
I changed the following line of code (line 1225 of usbdenum.c) to fix the problem:
Original code:
if(pDevInstance->ulEP0DataRemain < EP0_MAX_PACKET_SIZE)
Modified code:
if(pDevInstance->ulEP0DataRemain <= EP0_MAX_PACKET_SIZE)
The comment before this line of code is also incorrect, because zero length packets are not needed on Control SET transfers. The amount of data being sent is known apriori via the wLength field of the SETUP packet.
// If there we not more that EP0_MAX_PACKET_SIZE or more bytes
// remaining then this transfer is complete. If there were exactly
// EP0_MAX_PACKET_SIZE remaining then there still needs to be
// null packet sent before this is complete.