3 Replies Latest reply on Aug 26, 2018 12:51 AM by abhinavg_21

    UVC + VS_FRAME_UNCOMPRESSED

      Hello!

      I want to implement UVC using FX3 (trying on SuperSpeed Kit). There is no problem with UVC examples from SDK, but I have no luck to modify USBVideoClass example to work with uncompressed frames. I've downloaded specs from USB.org - USB Device Class Specifications and changed format and frame descriptors as described. I've also changed Probe and Commit control structs.

       

      Is there any example of FRAME_UNCOMPRESSED video translation?

      v4l2-ctl output:

      v4l2-ctl --all -d0

      Driver Info (not using libv4l2):

      Driver name   : uvcvideo

      Card type     : FX3

      Bus info      : usb-0000:00:14.0-5

      Driver version: 4.15.18

      Capabilities  : 0x84200001

      Video Capture

      Streaming

      Extended Pix Format

      Device Capabilities

      Device Caps   : 0x04200001

      Video Capture

      Streaming

      Extended Pix Format

      Priority: 2

      Video input : 0 (Camera 1: ok)

      Format Video Capture:

      Width/Height      : 32/24

      Pixel Format      : 'BGR3'

      Field             : None

      Bytes per Line    : 96

      Size Image        : 2304

      Colorspace        : Default

      Transfer Function : Default (maps to Rec. 709)

      YCbCr/HSV Encoding: Default (maps to ITU-R 601)

      Quantization      : Default (maps to Full Range)

      Flags             :

      Crop Capability Video Capture:

      Bounds      : Left 0, Top 0, Width 32, Height 24

      Default     : Left 0, Top 0, Width 32, Height 24

      Pixel Aspect: 1/1

      Selection: crop_default, Left 0, Top 0, Width 32, Height 24

      Selection: crop_bounds, Left 0, Top 0, Width 32, Height 24

      Streaming Parameters Video Capture:

      Capabilities     : timeperframe

      Frames per second: 25.000 (25/1)

      Read buffers     : 0

       

      I'm using guvcview utility to check results. And here is the log:

      ...

      V4L2_CORE: (get_v4l2_frame) video stream must be started first

      V4L2_CORE: (get_v4l2_frame) video stream must be started first

      V4L2_CORE: (get_v4l2_frame) video stream must be started first

      V4L2_CORE: (get_v4l2_frame) video stream must be started first

      ...

       

      lsusb output:

      Bus 001 Device 047: ID 04b4:4722 Cypress Semiconductor Corp.

      Device Descriptor:

        bLength                18

        bDescriptorType         1

        bcdUSB               2.10

        bDeviceClass          239 Miscellaneous Device

        bDeviceSubClass         2 ?

        bDeviceProtocol         1 Interface Association

        bMaxPacketSize0        64

        idVendor           0x04b4 Cypress Semiconductor Corp.

        idProduct          0x4722

        bcdDevice            0.00

        iManufacturer           1 Cypress

        iProduct                2 FX3

        iSerial                 0

        bNumConfigurations      1

        Configuration Descriptor:

          bLength                 9

          bDescriptorType         2

          wTotalLength          198

          bNumInterfaces          2

          bConfigurationValue     1

          iConfiguration          0

          bmAttributes         0x80

            (Bus Powered)

          MaxPower              400mA

          Interface Association:

            bLength                 8

            bDescriptorType        11

            bFirstInterface         0

            bInterfaceCount         2

            bFunctionClass         14 Video

            bFunctionSubClass       3 Video Interface Collection

            bFunctionProtocol       0

            iFunction               0

          Interface Descriptor:

            bLength                 9

            bDescriptorType         4

            bInterfaceNumber        0

            bAlternateSetting       0

            bNumEndpoints           1

            bInterfaceClass        14 Video

            bInterfaceSubClass      1 Video Control

            bInterfaceProtocol      0

            iInterface              0

            VideoControl Interface Descriptor:

              bLength                13

              bDescriptorType        36

              bDescriptorSubtype      1 (HEADER)

              bcdUVC               1.00

              wTotalLength           80

              dwClockFrequency       48.000000MHz

              bInCollection           1

              baInterfaceNr( 0)       1

            VideoControl Interface Descriptor:

              bLength                18

              bDescriptorType        36

              bDescriptorSubtype      2 (INPUT_TERMINAL)

              bTerminalID             1

              wTerminalType      0x0201 Camera Sensor

              bAssocTerminal          0

              iTerminal               0

              wObjectiveFocalLengthMin      0

              wObjectiveFocalLengthMax      0

              wOcularFocalLength            0

              bControlSize                  3

              bmControls           0x00000000

            VideoControl Interface Descriptor:

              bLength                12

              bDescriptorType        36

              bDescriptorSubtype      5 (PROCESSING_UNIT)

            Warning: Descriptor too short

              bUnitID                 2

              bSourceID               1

              wMaxMultiplier      16384

              bControlSize            3

              bmControls     0x00000000

              iProcessing             0

              bmVideoStandards     0x1c

                PAL - 625/50

                SECAM - 625/50

                NTSC - 625/50

            VideoControl Interface Descriptor:

              bLength                28

              bDescriptorType        36

              bDescriptorSubtype      6 (EXTENSION_UNIT)

              bUnitID                 3

              guidExtensionCode         {ffffffff-ffff-ffff-ffff-ffffffffffff}

              bNumControl             0

              bNrPins                 1

              baSourceID( 0)          2

              bControlSize            3

              bmControls( 0)       0x00

              bmControls( 1)       0x00

              bmControls( 2)       0x00

              iExtension              0

            VideoControl Interface Descriptor:

              bLength                 9

              bDescriptorType        36

              bDescriptorSubtype      3 (OUTPUT_TERMINAL)

              bTerminalID             4

              wTerminalType      0x0101 USB Streaming

              bAssocTerminal          0

              bSourceID               3

              iTerminal               0

            Endpoint Descriptor:

              bLength                 7

              bDescriptorType         5

              bEndpointAddress     0x82  EP 2 IN

              bmAttributes            3

                Transfer Type            Interrupt

                Synch Type               None

                Usage Type               Data

              wMaxPacketSize     0x0040  1x 64 bytes

              bInterval               8

          Interface Descriptor:

            bLength                 9

            bDescriptorType         4

            bInterfaceNumber        1

            bAlternateSetting       0

            bNumEndpoints           0

            bInterfaceClass        14 Video

            bInterfaceSubClass      2 Video Streaming

            bInterfaceProtocol      0

            iInterface              0

            VideoStreaming Interface Descriptor:

              bLength                            14

              bDescriptorType                    36

              bDescriptorSubtype                  1 (INPUT_HEADER)

              bNumFormats                         1

              wTotalLength                       71

              bEndPointAddress                  131

              bmInfo                              0

              bTerminalLink                       4

              bStillCaptureMethod                 1

              bTriggerSupport                     1

              bTriggerUsage                       0

              bControlSize                        1

              bmaControls( 0)                    27

            VideoStreaming Interface Descriptor:

              bLength                            27

              bDescriptorType                    36

              bDescriptorSubtype                  4 (FORMAT_UNCOMPRESSED)

              bFormatIndex                        1

              bNumFrameDescriptors                1

              guidFormat                            {7deb36e4-4f52-ce11-9f53-0020af0ba770}

              bBitsPerPixel                      24

              bDefaultFrameIndex                  1

              bAspectRatioX                       0

              bAspectRatioY                       0

              bmInterlaceFlags                 0x00

                Interlaced stream or variable: No

                Fields per frame: 2 fields

                Field 1 first: No

                Field pattern: Field 1 only

                bCopyProtect                      0

            VideoStreaming Interface Descriptor:

              bLength                            30

              bDescriptorType                    36

              bDescriptorSubtype                  5 (FRAME_UNCOMPRESSED)

              bFrameIndex                         1

              bmCapabilities                   0x00

                Still image unsupported

              wWidth                             32

              wHeight                            24

              dwMinBitRate                   460800

              dwMaxBitRate                   921600

              dwMaxVideoFrameBufferSize        2304

              dwDefaultFrameInterval         400000

              bFrameIntervalType                  1

              dwFrameInterval( 0)            400000

      Binary Object Store Descriptor:

        bLength                 5

        bDescriptorType        15

        wTotalLength           22

        bNumDeviceCaps          2

        USB 2.0 Extension Device Capability:

          bLength                 7

          bDescriptorType        16

          bDevCapabilityType      2

          bmAttributes   0x00000002

            Link Power Management (LPM) Supported

        SuperSpeed USB Device Capability:

          bLength                10

          bDescriptorType        16

          bDevCapabilityType      3

          bmAttributes         0x00

          wSpeedsSupported   0x000e

            Device can operate at Full Speed (12Mbps)

            Device can operate at High Speed (480Mbps)

            Device can operate at SuperSpeed (5Gbps)

          bFunctionalitySupport   3

            Lowest fully-functional device speed is SuperSpeed (5Gbps)

          bU1DevExitLat           0 micro seconds

          bU2DevExitLat           0 micro seconds

      Device Status:     0x0000

        (Bus Powered)

        • 1. Re: UVC + VS_FRAME_UNCOMPRESSED
          abhinavg_21

          Hi,

           

          The UVC example from SDK uses a pre-stored MJPEG video frames. I guess you want to stream the video frames from an image sensor. Please make certain changes in the AN 75779. This AN makes use of sensor configuration and stream image live from the sensor.

           

          Following is the link to download AN and its code:

          http://www.cypress.com/documentation/application-notes/an75779-how-implement-image-sensor-interface-using-ez-usb-fx3-usb

           

          Thanks & Regards

           

           

          Abhinav

          1 of 1 people found this helpful
          • 2. Re: UVC + VS_FRAME_UNCOMPRESSED

            Thank you for very useful example! My descriptors are very similar to one from AN 75779. And I can't see any error in mine.

            Here is dmesg output with uvcvideo debug enabled:

             

             

            [1635852.910451] usb 1-1: new high-speed USB device number 60 using xhci_hcd
            [1635853.059635] usb 1-1: New USB device found, idVendor=04b4, idProduct=4722
            [1635853.059641] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
            [1635853.059645] usb 1-1: Product: FX3
            [1635853.059649] usb 1-1: Manufacturer: Cypress
            [1635853.060257] uvcvideo: Probing generic UVC device 1
            [1635853.060265] uvcvideo: Found format BGR 8:8:8 (BGR3).
            [1635853.060268] uvcvideo: - 32x24 (25.0 fps)
            [1635853.060278] uvcvideo: Found a Status endpoint (addr 82).
            [1635853.060281] uvcvideo: Found UVC 1.00 device FX3 (04b4:4722)
            [1635853.060286] uvcvideo: Scanning UVC chain: OT 4 <- XU 3 <- PU 2 <- IT 1
            [1635853.060297] uvcvideo: Found a valid video chain (1 -> 4).
            [1635853.060805] uvcvideo 1-1:1.0: Entity type for entity Extension 3 was not initialized!
            [1635853.060810] uvcvideo 1-1:1.0: Entity type for entity Processing 2 was not initialized!
            [1635853.060814] uvcvideo 1-1:1.0: Entity type for entity Camera 1 was not initialized!
            [1635853.060995] input: FX3 as /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/input/input86
            [1635853.061142] uvcvideo: UVC device initialized.
            [1635853.121282] uvcvideo: uvc_v4l2_open
            [1635853.121333] uvcvideo: uvc_v4l2_release
            [1635853.123896] uvcvideo: uvc_v4l2_open
            [1635853.123905] uvcvideo: uvc_v4l2_release
            [1635853.124058] uvcvideo: uvc_v4l2_open
            [1635853.124063] uvcvideo: Control 0x00980900 not found.
            [1635853.124064] uvcvideo: Control 0x00980901 not found.
            [1635853.124065] uvcvideo: Control 0x00980902 not found.
            [1635853.124065] uvcvideo: Control 0x00980903 not found.
            ...
            [1635853.124087] uvcvideo: Control 0x00980928 not found.
            [1635853.124087] uvcvideo: Control 0x00980929 not found.
            [1635853.124088] uvcvideo: Control 0x0098092a not found.
            [1635853.124088] uvcvideo: Control 0x08000000 not found.
            [1635853.124089] uvcvideo: uvc_v4l2_release
            [1635853.124657] uvcvideo: uvc_v4l2_open
            [1635853.124664] uvcvideo: uvc_v4l2_release
            [1635858.910488] uvcvideo: Suspending interface 1
            [1635858.910491] uvcvideo: Suspending interface 0
            [1635903.112139] uvcvideo: uvc_v4l2_open
            [1635903.226947] uvcvideo: Resuming interface 0
            [1635903.226950] uvcvideo: Resuming interface 1
            [1635903.227933] uvcvideo: uvc_v4l2_release
            [1635903.228683] uvcvideo: uvc_v4l2_open
            [1635903.229727] uvcvideo: Control 0x00980900 not found.
            [1635903.229732] uvcvideo: Control 0x00980901 not found.
            [1635903.229735] uvcvideo: Control 0x00980902 not found.
            [1635903.229739] uvcvideo: Control 0x00980903 not found.
            ...
            [1635903.229969] uvcvideo: Control 0x009a091d not found.
            [1635903.229972] uvcvideo: Control 0x009a091e not found.
            [1635903.229976] uvcvideo: Control 0x009a091f not found.
            [1635903.229979] uvcvideo: Control 0x08000000 not found.
            [1635903.389051] uvcvideo: Trying format 0x33524742 (BGR3): 32x24.
            [1635903.389052] uvcvideo: Using default frame interval 40000.0 us (25.0 fps).
            [1635903.389671] uvcvideo: uvc_v4l2_mmap
            [1635903.389674] uvcvideo: uvc_v4l2_mmap
            [1635903.389676] uvcvideo: uvc_v4l2_mmap
            [1635903.389678] uvcvideo: uvc_v4l2_mmap
            [1635903.389684] uvcvideo: Setting frame interval to 1/25 (400000).
            [1635903.909757] uvcvideo: Setting frame interval to 1/25 (400000).
            [1635908.931445] uvcvideo: uvc_v4l2_release
            [1635910.934850] uvcvideo: Suspending interface 1
            [1635910.934853] uvcvideo: Suspending interface 0

             

            Could you tell what is going wrong with my firmware?

            • 3. Re: UVC + VS_FRAME_UNCOMPRESSED
              abhinavg_21

              Hi,

               

              Please try to stream the video using example firmware that comes along with the FX3SDK "C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\uvc_examples\cyfxuvcinmem" and share the the result.

               

              Have you installed the "v4l2_utils" on the PC?

              If still its not working try to change descriptors in AN75779 according to your image sensor & video requirement.

               

              Thanks & Regards

              Abhinav