We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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.
I haven't had any problem with the USB Device CDC since I turned off the USB register view in the System Viewer. Previously, I experienced the stopping of data from device to host in less than a minute, now it's been running nonstop for 3 hours at max rate that I was able to achieve.
I believe it's safe to say that the problem I had is related to the system viewer displaying USB registers rather than a problem in MDK.