6 Replies Latest reply on Nov 29, 2018 3:39 AM by alamandaa_16

    FX3+MT9P031 at High speed, very small sized resolution only shows.

    DoLe_3354741

      Hi,

       

          I have a Cypress EZ-USB FX3 SuperSpeed Explorer Kit(CYUSB3KIT-003) and a connected MT9P031(monochrome is the target. currently I'm using the color version) image sensor only board for evaluation.   So, I modified UVC_AN75779 source.

       

      The problem is,

       

        Just very small sized resolution video shows on Microsoft GraphEdit(Even though the video color is broken for raw color value and non UVC standard), I'll develop additional DirectShow color converter filter.).

       

        I mean, in uvc.h source code, if CY_FX_UVC_STREAM_BUF_SIZE == 16KB(default), then 120x60 resolution is OK but more than the value just shows black screen.

       

      I tried doubled CY_FX_UVC_STREAM_BUF_SIZE == 32KB(by CY_FX_EP_BULK_VIDEO_PKTS_COUNT  0x10 -> 0x20, GPIF designer's Action Settings's Counter Limit value is 16367 -> 32751).   And then, just larger 120x120 resolution is OK.

       

      I think 120x60(=14.4KB with 16bit color is less than 16KB) for CY_FX_UVC_STREAM_BUF_SIZE == 16KB(default) and 120x120(=19.2KB is less than 32KB) for CY_FX_UVC_STREAM_BUF_SIZE == 32KB are the limited value.

       

      I checked mal-functioned(black screen) passing protocol by using a protocol analyzer( ellisys USB Explorer ).  I found that 'IN transaction is 512 byes unit and the number of IN transactions is sometimes the same count of resolution, but sometimes the number is  lack of the resolution count for a frame.   When the 120x60 with 16KB buffer is working well, the size of IN transactions in each frames is all the same.

       

      Please let me know what I have to fix.

       

      P.S.: Please refer to the attached image file that shows the wrong sized frame data count on USB protocol analyzer.

       

       

        • 1. Re: FX3+MT9P031 at High speed, very small sized resolution only shows.
          alamandaa_16

          Hi Don Lee,

          Please specify the following to find required bandwidth.

           

          A. Working Resolution:

           

              1. Resolution

              2. Bits per Pixel

              3. Frames per second

           

          B. Not working resolution:

           

               1.  Resolution

               2. Bits per Pixel

               3. Frames per second

           

          Based on the above values, we can calculate the frame size, number of buffers required for a single frame.

          Please provide the full USB trace for working and not working resolution for reference.

           

          Regards,

          Anil Srinivas.

          • 2. Re: FX3+MT9P031 at High speed, very small sized resolution only shows.
            DoLe_3354741

            Hi Anil,

             

            Thanks for your reply.

             

            I added the part of cyfxuvcdscr.c source below.

             

            Thanks,

             

            Don

            -----------------------

            A. Working Resolution:

             

                1. Resolution

                2. Bits per Pixel

                3. Frames per second

             

             

            0x7E, 0xEB, 0x36, 0xE4,           /*LDH MEDIASUBTYPE_RGB32 GUID: E436EB7E-524F-11CE-9F53-0020AF0BA770  */

            0x4F, 0x52, 0xCE, 0x11,

            0x9F, 0x53, 0x00, 0x20,

            0xAF, 0x0B, 0xA7, 0x70,

             

            0x10, //LDH 2 bytes  /* Number of bits per pixel used to specify color in the decoded video frame. 0 if not applicable: 16 bit per pixel */

            0x01, /* Optimum Frame Index for this stream: 1 */

            0x08, /* X dimension of the picture aspect ratio: Non-interlaced in progressive scan */

            0x06, /* Y dimension of the picture aspect ratio: Non-interlaced in progressive scan*/

            0x00, /* Interlace Flags: Progressive scanning, no interlace */

            0x00, /* duplication of the video stream restriction: 0 - no restriction */

             

            /* 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 */

            0x78, 0x00, //   /* Width in pixel: 120*/

            0x78, 0x00, //   /* Height in pixel 120*/

            0x00, 0x00, 0x94, 0x11, //LDH 640x480x4x30x8=294,912,000  /* Min bit rate bits/s. Not specified, taken from MJPEG */

            0x00, 0x00, 0x94, 0x11, //LDH  same above /* Max bit rate bits/s. Not specified, taken from MJPEG */

            0x00, 0xC0, 0x12, 0x00, //LDH 640x480x4=1,228,800  /* Maximum video or still frame size in bytes(Deprecated) */

            0x2A, 0x2C, 0x0A, 0x00, //0x15, 0x16, 0x05, 0x00, //LDH (in 100ns units): 666666   /* Default Frame Interval */

            0x01, /* Frame interval(Frame Rate) types: Only one frame interval supported */

            0x2A, 0x2C, 0x0A, 0x00, //LDH Frame interval: Same as Default frame interval /* Shortest Frame Interval */

            -----------------

             

            B. Not working resolution:

             

                 1.  Resolution

                 2. Bits per Pixel

                 3. Frames per second

             

            -> all is the same except for,

             

            0xA0, 0x00, //   /* Width in pixel: 120 -> 160*/

             

            ------------------------------------

             

            And, I also changed the MT9P031 register setting in sensor.c for each resolution. The folowing is for 120x120 that is working.

             

                ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, 0x03, 0x0077); // 0x78-1, (10) ROW_WINDOW_SIZE_REG

                ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, 0x04, 0x0077); // 0x78-1 (7) COL_WINDOW_SIZE_REG //LDH if 160 then 0xA0-1=9F

                ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, 0x08, 0x0000); // (6) SHUTTER_WIDTH_HI

                ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, 0x09, 0x01AC); // (6) INTEG_TIME_REG = From Developers Guide

             

                ret = SensorWriteAll_1B_Addr (SENSOR_ADDR_WR, 0xA0, 0x71); // Test monochrome Hor(0x61)/Vert(0x71) bars

            • 3. Re: FX3+MT9P031 at High speed, very small sized resolution only shows.
              DoLe_3354741

              Hello Anil,

               

              I'm in a hurry.   Please help !    I have already spent too much time for this issue.

               

              My question is why I can't get a standard screen resolution.   I have another hint for working/not working resolutions.  I got some debug messages.   Please refer to the following 2 cases.

               

              A. Working Resolution: Raw color display (120x120)

              Application Started

              UVC: Completed 0 frames and 0 buffers

              UVC: Completed 53 frames and 0 buffers

              UVC: Completed 106 frames and 0 buffers

              UVC: Completed 160 frames and 0 buffers

              UVC: Completed 213 frames and 0 buffers

              UVC: Completed 266 frames and 0 buffers

              UVC: Completed 320 frames and 0 buffers

              UVC: Completed 373 frames and 0 buffers

              UVC: Completed 426 frames and 0 buffers

              UVC: Completed 480 frames and 0 buffers

              UVC: Completed 533 frames and 0 buffers

              UVC: Completed 586 frames and 0 buffers

              UVC: Completed 640 frames and 0 buffers

              Clear feature request detected...

              Application Stopped

              UVC: Completed 0 frames and 0 buffers

               

               

              B. Not Working Resolution: Black Screen (160x120)

              Application Started

              UVC: Completed 0 frames and 0 buffers

              Backflow detected...

              UVC: Completed 50 frames and 1 buffers

              UVC: Completed 102 frames and 1 buffers

              UVC: Completed 154 frames and 0 buffers

              UVC: Completed 204 frames and 1 buffers

              UVC: Completed 256 frames and 1 buffers

              UVC: Completed 308 frames and 0 buffers

              UVC: Completed 358 frames and 1 buffers

              UVC: Completed 410 frames and 0 buffers

              UVC: Completed 462 frames and 0 buffers

              UVC: Completed 512 frames and 1 buffers

              UVC: Completed 564 frames and 0 buffers

              UVC: Completed 616 frames and 0 buffers

              Clear feature request detected...

              Application Stopped

              UVC: Completed 0 frames and 0 buffers

              • 4. Re: FX3+MT9P031 at High speed, very small sized resolution only shows.
                alamandaa_16

                Hello Don Lee,

                 

                -Please try the following steps:

                1. Change 0x00,0x96,0x090,0x00,    /* Maximum video or still frame size in bytes(120x160x2=38400)*/ in UVC descriptor(Class specific Uncompressed VS Frame descriptor).

                2.the DMA buffer size to 2* 1024 bytes and DMA buffer count to 2 while creating the DMA channel using CyU3PDmaMultiChannelCreate API.

                3.Change the 0xF0, 0x70, 0x00, 0x00,      /* No. of bytes device can rx in single payload = 2*1024 */ in probe control structures.

                4.Change GPIF counter LD_DATA_COUNT = LD_ADDR_COUNT = ((2*1024 -12-4)/2) -1 = 1015.

                 

                 

                --The Backflow(overrun & underrun error)error comes, when the DMA buffers get filled and the GPIF is still trying to write the data. If the host is reading the data slower than the data being written at the GPIF interface, then the DMA buffers will get filled and give this Backflow(overrun & underrun error).

                 

                Regards,

                Anil Srinivas.

                • 5. Re: FX3+MT9P031 at High speed, very small sized resolution only shows.
                  DoLe_3354741

                  Hello Anil,

                   

                  Thanks for your detailed description.

                   

                  But, your setting didn't work.  Please refer to the followings.

                  • 6. Re: FX3+MT9P031 at High speed, very small sized resolution only shows.
                    alamandaa_16

                    Hello Don Lee,

                     

                    --I didn't see any attached file from your previous response. Please share previous response here.

                     

                    Regards,

                    Anil Srinivas.