1 2 Previous Next 19 Replies Latest reply on Aug 8, 2018 11:26 PM by keaj

    Streaming RAW data with CX3 not working with IMX219

    andresgalu_2884081

      Recently I opened another question about streaming RAW data using CX3 and the Denebola kit, which uses the OV5640 image sensor.

       

      That was the previous step to using a Sony IMX219PQ image sensor with the CX3. I followed the instructions given in the discussion linked before since they worked with the OV5640 sensor, but I can't stream data to the PC host application.

       

      I configured the IMX219 to work in RAW10 1080p@30fps, and the MIPI clock shows a 30Hz signal. The MIPI data lane shows around 1080 pulses, which I guess signal every row, followed by what I think is the MIPI data for the row.

      I configured the CX3 this way:

      • MIPI: RAW10, hResolution = 1920
      • GPIF bus: 16 bits
      • Probe: video frame size in bytes = 1920 x 1080 x 5/4
      • USB Descriptor: 16bpp, RGB565, frame size = 1200x1080

       

      I have also added a byte counter that adds the "DmaBuffer.count" each Producer Event of the DMA, then resets when the frame is sent (EOF is added to header). The total byte count I get is not stable, but most of the time is 2755824 bytes, while I should be getting 1920x1080x5/4 = 2592000. I don't know why I am getting more bytes than I should.

       

      I have tried using the camera in RAW8 since that is the format that worked when using the OV5640, but the byte count I get is much lower than expected.

       

      What am I doing wrong? I have not changed the timing and clocks because I didn't have to when using the OV5640.

      Also, ideas to succesfully debug this would be appreciated.

       

      EDIT: I have been trying to check if the clocking is not correctly configured since it is the only thing I have not modified. But I don't have enough information. Should I change the MIPI clocks configuration? Why? What is the difference between different clock configurations?

        • 1. Re: Streaming RAW data with CX3 not working with IMX219
          keaj

          Hello Andres,

           

           

          1.  Is the MIPI clock gated or continuous? If the sensor is streaming in continuous clock mode, follow the steps mentioned in question 13 of the following link:

          http://www.cypress.com/knowledge-base-article/cx3-hardware-frequently-asked-questions-kba91295

          2.  Print the MIPI CSI error counts over UART by using the API “CyU3PMipicsiGetErrors”. Check if any of the error count is non-zero. If yes, double check the sensor configuration.

          3.  Vary the ‘thsSettleDelay’ parameter of “CyU3PMipicsiSetPhyTimeDelay()” API to check if the sensor is streaming for any of the delay value. Keep the first parameter as 0x01 always.

          4.  If you were able to get zero MIPI errors and if the video is still not streaming probe the following test points

               CX3 pin#

                          Test Signal Name

          H8

                            PCLK test signal

          G6

                            HSYNC test signal

          H5

                            VSYNC test signal

          If only H8 toggles but not the other pins then MIPI CSI configuration may not be correct. Enter the correct values of MIPI CSI image sensor outputs in the tool and configure the PLL dividers appropriately so that the tool will not generate any errors. Make sure to use the latest CX3 configuration tool plugins.

          5.  Ensure that all the unused MIPI data lanes are grounded.

          6.  Can you please share the screenshot of your MIPI CSI 2 configuration tool?

           

          • 2. Re: Streaming RAW data with CX3 not working with IMX219
            andresgalu_2884081

            I found out there was a misunderstanding. The sensor sends RAW10 data using 5 bytes per 4 pixels, but it seems that when I configure the MIPI block for RAW10, the expected format is 2 bytes per pixel, with 6 blank bits. Is this true? This may be the main cause for my problem.

            I have tried changing the parameters to match this new information: MIPI is RAW8 and hResolution=2400. I have tried GPIF bus both 8 and 16 bits but it doesn't work. At least, the bytes sent (2591368) is very similar to the real number (2592000). Any idea of what could be wrong with this information?

            I will try your solutions above now.

            • 3. Re: Streaming RAW data with CX3 not working with IMX219
              andresgalu_2884081

              I see the MIPI clock lane changing, when it is low the MIPI data lanes are active. The frequency of the clock signal is 30Hz as expected, and the active time of the MIPI data is 20.5ms.

              I guess this means the clock is gated.

              • 4. Re: Streaming RAW data with CX3 not working with IMX219
                andresgalu_2884081

                I have introduced the "CyU3PMipicsiGetErrors" API and can confirm that the "CyU3PMipicsiErrorCounts_t" variable is full of zeros.

                 

                I have also tried different values in the "CyU3PMipicsiSetPhyTimeDelay", from 0 to 0x7F as the API guide. When the value is in the range 0x04 to 0x09, it works as always, but if the number is different, the bytes sent is much lower and not stable.

                • 5. Re: Streaming RAW data with CX3 not working with IMX219
                  andresgalu_2884081

                  I haven't used the MIPI CSI 2 configuration tool, I used this:

                   

                  CyU3PMipicsiCfg_t cfgUvc1080p30NoMclk =  {

                  CY_U3P_CSI_DF_RAW8,      /* dataFormat   */

                  2,                          /* numDataLanes */

                  1,                        /* pllPrd       */

                  62,                          /* pllFbd       */

                  CY_U3P_CSI_PLL_FRS_500_1000M, /* pllFrs      */

                  CY_U3P_CSI_PLL_CLK_DIV_8,    /* csiRxClkDiv  */

                  CY_U3P_CSI_PLL_CLK_DIV_8,    /* parClkDiv    */

                  0x00,                        /* mclkCtl      */

                  CY_U3P_CSI_PLL_CLK_DIV_8,    /* mClkRefDiv   */

                  2400,//1920,                        /* hResolution  */

                  0x01                        /* fifoDelay    */

                  };

                  • 6. Re: Streaming RAW data with CX3 not working with IMX219
                    andresgalu_2884081

                    For the other 2 questions, I don't have an easy access to H5, H8 and G6 pins.

                    The other MIPI lanes are connected to the CX3 device.

                    • 7. Re: Streaming RAW data with CX3 not working with IMX219
                      andresgalu_2884081

                      I have a doubt regarding the RAW10 format.

                       

                      I know the sensor is sending the image using 5 bytes per 4 pixels. Is that how the MIPI reads it when configured to RAW10? If MIPI reads it the same way, then hResolution must be 1920, isn't it?

                       

                      Also, I know the sensor is sending the data in a specific format with header, footer, line blanking and frame blanking. I assume this is the MIPI standard and CX3 is taking it into consideration.

                      • 8. Re: Streaming RAW data with CX3 not working with IMX219
                        keaj

                        Please provide the following details:

                         

                        • MIPI CSI clock
                        • THS prepare
                        • THS zero
                        • Hblanking
                        • Vblanking
                        • REFCLK

                         

                        We can find the appropriate MIPI bridge settings from the above values.

                        • 9. Re: Streaming RAW data with CX3 not working with IMX219
                          andresgalu_2884081

                          I can't find the information you asked, it should be in the sensor datasheet, isn't it?

                          Is there another way to get that information?

                           

                          REFCLK is 19.2MHz.

                          • 10. Re: Streaming RAW data with CX3 not working with IMX219
                            andresgalu_2884081

                            I have found some of the information requested:

                             

                            THS Prepare: 47

                            THS Zero: 87

                            HBlanking: 1528

                            VBlanking: 683

                            • 11. Re: Streaming RAW data with CX3 not working with IMX219
                              andresgalu_2884081

                              The datasheet I am using can be found here, where I found it.

                              I can't get the correct calculation for the CSI clock.

                              • 12. Re: Streaming RAW data with CX3 not working with IMX219
                                andresgalu_2884081

                                Hi Keaj,

                                 

                                I found the way to obtain the clocks. MIPI output clock of the camera is 1368 MHz. So, to answer your last question:

                                • MIPI CSI clock = 1368 MHz
                                • THS prepare = 47
                                • THS zero = 87
                                • Hblanking = 1528
                                • Vblanking = 683
                                • REFCLK = 19.2 MHz

                                I tried using these values in the CX3 MIPI Receiver Configuration but it has errors.

                                I don't know how to fill the right column. Your help would be appreciated.

                                 

                                I keep getting "ERROR: Parallel output cannot finish within 1 line. Use faster Output Pixel clock and/or wider H-blanking", but all the parameters seem right and in the correct range. I don't have a single value in red (with other configuration than showed), but still get the error. What is wrong?

                                • 13. Re: Streaming RAW data with CX3 not working with IMX219
                                  andresgalu_2884081

                                  I have some questions regarding these parameters.

                                   

                                  Since I can't make the application work, I would like to know more about what impact do these parameters on the MIPI configuration, and how to obtain the MIPI configuration from these parameters. I can't find much information about them.

                                   

                                  Your help would be appreciated.

                                  • 14. Re: Streaming RAW data with CX3 not working with IMX219
                                    andresgalu_2884081

                                    After changing some clock parameters on the camera, I have managed to send almost the same amount of bytes through the USB. Instead of 4147200, I am sending 4144872. HSYNC, VSYNC and PCLK look good.

                                    The problem seemed to be the MIPI configuration: the camera sent the information too fast for the CX3 to get.

                                    I only managed to get one frame, but I am trying to stream video. I don't know what happened for that frame to be sent, it was only once.

                                     

                                    What am I missing?

                                    1 2 Previous Next