I've got a modified DEMOJM Coldfire board with a 51JM128 processor using the Freescale USB Stack 4.0.3. In host mode, the code fails writing to an attached USB flash drive intermittently, sometimes taking more than a couple of hours to fail. When the failure occurs, the host send an invalid endpoint in a DATA OUT packet header, then follows with another DATA OUT packet header with the correct endpoint. The CRC on the header with the invalid endpoint is valid, so it looks like the endpoint value was intentional. But there isn't any data transferred, just the setup packet. Afterwards the USB flash drive (mostly) starts returning a NAK for every data output @packet and after the timeout period, the f_write operation fails.
I will point out that on some flash drives, I successfully ran for 16+ hours. But I need this to work on a variety of flash drives.
How do I see how the invalid endpoint is being generated in the firmware? It looks like the Coldfire USB hardware uses the BDT and DMA to send the USB values, so how do I trigger on the actual error to see why the value is invalid?
I have attached the logic analyzer waveform and an excel spreadsheet with the transactions. Row 22355 has the invalid endpoint. Again, this shows only the DATA OUT header with the address and endpoint followed by another DATA OUT with the correct endpoint.