This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

MDK 6.5 USB CDC issue

While stress testing the MDK USB Device CDC support by sending large amounts of data, randomly the data that is actually sent is halted.
Studying the transactions with a USB analyzer (Ellisys USB Explorer 200) one can see that when it stops sending data, there are "Invalid IN transaction" happening.
The DATA1 packet received has a checksum that is invalid, likely due to the checksum being calculated for more data than the packet actually contain.

In the revision history for MDK 6.5 USB it is noted that a race condition has been prevented in USB Device CDC, but to me it looks like it's still there, or there is another one happening that cause the problem I'm having.

This has also been tested with MDK 6.4 to see if it's a regression from 6.4 to 6.5, with the same result.

In my original stresstest I called USBD_CDC_ACM_WriteData as a response to user input, then additional data sent when USBD_CDC0_ACM_DataSent is being called.
That way the problem triggered very fast.
Changing it so that data is instead sent every 10 ms only made the problem take longer to appear.

For all valid Data in packets seen in the analyzer log, the payload data was either 64 bytes, or 62 bytes followed by a 2 byte payload packet.
For the invalid Data in packet, the payload length is random but less than 64 bytes. In one case 13 bytes, in another case 17 bytes, etc.