i.MX6Q with Deserializer/Serializer/MIPI Camera OV5640

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX6Q with Deserializer/Serializer/MIPI Camera OV5640

2,044 Views
dustinzhu
Contributor II

Hi Guys,

I'm working on self-design hardware referred to i.MX6Q SabreLite and software  based on Yocto Project with Kernel  4.1.15. Right now Deserializer is connected to SoC with MIPI of 4 Lanes directly. Camera (2 MIPI Lanes) is connected to Serializer which connecting to Deserializer via a STP cable.

In test case, I did not connect serializer and use internal pattern generator of Deserialize to output frames with 1280x720 30FPS RGB888.

Writing an application with V4L2 IOCTL to capture and save the frame, but it always failed. I found  register MIPI_CSI_ERR1 is not 0 and Dphy state was not jumping between 0x300 and 0x3f0.

=========

mipi_reg[MIPI_CSI_ERR1 ]=0xf
datatype = 0x24
error2[MIPI_CSI_ERR2] = 0xaf90
status[ MIPI_CSI_PHY_STATE ] = 0x6f0

=========

As for Kernel code, I modified the code based on ov5640_mipi.c.

1. Change lane number from 2 to 4.

2. Change pixelformat to V4L2_PIX_FMT_RGB24, and MIPI support

+ mipi_csi2_set_datatype(mipi_csi2_info, MIPI_DT_RGB888);

3. Change MIPI CSI2 Clock

- mipi_csi2_write(info, 0x00000014, MIPI_CSI2_PHY_TST_CTRL1);
+ mipi_csi2_write(info, 0x00000004, MIPI_CSI2_PHY_TST_CTRL1); // 1280x720 30fps RGB888 12Bit

Could you give me some advice?

Rgds,

Dustin

Labels (3)
Tags (1)
6 Replies

1,098 Views
igorpadykov
NXP Employee
NXP Employee

Hi Dustin

CSI2_PHY_STATE for locked signal should be 0x000003xx, if not one

can look at data rate settings using

Debug steps for customer MIPI sensor.docx 

and check its configuration in mipi_csi2_reset() of file mxc_mipi_csi2.c.

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,098 Views
dustinzhu
Contributor II

Hi Igor,

I have looked through the DEBUG document and configure as following(there is a typo in item 3 above )

RGB888 MIPI Clock setting:
Pixel Clock = 1280*720*30fps* 1.5 * 1.35 * 24 bit = 1281.4453125 MHz
MIPI Clock = Pixel Clock / 4 (Lane Number) / 2 * 2(DDR Mode) = 320.361328125MHz
According to doc file, there is a table for clock ----> // 300-330Mhz :0x48 //330Mhz
Is there anything wrong?

But still in the case, there are several error status.
=========
mipi_reg[MIPI_CSI_ERR1 ]=0xf
datatype = 0x24
error2[MIPI_CSI_ERR2] = 0xff90
status[ MIPI_CSI_PHY_STATE ] = 0x6f0
=========

Br,
Dustin

0 Kudos

1,098 Views
igorpadykov
NXP Employee
NXP Employee

Hi Dustin

had you configured number of lanes as described in

Using only one lane on OV5640 MIPI + i.MX6 SabreSD 

Best regards
igor

0 Kudos

1,098 Views
dustinzhu
Contributor II

Hi Igor,

I do have modified the dts "&mipi_csi=<4>".

In my test case, I just wrote an application with V4L2 ioctls to operate capture action. One question, where could I find the test tool "/unit_tests/mxc_v4l2_overlay.out"?

Br,

Dustin

0 Kudos

1,098 Views
igorpadykov
NXP Employee
NXP Employee

Hi Dustin

please look at

imx-test
www.nxp.com/lgfiles/NMG/MAD/YOCTO/imx-test-5.7.tar.gz

Best regards
igor

0 Kudos

1,098 Views
dustinzhu
Contributor II

Hi Igor,

After I've set IDMAC 0 to interlaced mode and modified mipi setting, there is no error. But it still can't read frame data.

I dump the IPU debug infomation as flowing,

======================

sh-4.3# ./capture_test
mxc_cam_select_input: input(0) CSI IC MEM
imx-ipuv3 2800000.ipu: ipu_csi_init_interface: 1280x720
imx-ipuv3 2800000.ipu: CSI_SENS_CONF = 0x00008850
imx-ipuv3 2800000.ipu: CSI_ACT_FRM_SIZE = 0x02CF04FF
[ioctl_s_power] poweron = 1 sensor_on = 0
[ov5640_init_mode-6698]
[Debug MIPI] =============
mipi_reg= 0
datatype = 24
error1= 0
error2 = 0
status = 300
case VIDIOC_REQBUFS count = 4
mxc_v4l_do_ioctl: size=2764800
mxc_allocate_frame_buf: size=2764800
prp_enc_setup:in:1280x720 out:1280x720 format=33424752
RGB24
imx-ipuv3 2800000.ipu: _ipu_csi_init:CSI_SENS_CONF: ipu=80eee1c4,csi=0,data=2008850, channel=13ffffd4
imx-ipuv3 2800000.ipu: IC output size(1280) cannot exceed 1024
imx-ipuv3 2800000.ipu: failed to calculate prpenc width scaling coefficients
imx-ipuv3 2800000.ipu: initializing idma ch 20 @ f0180500
imx-ipuv3 2800000.ipu: ch 20 word 0 - 00000000 00000000 00000000 E0000800 000B3C9F
imx-ipuv3 2800000.ipu: ch 20 word 1 - 0E9E0000 01D3C000 20E3C000 FFF3BFC0 000C0110
imx-ipuv3 2800000.ipu: PFS 0x7,
imx-ipuv3 2800000.ipu: BPP 0x1,
imx-ipuv3 2800000.ipu: NPB 0xf
imx-ipuv3 2800000.ipu: FW 1279,
imx-ipuv3 2800000.ipu: FH 719,
imx-ipuv3 2800000.ipu: EBA0 0x74f00000
imx-ipuv3 2800000.ipu: EBA1 0x74f00000
imx-ipuv3 2800000.ipu: Stride 3839
imx-ipuv3 2800000.ipu: scan_order 0
imx-ipuv3 2800000.ipu: uv_stride 272
imx-ipuv3 2800000.ipu: u_offset 0x0
imx-ipuv3 2800000.ipu: v_offset 0x0
imx-ipuv3 2800000.ipu: Width0 7+1,
imx-ipuv3 2800000.ipu: Width1 7+1,
imx-ipuv3 2800000.ipu: Width2 7+1,
imx-ipuv3 2800000.ipu: Width3 7+1,
imx-ipuv3 2800000.ipu: Offset0 16,
imx-ipuv3 2800000.ipu: Offset1 8,
imx-ipuv3 2800000.ipu: Offset2 0,
imx-ipuv3 2800000.ipu: Offset3 24
[Debug] Starting to receive data frame
ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0
VIDIOC_DQBUF error!
Timer expired
imx-ipuv3 2800000.ipu: CSI stop timeout - 5 * 10ms
sh-4.3# power_down_callback: ipu1/csi0
[ioctl_s_power] poweron = 0 sensor_on = 1

======================

BR,

Dustin

0 Kudos