Author Topic: USB Video  (Read 5118 times)

sudheerg_

  • Member
  • ***
  • Posts: 18
USB Video
« on: June 18, 2015, 06:49:35 am »
Hi,

We are testing a USB Camera by connecting to the USB Host Controller.

The camera reports that we need to retrieve data using Isochronous endpoints.

The doubts that I have is, the Host Controller can miss some of the Isochronous packets as there is no retry mechanism.

Lets say I am trying to capture a 160 x 120 frame with 10 bits per pixel. In that case one frame size is 38400.

If the endpoint size is 768 bytes we need to receive 50 such packets.

So, my question is if we miss ISO packets how can we construct the entire frame?

For example if I enable SOF interrupt in my Host controller I get one interrupt per 125uS / 1mS depending on speed of the host controller, which may not looks good.

What is the best way to receive data from a device with ISO endpoints?

Thanks for your time.

Best Regards,
SUDO

erdmann

  • Member
  • ***
  • Posts: 43
Re: USB Video
« Reply #1 on: June 18, 2015, 07:31:21 am »
Per specification, ISO transfers provide no way to recover lost data or automatically retry an operation. If you apparently lose data (provided you can detect that) you will be forced to come up with a recovery solution in SW (throw away all packets until the start of the next 160x120 frame etc.).
But you would not need to react on SOF interrupt but rather you will need to react on data transmission completion interrupt.
Isochronous transfers are scheduled at fixed periodic intervals (effectively for isochronous transfers, and also for interrupt transfers, the host controller is traversing a "job table", see UHCI/OHCI/EHCI specs) and it is the application's job to prepare data transfers (in your case: read transfers) ahead of time before they are then executed by the host controller. Therefore, if you get a transmission completion interrupt for a transfer you can set up the next bunch of transfers in the "job table".

That's also the reason why video devices that encode data in blocks (MPEG ?) use bulk endpoints instead of isochronous endpoints. Losing a block or parts of a block of encoded data would not be recoverable.