3 Replies Latest reply on Oct 9, 2019 8:02 AM by BoJo_4384951

    Use FX3 as UVC camera based on AN75779

    BoJo_4384951

      Hello guys,

       

      We would like to use FX3 module to help us transfer video streams from our IMX253 camera to the host PC, as we described in this thread.

      Shortly, the image size as well as the frames per second, bits per pixel and the width of DataBus differ from what we can find in AN75779 document.

       

      RashiV_61 suggested to implement some more changes that I could find in AN75779 document (changes of glProbeCtrl[CY_FX_UVC_MAX_PROBE_SETTING] settings withing uvc.c file). We implemented all those changes but there was no success!

       

      Let me take a deeeeeep breath and explain you one more time what we did on our side, kindly asking you to let us know if we missed something:

       

      Let's say that we have the following parameters:

      Image size:               2504 x 1502 pixels

      fps:                           21.48376241501965

      Bits per pixel:           16

      Color format:            YUV2

      DataBus width:         16 (DQ[15:0])

       

      We did the following modifications:

       

      1) New GPIF II Designer project is created. The width of Databus is set to 16-bits and the limit value of LD_ADDR_COUNT and LD_DATA_COUNT counters to 8183. Consequently, new cyfxgpif2config.h header file is generated.

       

      2) A copy of EZ USB UVC_AN75779 project is created and cyfxgpif2config.h header file replaced. The firmware example is downloaded from here (version of the firmware from 10/30/2017).

       

      a) in uvc.c file

      io_cfg.isDQ32Bit    = CyFalse;

      to the best of my understanding, this parameter should be set to TRUE only if Databus width is equal to 32-bits. Am I wrong?

       

      b) We also changed the info about image size, fps and bit rate of the Super Speed Configuration descriptor in:

          /* Class specific Uncompressed VS frame descriptor */
          0x1E,                       /* Descriptor size */
          0x24,                       /* Descriptor type*/
          0x05,                       /* Subtype: uncompressed frame I/F */
          0x01,                       /* Frame Descriptor Index */
          0x01,                       /* Still image capture method 1 supported */
          0x06, 0x08,                 /* Width in pixel - 2054*/ /* Changed ! Was 1280*/
          0xDE, 0x05,                 /* Height in pixel - 1502*/  /* Changed ! Was 720*/
          0xF5,0x92,0x35,0x3F,        /* Min bit rate bits/s. - 2054 x 1502 x 21.48376241501965fps x 16-bits per pixel */ /* Changed */
          0xF5,0x92,0x35,0x3F,        /* Max bit rate bits/s. - 2054 x 1502 x 21.48376241501965fps x 16-bits per pixel */ /* Changed */
          0x00,0xA4,0x1F,0x00,        /* Maximum video or still frame size in bytes(Deprecated)*/
          0x3B, 0x1A, 0x07, 0x00,     /* Desired frame interval in the unit of 100ns: 21.48376241501965 fps */ /* Changed! was 30fps*/
          0x01,
          0x15,0x16,0x05,0x00,/* Not sure what is the meaning of this field !?*/ /* Frame interval 3: Same as Default frame interval */

       

      I did not touch the deprecated /* Maximum video or still frame size in bytes (Deprecated) */ field. Should I change it?

      Also, I don't know what is the meaning of the last field in the descriptor. The guy in this thread says this is /* Frame interval 3: Same as Default frame interval */ and that it should be equal to Default frame interval. Should I change this field somehow?

       

      c) According to suggestions from RashiV_61, in uvc.c file we updated the fields of glProbeCtrl[CY_FX_UVC_MAX_PROBE_SETTINGS] settings:

       

      0x00, 0x00,             /* bmHint : no hit */
      0x01,                   /* Use 1st Video format index */
      0x01,                   /* Use 1st Video frame index */
      0x3B, 0x1A, 0x07, 0x00,     /* Desired frame interval in the unit of 100ns: 21.48376241501965 fps */ /* Changed */
      0x00, 0x00,             /* Key frame rate in key frame/video frame units: only applicableto video streaming with adjustable compression parameters */
      0x00, 0x00,             /* PFrame rate in PFrame / key frame units: only applicable to video streaming with adjustable compression parameters */
      0x00, 0x00,             /* Compression quality control: only applicable to video streaming with adjustable compression parameters */
      0x00, 0x00,             /* Window size for average bit rate: only applicable to video streaming with adjustable compression parameters */
      0x00, 0x00,             /* Internal video streaming i/f latency in ms */
      0x68, 0x26, 0x5E, 0x00, /* Max video frame size in bytes - 2054 x 1502 x 2Bytes per pixel*/ /* Changed */
      0x00, 0x40, 0x00, 0x00,  /* No. of bytes device can rx in single payload = 16 KB */

       

      What we changed here is Max video frame size in bytes and Desired frame interval.

       

      Is there anything else we are missing here, guys?

       

      We are using custom-made board with FX3 on it. The only accessible interface for debugging is JTAG interface. Can we use JTAG interface to debug FX3 and see what is going on inside?

       

      Thanks for your time and effort.

      Sincerely,

      Bojan.

        • 1. Re: Use FX3 as UVC camera based on AN75779
          BoJo_4384951

          One note to add... since we have FPGA logic between IMX253 and FX3, we are able to set the duration of the pause between lines/frames of the IMX253 sensor. Is there any constraint about the duration of the pause between two lines in a frame (pause between LV active) that is imposed by FX3 ?

          • 2. Re: Use FX3 as UVC camera based on AN75779
            RashiV_61

            Hello Bojan,

             

            You can refer to this KBA Change Resolution in FX3 UVC Camera - KBA220269

             

            - You can directly build cyfxgpif2config.h to the path of the project by changing the path in build settings (refer attachment).

             

            - Your understanding about io_cfg.isDQ32Bit   = CyFalse; is right.

             

            The width of Databus is set to 16-bits and the limit value of LD_ADDR_COUNT and LD_DATA_COUNT counters to 8183.

            - This setting is correct

             

            I did not touch the deprecated /* Maximum video or still frame size in bytes (Deprecated) */ field. Should I change it?

            - Maximum video or still frame size in bytes : 2054*1502*2 bytes

             

            Also, I don't know what is the meaning of the last field in the descriptor. The guy in this thread says this is /* Frame interval 3: Same as Default frame interval */ and that it should be equal to Default frame interval. Should I change this field somehow?

            - Keep it same as

            0x3B, 0x1A, 0x07, 0x00,    /* Desired frame interval in the unit of 100ns: 21.48376241501965 fps

             

            - I would suggest to keep the frames/second an integer value (either 21 or 22 fps)

             

            - The glProbeCtrl[CY_FX_UVC_MAX_PROBE_SETTINGS]  seems fine.

             

            - The GUID in the default firmware is for YUV2 format. Please confirm you have kept the same.

             

            - If FRAME_TIMER_ENABLE is defined in the firmware, the timer would be set for 200ms (superspeed) and 400ms (High speed/ full speed). If time between the two frames is more than this there will be timeout and CY_FX_UVC_DMA_RESET_FRAME_TIMER_OVERFLOW event would be set.

             

            -Also, if you would change the blanking period, H_Blanking (time between LV) and V_Blanking (time between FV), it would change the fps set in the descriptors and the probe control settings.

             

            - Please confirm that FX3 is enumerated as UVC device in the Device manager.

             

            - If after these settings, this doesn't work please probe the FV, LV and PCLK and share the traces. Also enable the DEBUG_PRINT_FRAME_COUNT and share the debug prints so that we can know the error.

             

            - You can use JTAG debugger. Please refer to Chapter 3  of EzUSBSUITE_UG user guide (  ..\Cypress\EZ-USB FX3 SDK\1.3\doc\firmware)

             

            Regards,

            Rashi

             

             

             

             

            • 3. Re: Use FX3 as UVC camera based on AN75779
              BoJo_4384951

              Hi RashiV_61,

               

              Just wanted to let you know that we were able to play the stream on the host PC!

               

              It turned that all the changes we made according to your suggestions were OK (I even left 21.48376241501965 for fps parameter) but the problem was with the player!? We first used VirtualDub and there were no success. After that we switched to VLC player and ... bingo!

               

              We also noticed some freezes and latency in video stream while playing from my laptop. I switched to my newer desktop computer and the freeze in video disappeared.

               

              Thanks for the useful info about JTAG debugging. We will now try to implement the control of the sensor through FX2 I2C interface and we will certainly need JTAG debugging!

               

              Thank you very much for your great support!

               

              Cheers,

              Bojan.