Shaojun Wang

Some Experience When Enable MIPI Camera

Discussion created by Shaojun Wang Employee on May 7, 2013
Latest reply on Jun 7, 2017 by Jason Gaiser

1. Debug steps for customer MIPI sensor

Debug steps for customer MIPI sensor.docx is the doc about how to debug MIPI sensor.

 

2. SabreSD default setting

In SabreSD board, ov5642 is connected to CSI0 parallel port, ov5640_mipi is connected to MIPI CSI port.

In BSP default setting, ov5640_mipi is routed to IPU0, CSI1. According to the doc, the virtual channel in MX6x side is 1, so virtual channel 1 should be enabled in camera sensor side. In driver ov5640_mipi.c, the code is “ov5640_set_virtual_channel(ov5640_data.csi)”.

 

3. MIPI DPHY clock setting

According to the doc,  MIPI DPHY clock should match camera sensor clock.

If the clocks are not matched, the MX6x MIPI_CSI Error state register MIPI_CSI_ERR1 is not 0, it would be 0x3, “Start of Transmission Error on data lane”.

So when enable new MIPI camera, need to measure the frequency of clock lane, or calculate from the related sensor register, then configure MPII DPHY clock.

For example, if the clock lane frequency is 128MHz, the clock range should be 250-270MHz because of DDR clock mode, so write 0x08 to CSI2_PHY_TST_CTRL1. One function of MIPI_CSI_PHY_TST_CTRL1 is setting the MIPI DPHY clock, this function is not described in MX6DQ RM revD.

The patch is

 

diff --git a/drivers/mxc/mipi/mxc_mipi_csi2.c b/drivers/mxc/mipi/mxc_mipi_csi2.c

index 1f051df..d53aaf5

--- a/drivers/mxc/mipi/mxc_mipi_csi2.c

+++ b/drivers/mxc/mipi/mxc_mipi_csi2.c

@@ -286,7 +286,7 @@ int mipi_csi2_reset(struct mipi_csi2_info *info)

mipi_csi2_write(info, 0x00000002, CSI2_PHY_TST_CTRL0);

mipi_csi2_write(info, 0x00010044, CSI2_PHY_TST_CTRL1);

mipi_csi2_write(info, 0x00000000, CSI2_PHY_TST_CTRL0);

- mipi_csi2_write(info, 0x00000014, CSI2_PHY_TST_CTRL1);

+ mipi_csi2_write(info, 0x00000008, CSI2_PHY_TST_CTRL1);

mipi_csi2_write(info, 0x00000002, CSI2_PHY_TST_CTRL0);

mipi_csi2_write(info, 0x00000000, CSI2_PHY_TST_CTRL0);

 

4. Virtual channel

For some mipi camera sensor, such as Samsung s5k4ec, the virtual channel is fixed to 0, there is no register in the sensor to configure it to other value.

We can configure the mipi camera to IPU0 CSI0 so the virtual channel in MX6 side is 0.

If virtual channel in camera side and MX6 side is not same, there is no error in mipi state and error register, but we will see below log when mx6 capture image

        ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0
        VIDIOC_DQBUF failed.

 

5. Mipi and CSI camera on same CSI port

If the parallel sensor is connected to CSI0 in the board, to enable dual camera, need to apply patch 0001-support-mipi-and-parallel-camera-on-same-csi-port.patch

 

 

 

Original Attachment has been moved to: 0001-support-mipi-and-parallel-camera-on-same-csi-port.patch.zip

Outcomes