Hi,
First I want to show the following diagram:
We can see that IMX6Q has two IPUs. Each IPU has two inputs: CSI0 and CSI1. It makes four possible inputs:
1) ipu = 0, csi = 0
2) ipu = 0, csi = 1
3) ipu = 1, csi = 0
4) ipu = 1, csi = 1
Looking at device tree include file (provided with linux kernel), we can see the following description of OV5640 sensor connected through MIPI (serial, not parallel) interface:
/* ov5640 camera module */
&i2c2 {
ov5640_mipi: ov5640_mipi@3c { /* i2c2 driver */
compatible = "ovti,ov5640_mipi";
reg = <0x3c>;
clocks = <&clks 201>;
clock-names = "csi_mclk";
DOVDD-supply = <&vgen4_reg>; /* 1.8v */
AVDD-supply = <&vgen3_reg>; /* 2.8v, rev C board is VGEN3
rev B board is VGEN5 */
DVDD-supply = <&vgen2_reg>; /* 1.5v*/
pwn-gpios = <&gpio1 19 1>; /* active low: SD1_CLK */
rst-gpios = <&gpio1 20 0>; /* active high: SD1_DAT2 */
ipu_id = <0>;
csi_id = <1>;
vc = <0>;
mclk = <24000000>;
mclk_source = <0>;
status="okay";
};
};
As we can ipu = 0, and csi = 1 for MIPI camera. OV5640 sensor works fine through MIPI interface. However I don't understand why we use "&i2c2" (i2c bus number 2).
Now I want to connect OV5640 through parallel interface - Parallel 0. "i2cdetect" command sees our sensor on i2c bus number 0, address 0x3c. There is no examples for parallel interface configuration, however there are two OV5640 drivers: "ov5640_mipi" and "ov5640". Also looking at above picture I assume that we need to provide ipu = 0, csi = 0 to work with sensor connected to Parallel 0. And finally it appears that i2c bus number 0 is referenced by "&i2c1". So I change device tree description to the following:
&i2c1 {
ov5640: ov5640@3c { /* i2c2 driver */
compatible = "ovti,ov5640";
reg = <0x3c>;
clocks = <&clks 201>;
clock-names = "csi_mclk";
DOVDD-supply = <&vgen4_reg>; /* 1.8v */
AVDD-supply = <&vgen3_reg>; /* 2.8v, rev C board is VGEN3
rev B board is VGEN5 */
DVDD-supply = <&vgen2_reg>; /* 1.5v*/
pwn-gpios = <&gpio1 19 1>; /* active low: SD1_CLK */
rst-gpios = <&gpio1 20 0>; /* active high: SD1_DAT2 */
ipu_id = <0>;
csi_id = <0>;
vc = <0>;
mclk = <24000000>;
mclk_source = <0>;
status="okay";
};
};
And that does not work. Frame buffer is filled with zeroes.
In this thread:
OV5640 and OV5642 cameras on iMX6
Konstantyn Prokopenko says:
Check IPU configuration in drivers/mxc/ipu3
Make sure you enable proper channels for CSI0 and CSI1 either parallel or MIPI. (ipu_common.c)
Looking at IPU driver (ipu_common.c in /drivers/mxc/ipu3) I didn't find any mention of "parallel" at all. CSI0 and CSI1 channels are referred to by their integer codes "CSI_MEM0" and "CSI_MEM1", however there are another ones: "CSI_MEM2", "CSI_MEM3", "CSI_PRP_ENC_MEM", "CSI_PRP_VF_MEM", "MEM_PRP_VF_MEM", "MEM_VDI_PRP_VF_MEM", "DIRECT_ASYNC0", "DIRECT_ASYNC1" and so on.
There are bunch of another drivers that make direct use of IPU driver. For example ipu_csi_enc.c represents "IPU use case for video capture", it utilizes "CSI_MEM0" and "CSI_MEM1" channels. ipu_prp_enc.c represents "IPU use case for PRP ENC (what is this?)", and utilizes "CSI_PRP_ENC_MEM" channel, and so on.
So do I understand correctly that we need to set ipu = 0, csi = 0 to capture video from Parallel 0 interface? In this case video capturing will de done by ipu_csi_enc.c + ipu_common.c pair on first IPU's CSI_MEM0 channel.
Also there is such thing as IOMUXC_GPR1 register.
Bit 19 controls whether we accept data on IPU0 CSI0 from MIPI (set bit to 1) or from Parallel 0 (set bit to 0)
Bit 20 controls whether we accept data on IPU1 CSI0 from MIPI (set bit to 1) or from Parallel 1 (set bit to 0)
Probably we need to write this register to select parallel source.
Or do we have to configure IPU in another way?
Thank you
Hi Igor
for such use case may be useful to check example provided by nxp application team:
iMX6DQ MAX9286 MIPI CSI2 720P camera surround view solution for Linux BSP
link to nxp offical linux sources and documentation
i.MX Software and Development Tools | NXP
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Igor
This patch adds support for the following configurations:
The 4 cameras can be:
- 1xCSI, 3xMIPI
- 2xCSI, 2xMIPI
- 4xMIPI
CSI stands for Camera Serial Interface, and I know that MIPI also belongs to serial interfaces. However I am interested in Camera Parallel Interface. Or maybe by CSI they mean Camera Parallel Interface?
Thank you
Hi Igor
yes CSI is camera parallel interface.
May be useful below presentation
https://community.nxp.com/docs/DOC-100482
Best regards
igor