IN endpoints payload corruption with USB HAL device library
My application configures the STM32F4 USB OTG HS block as a FS device with 3 non-zero IN endpoints (1,2 & 5)
In normal operation 44 byte payloads are sent to EP5 and 27 byte payload to EP1 ~ every 10ms.
All works fine for a period (2 to 120 seconds) but eventually I see a 1041 byte packet come out of one of the endpoint.
If the problem occurs on EP1 (expected 27 bytes) the first 20 bytes (0:19) are correct then the next 8 bytes (20:27) are the first 8 bytes of the next EP5 payload followed by either lots of 0x00 or a 4-byte pattern repeated.
If the problem occurs on the EP5 (expected 44 bytes) the first 36 bytes (0:35) are correct then the next 8 bytes (36:43) are the first 8 bytes of the EP1 data followed by lots of 0x00
It is worth noting that Tx FIFO access is performed a 4-byte writes
Using some spare pins and a 4 channel scope and have checked that the Tx FIFO is being written to the expected number of times in USB_WritePacket().
I also have put some some debug into USB_EPStartXfer() to catch any unexpected packet/transfer values being writem to the DIEPTSIZx regs
Anybody got any other ideas
Thanks
#usb-device #stm32f4