I am using the FX3 to stream video from a image sensor which is controlled by another device. Your application note AN75779 states that with the code provided with AN75779, "no modifications may be required." Two questions:
1) The image size is different from that in the example (1920x1080). From what I've ready to account for this I must make changes to 'cyfxuvcdscr.c' and 'uvc.c'. What parts must be changed? The parts of 'uvc.c' that would need to be changed appear to only be necessary when using the FX3 as a controller.
2) Are there any additional modifications that should be required if the FX3 is not being used as the controller? The I2C control lines whould be removed from the interface settings, presumably.
I know the first question has been asked before, but I could not find a concrete solution.
Solved! Go to Solution.
Please let me know if the following answer is not helpful in doing changes for your design:
The class specific descriptors in the USB descriptor file (cyfxuvcdscr.c) contain the information about the supported image resolution and frame rate. These class specific descriptors are a part of the USB device configuration descriptor that FX3 sends over to the host during enumeration process. There are two such configuration descriptors. CyFxUSBHSConfigDscr is reported when FX3 enumerates as a high speed device and CyFxUSBSSConfigDscr is reported when FX3 enumerates as a super speed device. Both of these descriptors follow the same format. The following shows the sub-descriptor tree:
1. Configuration Descriptor
a. Interface Association Descriptor
b. Video Control (VC) Interface Descriptor
i. VC Interface Header Descriptor
1. Input (Camera) Terminal Descriptor
2. Processing Unit Descriptor
3. Extention Unit Descriptor
4. Output Terminal Descriptor
a. VC status Interrupt Endpoint Descriptor
c. Video Streaming (VS) Interface Descriptor
i. VS Interface Input Header Descriptor
1. VS Format 1 Descriptor
a. VS Frame 1 Descriptor
d. Bulk-IN Video Endpoint Descriptor
The VS Input header descriptor describes how many different VS format descriptors follow it. The VS format descriptors hold information about the image format (uncompressed, mjpeg, mpeg, etc) supported. Each VS format descriptor is followed by VS frame descriptors. The VS frame descriptor holds information about one image resolution (width and height) and all the supported frame rates for that resolution. Hence, if a UVC device supports three image resolutions that transfer uncompressed images, there will be 1 VS format descriptor followed by three VS frame descriptors.
The AN example code supports one resolution/frame rate combination for each speed option (High Speed /Super Speed) where the image sensor streams uncompressed images. So, there is only one VS format descriptor followed by only one VS frame descriptor in a configuration descriptor. In the Super Speed configuration descriptor, the VS format descriptor reports a 16:9 image resolution ratio (bytes 23-24 of the VS format descriptor). The corresponding VS frame descriptor reports:
1. Image width as 1280 and height as 720 (bytes 5-8 of the VS frame descriptor).
2. Maximum image size in bytes (bytes 17-20 of the VS frame descriptor) – this should be greater than or equal to width * height * 2 (here 1280*720 * 2)
3. Frame interval in 100ns units (bytes 21-24, 26-29 of the VS frame descriptor) – this determines the frame rate.
This same information is exchanged between the UVC host and a UVC device during the streaming negotiation phase to select the active image resolution/frame rate combination. The UVC host sends video streaming requests of the type probe and commit during which glProbeCtrl structure is passed back and forth for USB3.0 (glProbeCtrl20 for USB2.0). To select a particular image resolution, the corresponding VS format descriptor index and VS frame descriptor index are passed in this structure (bytes 2-3 of the probe/commit structure). To select a particular frame rate, the frame interval value is passed (bytes 4-7 of the probe/commit structure). Maximum image size is also passed (bytes 18-21 of the probe/commit structure).
To change the image resolution:
1. The image width to height ratio in the VS format descriptor should be updated if necessary
2. The maximum image size in the VS format descriptor and the probe/commit structure should be updated if necessary
3. The width and height reported in the VS frame descriptor should be updated if necessary
To change the frame rate:
1. The frame interval value should be updated in the VS frame descriptor
2. The frame interval value should be updated in the probe/commit structure
Note: Sensor configuration should also reflect these changes.
Yes. You can remove I2C function calls in the FX3 firmware as you are using something else to configure Image sensor.