8 Replies Latest reply on Nov 19, 2017 11:14 PM by hppc

    CX3 configuration for OV5680 RAW10 format

    untitle1022

      Now, I am working with CX3 dev board for bring up ov5680 sensor.

       

      The problem is that I am not sure how should I modify uvc descriptor for raw10 bit.

       

      I already implemented uvc raw8 format, and at host pc I can preview the raw8 stream as well.

       

      But when I modify the descriptor for RAW10, It cannot preview.

       

      Please help me to check below dscr, feedback to me.

       

      Thanks

       

      #ifdef BAYER_RAW10

          /* Class specific Uncompressed VS format descriptor */

          0x1B,                               /* Descriptor size */

          NMG_UVC_CS_INTRFC_DESCR,                /* Class-specific VS interface Type */

          0x04,                               /* Subtype : VS_FORMAT_UNCOMPRESSED */

          0x01,                               /* Format desciptor index */

          0x01,                               /* Number of Frame Descriptors that follow this descriptor: 3 */

       

       

          /* GUID, globally unique identifier used to identify streaming-encoding format: BY10  */

          0x42, 0x59, 0x31, 0x30,             /*MEDIASUBTYPE_BY10 GUID: 30315942-0000-0010-8000-00AA00389B71 */

          0x00, 0x00, 0x10, 0x00,

          0x80, 0x00, 0x00, 0xAA,

          0x00, 0x38, 0x9B, 0x71,

          0x0A,                               /* Number of bits per pixel: 10 */ => Is it correct bit size for RAW10 ?

          0x01,                               /* Optimum Frame Index for this stream: 1 (1944p) */

          0x00,                               /* X dimension of the picture aspect ratio; Non-interlaced */

          0x00,                               /* Y dimension of the pictuer aspect ratio: Non-interlaced */

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

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

       

          /* Class specific Uncompressed VS frame descriptor 1 - 5MP@30fps */

          0x1E,                               /* Descriptor size */

          NMG_UVC_CS_INTRFC_DESCR,                /* Descriptor type*/

          0x05,                               /* Subtype: Uncompressed frame interface*/

          0x01,                               /* Frame Descriptor Index: 1 */

          0x01,                               /* No Still image capture method supported */

          0x20, 0x0A,                         /* Width in pixel: 2592 */

          0x98, 0x07,                         /* Height in pixel: 1944 */

          0x00, 0x04, 0x1A, 0x5A,             /* Min bit rate @30fps (bits/s): 2592 x 1944 x 30 x 10 = 1511654400 */ => Is it correct bit rate for RAW10 @30fps?

          0x00, 0x04, 0x1A, 0x5A,             /* Max bit rate @30fps (bits/s): 2592 x 1944 x 30 x 10 = 1511654400 */

          0xC0, 0x1B, 0x60, 0x00,             /* Maximum video frame size in bytes(Deprecated): 2592 x 1944 x 10 / 8 = 5038848  */

          //0x00, 0xA0, 0x29, 0x90,             /* Min bit rate @30fps (bits/s): 2592 x 1944 x 30 x 16 = 2418647040 */

          //0x00, 0xA0, 0x29, 0x90,             /* Max bit rate @30fps (bits/s): 2592 x 1944 x 30 x 16 = 2418647040 */

          //0x00, 0xC6, 0x99, 0x00,             /* Maximum video frame size in bytes(Deprecated): 2592 x 1944 x 16 / 8 = 5038848  */

          0x15, 0x16, 0x05, 0x00,             /* Default frame interval (in 100ns units): (1/15)x10^7 */

          0x01,                               /* Frame interval type : No of discrete intervals */

          0x15, 0x16, 0x05, 0x00,             /* Frame interval 3: Same as Default frame interval */

       

       

          /* Still image descriptor -YUV with QVGA resolution */

           0x0A,

           0x24,

           0x03,

           0x00,

           0x01, //No of frame Resolutions Follows

           0x20,0x0A, //2592x1944

           0x98,0x07,

           0x00,

      #endif /* BAYER_RAW10 */

        • 1. Re: CX3 configuration for OV5680 RAW10 format
          untitle1022

          Hi All.

           

          Is there anybody who can give me feedback about OV5680 Raw10 format configure?

          • 2. Re: CX3 configuration for OV5680 RAW10 format
            hppc

            The descriptor looks fine. In CX3 firmware GPIF state machine can be configured for 8/16/24 bit wide data lines. Assuming 16 bit GPIF state machine is used, when a RAW 10 format data is coming to CX3,the unused 6 lines also will be sampled before the data is received in CX3. GPIF interface will be getting the data with 10 bit RAW10 data and 6 'zero' bits appended with each pixel data. The host application should remove the unwanted bits to get the actual pixel value.

            • 3. Re: CX3 configuration for OV5680 RAW10 format
              untitle1022

              First of all, thank you for replying my post.

               

              As you said, If I decide to use GPIF II 16bit wide for RAW10,

              is it correct to configure Number of bits per pixel as 0x0A?

              I think it should be configure as 0x10(16bit), bcoz host pc will receive 16bit format per pixel.

              what is your opinion ?

              • 4. Re: CX3 configuration for OV5680 RAW10 format
                hppc

                Just giving bits per pixel as 16 will not help. The frame size needs to be changed accordingly in the descriptor such that (width*height*bits per pixel) needs to be same as (2592*1944*10). Otherwise UVC driver will not accept the data. Here this depends on the MIPI configuration used as well. You might have kept the input and output data format as RAW10. In this case, the data ouput from MIPI will be always be of 10 bits. If the MIPI out data format is kept as YUY2 then the 16bit MIPI out will be valid and the PC will get valid 16bit data. First 16 bits will have first pixel data and 6 bits of next pixel. Now the host application still need to decode the pixel data as 10 bits each to get the proper preview. 

                • 5. Re: CX3 configuration for OV5680 RAW10 format
                  untitle1022

                  Hi hppc,

                   

                  Thanks for your reply.

                  Below descriptor code is for OV5680 5MP Raw10 format setting. (GPIF II bus width set as 16 bit)
                  Could you find any incorrect setting ?

                  Now If I run the amcap with custom directshow filter which is support Bayer10 format,

                  Window will show black screen, the custom filter cannot receive any data from sensor side.

                  Window Device Manager can recognize CX3 as UVC device,

                  and at Amcap viewer video capture pin I can see the FPS and Video format also shown as I configured. (30fps, "BY10")

                   

                      /* GUID, globally unique identifier used to identify streaming-encoding format: BY8  */

                      0x42, 0x59, 0x31, 0x30,            /*MEDIASUBTYPE_BY10 GUID: 30315942-0000-0010-8000-00AA00389B71 */

                      0x00, 0x00, 0x10, 0x00,

                      0x80, 0x00, 0x00, 0xAA,

                      0x00, 0x38, 0x9B, 0x71,

                      0x0A,                              /* Number of bits per pixel: 10 */

                      0x01,                              /* Optimum Frame Index for this stream: 1 (5MP) */

                      0x00,                              /* X dimension of the picture aspect ratio; Non-interlaced */

                      0x00,                              /* Y dimension of the pictuer aspect ratio: Non-interlaced */

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

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

                   

                      /* Class specific Uncompressed VS frame descriptor 1 - 5MP@30fps */

                      0x1E,                              /* Descriptor size */

                      NMG_UVC_CS_INTRFC_DESCR,            /* Descriptor type*/

                      0x05,                              /* Subtype: Uncompressed frame interface*/

                      0x01,                              /* Frame Descriptor Index: 1 */

                      0x01,                              /* No Still image capture method supported */

                      0x20, 0x0A,                        /* Width in pixel: 2592 */

                      0x98, 0x07,                        /* Height in pixel: 1944 */

                      0x00, 0x04, 0x1A, 0x5A,            /* Min bit rate @30fps (bits/s): 2592 x 1944 x 30 x 10 = 1511654400 */

                      0x00, 0x04, 0x1A, 0x5A,            /* Max bit rate @30fps (bits/s): 2592 x 1944 x 30 x 10 = 1511654400 */

                      0xC0, 0x1B, 0x60, 0x00,            /* Maximum video frame size in bytes(Deprecated): 2592 x 1944 x 10 / 8 = 6298560  */

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

                      0x01,                              /* Frame interval type : No of discrete intervals */

                      0x15, 0x16, 0x05, 0x00,            /* Frame interval 3: Same as Default frame interval */

                   

                   

                  /* Configuration parameters for 5Mp @15FPS for the OV5680 sensor */

                  CyU3PMipicsiCfg_t cfgUvc5Mp15NoMclk =  {

                      CY_U3P_CSI_DF_RAW10,

                      2,                          /* numDataLanes */

                      1,                        /* pllPrd      */

                      79,                          /* pllFbd      */

                      CY_U3P_CSI_PLL_FRS_250_500M, /* pllFrs      */

                      CY_U3P_CSI_PLL_CLK_DIV_4,    /* csiRxClkDiv  */

                      CY_U3P_CSI_PLL_CLK_DIV_4,    /* parClkDiv    */

                      0x00,                        /* mclkCtl      */

                      CY_U3P_CSI_PLL_CLK_DIV_2,    /* mClkRefDiv  */

                      2592,                        /* hResolution  */

                      0x01                        /* fifoDelay    */

                  };

                  • 6. Re: CX3 configuration for OV5680 RAW10 format
                    hppc

                    Try to change the output format in the CyU3PMipicsiCfg_t to CY_U3P_CSI_DF_YUV422_8_1. Then valid data will be available in 16 bit GPIF. Also you can try to change the pllfbd and check the CX3 UART debug logs.

                    • 7. Re: CX3 configuration for OV5680 RAW10 format
                      untitle1022

                      Hi hppc,

                       

                       

                      As your mentioned, I modify the format from CY_U3P_CSI_DF_RAW10 to CY_U3P_CSI_DF_YUV422_8_1.

                       

                      Seems that It will stream raw10 format data to PC side.

                       

                      I hava a questions, can you give me answer about below ?

                       

                      - If I keep the video output format as CY_U3P_CSI_DF_RAW10, how should I modify my descriptor as working normal?

                       

                        I still conflict with mipi receiver configure.

                      • 8. Re: CX3 configuration for OV5680 RAW10 format
                        hppc

                        When the output format is kept as CY_USB_CSI_DF_RAW10 the data available at the USB will be of the form 10 bits data + 6 bits zero. So in the host application this needs to be removed to get the valid pixel data. When the data format is kept as CY_U3P_CSI_DF_YUV422_8_1 the mipi will convert the serial data to 16 bit parallel data without zeros as YUV format has 16 bit output. Still the data will be of RAW data itself.