Streaming RAW data with CX3 not working with IMX219

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
user_2884081
Level 4
Level 4
50 replies posted 25 replies posted 10 replies posted

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?

0 Likes
19 Replies
Keerthy_V
Moderator
Moderator
Moderator
First like given 250 sign-ins 50 solutions authored

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?

0 Likes

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.

0 Likes

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.

0 Likes

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.

0 Likes

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.

0 Likes

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

};

0 Likes

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.

0 Likes

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.

0 Likes

I have found some of the information requested:

THS Prepare: 47

THS Zero: 87

HBlanking: 1528

VBlanking: 683

0 Likes

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

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

0 Likes

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.

pastedImage_1.png

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?

0 Likes

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.

0 Likes

The maximum bandwidth that CX3 can support per lane is 1Gbps. As the MIPI CSI clock is DDR clock, the maximum CSI clock frequency supported is 500MHz.

As per your response the CSI clock is 1368MHz which is not supported by CX3. Please reduce the CSI clock and repeat the test again.

Also can you please probe the MIPI data lanes and measure the THS prepare and THS zero timings? It will be good if you can attach the screenshots here.

0 Likes

Thanks keaj,

I changed the CSI frequency to 448MHz and it is now streaming video. However, the information sent seems to be wrong. I would like your help setting the clocks on the CX3 MIPI block to ensure the problem is not there.

Just to clarify, the stream that is being sent right now only work when the camera is set to RAW10 and the MIPI block is set to RAW8, and the frames I get in the host app seem to be wrong. Setting it all for RAW10 as expected, it is not working.

I don't know how to measure THS prepare and zero timings. I will attach screenshots. The yellow signal is the MIPI clock, and the blue one is the MIPI data 0 lane.

In the second and third pictures it can be seen that during 41.6ms, a pulse takes place once every 38.4us. This means a total of around 1080 pulses, which is the frame height.

RIGOL Print Screen27-06-2018 10_22_31,064.bmp

RIGOL Print Screen27-06-2018 10_23_13,717.bmp

RIGOL Print Screen27-06-2018 10_23_51,058.bmp

0 Likes

This is the MIPI receiver configuration file that I tried, but it is not working, since there is nothing to show in "cyu3mipicsi.c".

pastedImage_0.png

The configuration I'm using is this one, but only 0x3F3EE8 bytes are leaving the DMA, while 0x3F4800 should be sent. What is wrong with this configuration?

This configuration is not working.

CyU3PMipicsiCfg_t cfgUvc1080p30NoMclk =  {

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

1920,                        /* hResolution  */

0x0A                        /* fifoDelay    */

};

0 Likes
  1. Can you please print the MIPI CSI error counts over UART by using the API “CyU3PMipicsiGetErrors”. Check if any of the error count is non-zero.
  2. Please 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.
  3. Can you please probe the D0+ and D0- lines together and zoom near the LP ->HS transition? We can measure THS_prepare and THS_zero from the waveforms.

0 Likes

Hi keaj,

Please, your help would be appreciated in this project. Could you answer my questions, please?

0 Likes

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.

0 Likes
user_2884081
Level 4
Level 4
50 replies posted 25 replies posted 10 replies posted

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?

0 Likes