AnsweredAssumed Answered

Missing data in short isochronous frames over USB

Question asked by Rick Weil on Nov 20, 2019
Latest reply on Nov 27, 2019 by Wigros Sun

I'm working on a bare metal system that transfers VPU-compressed video from 1 iMX6 processor to another over USB using #isochronous transfers.


Assume a compressed video frame of 123456 bytes is to be sent over USB. This data is broken into 21K pieces to be sent in 5 full USB frames (7 full micro frames of 3K bytes each), with the remainder being sent in a final 15936 byte frame (5 full micro frames and the remainder of 576 bytes).  This is typically what happens, and it works fine.  USB frames shown in [brackets].


Normally case: 5 * [21K] + [15936] = 5 * [7 * 3072] + [(5 * 3072) + 576] = 123456 bytes sent in 6 frames.


BUT sometimes I see a different behavior.  Sometimes the transmitter groups the micro frames differently.  The initial transfer is not aligned with the first micro frame of a full USB frame transfer.  For example, say only 3 micro frames are filled with data (in slots 4,5,6, with slots 0,1,2,3 being empty). This is followed by a sequence of 21K frames, and a final partial frame being sent.


Sometimes case: [3 * 3072] + 5*[21K] + [6720] = [3 * 3072] + 5*[7 * 3072] + [(2 * 3072) + 576] = 123456 bytes sent in 7 frames.


The receive callback gets the expected buffer pointer and length as confirmed by a USB bus analyzer.  BUT in the "sometimes" case, the first frame transmitted (in this case [3 *3072]) does not contain updated data.  


Why in this case is the data NOT captured from the bus into the buffer?