1 2 Previous Next 16 Replies Latest reply on Jun 21, 2018 5:21 AM by thepthep88_2970436

    Problem of CX3_ UVC USB 2.0

    thepthep88_2970436

      Hi

       

      I am developing  Denebola with OVM7251 Camera module.

       

      I already test streaming with Superspeed USB connection. (VGA / 100,60,30 FPS)

       

      but I can't use it in Highspeed. (VGA / 30FPS)

       

      Uart output below

       

      Prod = 11 Cons = 10  Prtl_Sz = 7184 Frm_Cnt = 25 Frm_Sz = 412160 B

      Prod = 11 Cons = 10  Prtl_Sz = 7184 Frm_Cnt = 26 Frm_Sz = 412160 B

      Prod = 11 Cons = 10  Prtl_Sz = 7184 Frm_Cnt = 27 Frm_Sz = 412160 B

      Prod = 11 Cons = 10  Prtl_Sz = 7184 Frm_Cnt = 28 Frm_Sz = 412160 B

      Prod = 11 Cons = 10  Prtl_Sz = 7184 Frm_Cnt = 29 Frm_Sz = 412160 B

      Prod = 11 Cons = 10  Prtl_Sz = 7184 Frm_Cnt = 30 Frm_Sz = 412160 B

      TimeDiff = 991 ms FPS = 30

       

      Mipi config is below

       

         CY_U3P_CSI_DF_RAW10,  /* CyU3PMipicsiDataFormat_t dataFormat */

          1,                          /* uint8_t numDataLanes */

          1, /* uint8_t pllPrd */

          90, /* uint16_t pllFbd */

          CY_U3P_CSI_PLL_FRS_125_250M, /* CyU3PMipicsiPllClkFrs_t pllFrs */

          CY_U3P_CSI_PLL_CLK_DIV_2, /* CyU3PMipicsiPllClkDiv_t csiRxClkDiv */

          CY_U3P_CSI_PLL_CLK_DIV_8, /* CyU3PMipicsiPllClkDiv_t parClkDiv */

          0,                 /* uint16_t mClkCtl */

          CY_U3P_CSI_PLL_CLK_DIV_2, /* CyU3PMipicsiPllClkDiv_t mClkRefDiv */

          640,         /* uint16_t hResolution */

          1                         /* uint16_t fifoDelay */

       

       

      I try change mipi config, but Frm sz did not reach to 614400 B

       

      How can i fix it?

        • 1. Re: Problem of CX3_ UVC USB 2.0
          keaj

          Hi,

           

          What is the video format that the sensor is configured to? Is it RAW10? Can you please share the screenshot of the MIPI configuration tool?

           

          Is it possible for you to probe the HSYNC_test & VSYNC_test pins and share the screenshot? It will be good if you can measure the HSYNC active, HSYNC blanking , VSYNC active and VSYNC blanking time and share the values here.

          • 2. Re: Problem of CX3_ UVC USB 2.0
            srdr

            You have mentioned two issues here.

            1. VGA 30 fps is not streaming in USB 2.0

            2. When you change the MIPI Configuration, the Frame Size is not reaching 614400

             

            1. VGA 30 fps is not streaming in USB 2.0

             

            If the frame format is YUY2, the required bandwidth = 640* 480 * 2 * 30 = 18.5 MB (Approximately). This is supposed to stream by the CX3 in USB 2.0 mode.

            And the Frame Size will be 640 * 480*2 = 614400 Bytes.

             

            Check the following:

                 a. Whether the enuemration is fine in USB 2.0. If not, cross check the USB 2.0 descriptors

                 b. Check the Probe Control Setting for High-Speed

                 c. Check whether you are handilng the Probe and Commit control request properly

                 d. Check whether there is a data flow in USB 2.0 mode.

                      - Put a flag in the Producer Event of DMA Callback and check it in Infinite for loop of UVC App thread then clear it off

             

            2. When you change the MIPI Configuration, the Frame Size is not reaching 614400

                 a. Is this a new requirement (other than VGA, 30,60,100 FPS in Super-speed mode)?

                         - What is your requirement here, Frame Format, Resolution, FPS and bytes/pixel ?

                 b. What is the frame size that you are getting instead of 614400

                 c. Have you configured the Image sensor for this configuration

                 d. Have you configured the MIPI for this configuration?

                      - Share the MIPI configuration screen shots for this configuration

                  e. Check the 1.a, 1.b, 1.c, and 1.d in super-speed/ High-speed mode for the new configuration

            • 3. Re: Problem of CX3_ UVC USB 2.0
              thepthep88_2970436

              Sensor format is RAW10

              and it works well in USB SSmode with 30FPS and 100FPS

               

              SSmode  VGA 100FPS configuration is below

              HSmode VGA 30FPS configuation is below

              • 4. Re: Problem of CX3_ UVC USB 2.0
                thepthep88_2970436

                Sensor and CX3 works fine with USB SS mode

                and SS mode debug output  is below

                 

                Prod = 16 Cons = 16  Prtl_Sz = 25344 Frm_Cnt = 147 Frm_Sz = 614400 B

                Prod = 16 Cons = 16  Prtl_Sz = 25344 Frm_Cnt = 148 Frm_Sz = 614400 B

                Prod = 16 Cons = 16  Prtl_Sz = 25344 Frm_Cnt = 149 Frm_Sz = 614400 B

                Prod = 16 Cons = 16  Prtl_Sz = 25344 Frm_Cnt = 150 Frm_Sz = 614400 B

                TimeDiff = 309 ms FPS = 97

                 

                1.a :  I think usb2.0 descriptors are fine

                1.b :  where can i find probe control setting?

                 

                2.a: I want to run this sensor with USB HSmode 30fps and 60fps

                2.b : I want to get 614400 B frame size but i can't

                2.c :  It works well in SSmode and i attach mipi config

                • 5. Re: Problem of CX3_ UVC USB 2.0
                  srdr

                  Refer glVga30ProbeCtrl_HS in cycx3_uvc.c of  Cx3UvcOV5640 provided in the following path of FX3 SDK: C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\cx3_examples\cycx3_uvc_ov5640

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

                  /* UVC Probe Control Setting - VGA @30fps (High Speed)*/

                  uint8_t const glVga30ProbeCtrl_HS[CX3_APP_MAX_PROBE_SETTING] = {

                      0x00, 0x00,                         /* bmHint : No fixed parameters */

                      0x01,                               /* Use 1st Video format index */

                      0x01,                               /* Use 1st Video frame index */

                      0x15, 0x16, 0x05, 0x00,             /* Desired frame interval in 100ns = (1/60)x10^7 */

                      0x00, 0x00,                         /* Key frame rate in key frame/video frame units */

                      0x00, 0x00,                         /* PFrame rate in PFrame / key frame units */

                      0x00, 0x00,                         /* Compression quality control */

                      0x00, 0x00,                         /* Window size for average bit rate */

                      0x00, 0x00,                         /* Internal video streaming i/f latency in ms */

                      0x00, 0x60, 0x09, 0x00,             /* Max video frame size in bytes: 640 x 480 x 2*/

                  #ifdef CX3_UVC_1_0_SUPPORT

                      0x00, 0x90, 0x00, 0x00              /* No. of bytes device can rx in single payload: 36KB - This is a DMA buffer size inclusing header and footer */

                  #else

                      /* UVC 1.1 Probe Control has additional fields from UVC 1.0 */

                      0x00, 0x90, 0x00, 0x00,             /* No. of bytes device can rx in single payload: 36KB - This is a DMA buffer size inclusing header and footer */

                      0x00, 0x60, 0xE3, 0x16,             /* Device Clock */

                      0x00,                               /* Framing Information - Ignored for uncompressed format*/

                      0x00,                               /* Preferred payload format version */

                      0x00,                               /* Minimum payload format version */

                      0x00                                /* Maximum payload format version */

                  #endif

                  };

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

                  In your case, the data is in RAW10 format, the GPIF is being configured with 16-bit. Hence, you will be receiving additional 6 bits per every pixel. This results 614400 bytes per frame.

                   

                  In this case, you have to remove 6 additional bits per every pixel in the host application.

                   

                  As per the screen shots posted by you, looks like you are using the older version of the configuration tool.

                  Can you please update the tool by installing the plug In " Update to CX3 Configuration Eclipse Plug-ins" provided in this path: http://www.cypress.com/documentation/software-and-drivers/ez-usb-fx3-software-development-kit

                   

                  Then configure the MIPI with the updated configuration tool.

                   

                  Note that the newer configuration does not allow to set the output format as RAW 10. It only allows you to set 16 bit or 24 bit output format.

                  In this case, the input RAW10 per pixel will be packed into GPIF 16-bit format as follows.

                  ......................................................................................................................................................................................................................................

                  The MIPI bridge will receive RAW 10 in the following format as per the MIPI CSI-2 Spec.

                  RAW10_Format.PNG

                  The CX3 MIPI will convert the FIRST 16 serial bits into parallel 16 bits. It does not bother about the data sequence.

                   

                  So, the GPIF will receive these first 16-bit in the RAW 10 format.

                   

                  i.e First clock cycle - P1[9:2] P2[9:2]

                  Second clock cycle - P3[9:2], P4[9:2];

                  Third clock cycle - P1[1:0], P2[1:0], P3[1:0], P4[1:0]; P5[9:2]

                  Fourth cycle - continue

                   

                  If you select output data format as 24-bit, the RAW10 to 24-bit packing will be done as follows:

                   

                  The CX3 MIPI will convert the FIRST 24 serial bits into parallel 24 bits. It does not bother about the data sequence.

                  So, the GPIF will receive these first 24-bit in the RAW 10 format.

                   

                  i.e First clock cycle - P1[9:2] P2[9:2] P3[9:2]

                  Second clock cycle - P4[9:2]; P1[1:0], P2[1:0], P3[1:0], P4[1:0]; P5[9:2]

                  Third clock cycle - continue

                   

                  Regards,

                  Sridhar

                  • 6. Re: Problem of CX3_ UVC USB 2.0
                    thepthep88_2970436

                    My Ez USB Suite version 1.3.3 and I update you linked. But configuration screen same as before.

                     

                    And my probe control setting is same as you attached.

                     

                    Where can i change mipi configuration setting screen?

                     

                    when I increase Multiplier of Unit Clk, Frame size is increase. but it can't reach 614400B

                     

                    Prod = 13 Cons = 10  Prtl_Sz = 16752 Frm_Cnt = 329 Frm_Sz = 495360 B

                    Prod = 13 Cons = 10  Prtl_Sz = 16752 Frm_Cnt = 330 Frm_Sz = 495360 B

                    TimeDiff = 968 ms FPS = 30

                     

                    Also i try to increase out of range

                    Debug port display

                    CB failure

                    CB failure

                    CB failure

                    CB failure

                    • 7. Re: Problem of CX3_ UVC USB 2.0
                      srdr

                      I have set the Output data format to 24 bit and obtain the following MIPI Configuration tool. Can you use this configuration and check the data flow.

                       

                      /* VGA_RAW10_VGA_30f :  */

                      CyU3PMipicsiCfg_t VGA_RAW10_VGA_30f = 

                      {

                          CY_U3P_CSI_DF_RGB888,  /* CyU3PMipicsiDataFormat_t dataFormat */

                          2,                          /* uint8_t numDataLanes */

                          2, /* uint8_t pllPrd */

                          89, /* uint16_t pllFbd */

                          CY_U3P_CSI_PLL_FRS_250_500M, /* CyU3PMipicsiPllClkFrs_t pllFrs */ 

                          CY_U3P_CSI_PLL_CLK_DIV_4, /* CyU3PMipicsiPllClkDiv_t csiRxClkDiv */

                          CY_U3P_CSI_PLL_CLK_DIV_4, /* CyU3PMipicsiPllClkDiv_t parClkDiv */

                          0,                 /* uint16_t mClkCtl */

                          CY_U3P_CSI_PLL_CLK_DIV_2, /* CyU3PMipicsiPllClkDiv_t mClkRefDiv */

                          640,         /* uint16_t hResolution */

                          150                         /* uint16_t fifoDelay */

                      };

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

                      Have you probed the test pins: HSYNC, VSYNC, and PCLCK. If not, please probe them and share the values here.

                       

                      As per the debug prints, you are receiving the Commitbuffer failures. What is the error code?

                      Let me know where exactly you are printing in the firmware?

                       

                      Also share the DMA Multichannel configuration here. I would like to know what is the buffer size and number of buffers?

                      • 8. Re: Problem of CX3_ UVC USB 2.0
                        thepthep88_2970436

                        Hi

                        I attach HSYNC and VSYNC

                         

                        DMA Multichannel configuration

                            dmaCfg.size                 = CX3_UVC_STREAM_BUF_SIZE;  // 0x5FF0+ 12+ 4

                            dmaCfg.count                = CX3_UVC_STREAM_BUF_COUNT;  //

                            dmaCfg.validSckCount        = CX3_UVC_SOCKET_COUNT;        //2

                         

                         

                            dmaCfg.prodSckId[0]         = CX3_PRODUCER_PPORT_SOCKET_0;   //CY_U3P_PIB_SOCKET_0

                            dmaCfg.prodSckId[1]         = CX3_PRODUCER_PPORT_SOCKET_1;  //CY_U3P_PIB_SOCKET_1

                         

                         

                            dmaCfg.consSckId[0]         = CX3_EP_VIDEO_CONS_SOCKET;

                            dmaCfg.dmaMode              = CY_U3P_DMA_MODE_BYTE;

                            dmaCfg.notification         = CY_U3P_DMA_CB_PROD_EVENT | CY_U3P_DMA_CB_CONS_EVENT;

                            dmaCfg.cb                   = CyCx3UvcAppDmaCallback;

                            dmaCfg.prodHeader           = CX3_UVC_PROD_HEADER;

                            dmaCfg.prodFooter           = CX3_UVC_PROD_FOOTER;

                            dmaCfg.consHeader           = 0;

                            dmaCfg.prodAvailCount       = 0;

                         

                        And Buffer size and number of buffers is below

                        #define CX3_UVC_DATA_BUF_SIZE_HS                   (0x5FF0)

                        #define CX3_UVC_STREAM_BUF_COUNT_HS                (4)

                        • 9. Re: Problem of CX3_ UVC USB 2.0
                          thepthep88_2970436

                          Probe VSYNC

                          Probe HSYNC

                          Hsync have problem..

                          Uart Debug Port out put while it streaming mode

                          TimeDiff = 968 ms FPS = 30

                          Prod = 11 Cons = 10  Prtl_Sz = 7184 Frm_Cnt = 2071 Frm_Sz = 412160 B

                          Prod = 11 Cons = 10  Prtl_Sz = 7184 Frm_Cnt = 2072 Frm_Sz = 412160 B

                          Prod = 11 Cons = 10  Prtl_Sz = 7184 Frm_Cnt = 2073 Frm_Sz = 412160 B

                          Prod = 11 Cons = 10  Prtl_Sz = 7184 Frm_Cnt = 2074 Frm_Sz = 412160 B

                          Prod = 11 Cons = 10  Prtl_Sz = 7184 Frm_Cnt = 2075 Frm_Sz = 412160 B

                          Prod = 11 Cons = 10  Prtl_Sz = 7184 Frm_Cnt = 2076 Frm_Sz = 412160 B

                          Prod = 11 Cons = 10  Prtl_Sz = 7184 Frm_Cnt = 2077 Frm_Sz = 412160 B

                          Prod = 11 Cons = 10  Prtl_Sz = 7184 Frm_Cnt = 2078 Frm_Sz = 412160 B

                           

                          No error occured

                          • 10. Re: Problem of CX3_ UVC USB 2.0
                            srdr

                            Hello Seongdong,

                             

                            You are setting buffer size to 24 KB = 0x5FF0 + 12 + 4.

                            The vidoe frame size is 640 * 480 * 10bits /8bits in Bytes

                             

                            So the Probe control setting should be as follows:

                            uint8_t const glVga30ProbeCtrl_HS[CX3_APP_MAX_PROBE_SETTING] = {

                                0x00, 0x00,                         /* bmHint : No fixed parameters */

                                0x01,                               /* Use 1st Video format index */

                                0x01,                               /* Use 1st Video frame index */

                                0x15, 0x16, 0x05, 0x00,             /* Desired frame interval in 100ns = (1/30)x10^7 */

                                0x00, 0x00,                         /* Key frame rate in key frame/video frame units */

                                0x00, 0x00,                         /* PFrame rate in PFrame / key frame units */

                                0x00, 0x00,                         /* Compression quality control */

                                0x00, 0x00,                         /* Window size for average bit rate */

                                0x00, 0x00,                         /* Internal video streaming i/f latency in ms */

                                0x00, 0xDC, 0x05, 0x00,             /* Max video frame size in bytes: 640 x 480 x (10/8)*/

                            #ifdef CX3_UVC_1_0_SUPPORT

                                0x00, 0x60, 0x00, 0x00              /* No. of bytes device can rx in single payload: 24KB - This is a DMA buffer size inclusing header and footer */

                            #else

                                /* UVC 1.1 Probe Control has additional fields from UVC 1.0 */

                                0x00, 0x60, 0x00, 0x00,             /* No. of bytes device can rx in single payload: 24KB - This is a DMA buffer size inclusing header and footer */

                                0x00, 0x60, 0xE3, 0x16,             /* Device Clock */

                                0x00,                               /* Framing Information - Ignored for uncompressed format*/

                                0x00,                               /* Preferred payload format version */

                                0x00,                               /* Minimum payload format version */

                                0x00                                /* Maximum payload format version */

                            #endif

                            };

                             

                            Can you measure the timing of VSYNC and HSYNC and share the values?

                            As per attached the diagrams, the Hsyc time is higher than the Vsync timing.

                            Did you mention HSYNC VSYNC reversly here?

                            What is the GPIF data bus that you have set here?

                            What is the MIPI configuration that is set? Is it RAW 10 output format as you mentioned?

                            • 11. Re: Problem of CX3_ UVC USB 2.0
                              thepthep88_2970436

                              I think both of them have problem, I probe Vsync and Hsync  correct.

                              It seem to be fine at usb 3.0 connection. (Vsync and Hsync)

                               

                              And GPIF DATA  -> CY_U3P_MIPICSI_BUS_16

                               

                              MIPI configuration set is same as i mentioned.

                               

                              I change probe setting  you attached, but it is same as before.

                              • 12. Re: Problem of CX3_ UVC USB 2.0
                                srdr

                                Measure the PCLK frequency and HSYNC High and Low times, VSYNC High and Low times in both USB 3.0 and USB 2.0.

                                 

                                Ideally, there should not be any difference in HSYNC and VSYNC w.r.t USB speed.

                                I would like to know whether there is any difference in configuring the MIPI w.r.t Super Speed and High speed.

                                Check the MIPI Configuration part in USB 3.0 and USB 2.0 part.

                                 

                                Upload the firmware here. I will go through it and let you know.

                                • 13. Re: Problem of CX3_ UVC USB 2.0
                                  thepthep88_2970436

                                  I attach the firmware

                                   

                                  I change mipi configuration HS mode same as SS mode.

                                   

                                  It's not work and debug output is below

                                   

                                  CB failure

                                  AplnStop:SMState = 0x7

                                  AplnStrt:SMState = 0x1

                                  • 14. Re: Problem of CX3_ UVC USB 2.0
                                    srdr

                                    Let us try the following and to know what is going wrong in High Speed.

                                     

                                    1. Set the MIPI for the VGA 30 fps resolution in Super Speed and High speed.

                                    2. Update the porbe control setting accordingly

                                    3. Update the format and frame descriptors accordinly

                                    4. configure the MIPI accordlingly

                                    5. stream the video in super speed

                                    5. stream the video in high speed

                                     

                                    Measure the PCLK frequency and HSYNC High and Low times, VSYNC High and Low times in both USB 3.0 and USB 2.0 and update the values here.

                                     

                                    The VSYNC Low value is 4 in the MIPI configuration screen shorts that you attached.

                                    Is it possible to increase it?

                                    Let me know what are the values of HSYNC and VSYNC that the sensor manfacturer suggested you.

                                     

                                    1 2 Previous Next