Interface OV5647 with IMX-7 on MIPI CSI

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Interface OV5647 with IMX-7 on MIPI CSI

8,026件の閲覧回数
tailordevang18
Contributor I

Hi,

 

We are working on IMX7 based custom board. We are trying to interface OV5647 camera module on MIPI CSI interace. 

 

The kernel boot log file is attached. Once  the board is started we can see below video node.

 

root@imx7dea-ucom:~# v4l2-ctl --list-devices

i.MX6S_CSI (platform:30710000.csi):

        /dev/video0

pxp (pxp_v4l2_out.13):

        /dev/video1

root@imx7dea-ucom:~#

 

It seems link with IMX6. We have downloaded  a test application from :

https://linuxtv.org/downloads/v4l-dvb-apis/capture-example.html

We have changed  pixel format to V4L2_PIX_FMT_UYVY and cross compiled the application. On running the application,

we are getting  "timeout " as it is not getting any data.

 

root@imx7dea-ucom:~# ./capture_raw_frames_YUV422 -d /dev/video0 -o  test                                                                      

select timeout

root@imx7dea-ucom:~#

However, in on kernel message we are not getting any error message related to this.

So can anyone help us to add missing support for this interface ? Any help will be appreciated to narrow down the our problem.

Original Attachment has been moved to: IMX7_KERNEL_BOOT_LOG.txt.zip

ラベル(1)
タグ(4)
0 件の賞賛
返信
11 返答(返信)

4,005件の閲覧回数
viswanathreddy
Contributor I

Hi All,

i am using the ov5640 mipi camera sensor.

i am new of the camera driver actually i am confusing can you explain me below three files

This below three files is required for camera bring up.

mxc_mipi_csi.c  -- > mipi related csi  ( Receiver driver)

ov5640_mipi.c --> camera sensor (Transmitter)

mx6s_capture.c --> ( this for confusing explain me) is it required or not this file

Thanks

Viswa

0 件の賞賛
返信

4,005件の閲覧回数
hbeij
Contributor III

I had the same question but figured it out from the kernel source and IMX6 and IMX7 datasheets. 

One part of the confusion stems from the inappropriate file placement and naming. The second part of the confusion stems from the fact that the IMX6 supports IPU and virtual channel muxing, whereas the IMX7 has only VC0 and is hardwired (cost-down perhaps?). On top of that, the CSI2 registers of the IMX6 and IMX7 are different and incompatible. However, the CSI peripheral does have identical registers for IMX6 and IMX7. For both IMX6 and IMX7 the CSI2 is always routed through the CSI, and not directly accessible. Hence you need both CSI2 and CSI drivers.

To sort this mess out, somehow, we ended up with the the following drivers:

CSI driver for IMX6, IMX7.

./drivers/media/platform/mxc/subdev/mx6s_capture.c

CSI2 driver for IMX7
./drivers/media/platform/mxc/subdev/mxc_mipi_csi.c

CSI2 driver for IMX6
./drivers/mxc/mipi/mxc_mipi_csi2.c

./include/linux/mipi_csi2.h

And of course, because the software API is different, the OV drivers are duplicated as well....

 

For the IMX7 interface (which is cleaner, using V4L -> CSI2)

./drivers/media/platform/mxc/subdev/ov5640_mipi.c
./drivers/media/platform/mxc/subdev/ov5640.c

 

For the IMX6 interface (nasty, couples directly to mxc_mipi_csi2)

./drivers/media/platform/mxc/capture/ov5640_mipi.c
./drivers/media/platform/mxc/capture/ov5640.c

Hope this helps anyone else having the same question...

0 件の賞賛
返信

4,005件の閲覧回数
dh29
Contributor IV

Hi Hendrik,

I am trying to interface an ADV7280M (mipi) to an iMX7D and have been struggling for a number of days. Your post is the closest I have come to anybody explaining what approach is required. Can you clarify that for an iMX7 solution I would need the following drivers:

  • ./drivers/media/platform/mxc/subdev/mx6s_capture.c       ;CSI driver
  • ./drivers/media/platform/mxc/subdev/mxc_mipi_csi.c       ;CSI2 driver
  • ./drivers/media/platform/mxc/subdev/adv7280m_mipi.c      ;based on mxc/subdev/ov5640_mipi.c
  • ./drivers/media/platform/mxc/subdev/adv7280m.c           ;based on mxc/subdev/ov5640.c
0 件の賞賛
返信

4,005件の閲覧回数
hbeij
Contributor III

Hi dh29,

For mx6s_capture.c you may need to add the format/bitsize if it is missing, i.e. BIT_MIPI_DATA_FORMAT_RAW8 (you can find these values also in the IMX7D TRM). Next, if it is missing, then you need to add the mapping to the V4L2 format. Just grep BIT_MIPI_DATA_FORMAT_RAW8 and follow it as an example.

For mxc_mipi_csi it is the same, i.e. adjust the structure if needed

static const struct csis_pix_format mipi_csis_formats[]

And indeed the adv* files follow the ov example and adjust where necessary.

Good luck!
Hendrik

0 件の賞賛
返信

4,005件の閲覧回数
dh29
Contributor IV

Hi Hendrik,

I've managed to move on since my post, and can now capture an image using a PAL camera source. My problem now is that I have 2 copies of the image, one on top of the other. The ADV7280M outputs interlaced (at the moment), so I think this is the reason for the 2 images. I think I have to enable CCIR / Interlaced mode within the iMX7, but at the moment I can't get it to work - all capture stops when I enable it. The OV5647 that you used is not interlaced, so it was one less thing for you to worry about!

Many thanks.

0 件の賞賛
返信

4,005件の閲覧回数
tailordevang18
Contributor I

Hi Weidong,

We have been waiting for your response.

Identification of correct capture driver for IMX7D MIPI CSI2 interface will help us a lot.

Regards,

Dev

0 件の賞賛
返信

4,005件の閲覧回数
qiang_li-mpu_se
NXP Employee
NXP Employee

In 4.1.15 BSP release, there is ov5647_mipi driver for iMX7: drivers/media/platform/mxc/subdev/ov5647_mipi.c.

0 件の賞賛
返信

4,005件の閲覧回数
tailordevang18
Contributor I

Hi Weidong,

Thank you so much for clearing the things. We have ordered OV5640 module, we will get it soon.

Mean while, we want to make sure that all the kernel driver and configuration from the processor side are fine. To do the same ,using OV5647 module we are trying to capture the raw data and dump it to a file (without any data format conversion). We don't want to show it on screen. Here, even though we are able to see MIPI clock and data signal on Processor pad, kernel buffers are not getting filled with data and hence we are not getting the same in the application.

Can you please help us to identify what may be the issue for this ?

I have attached the CSI related nodes. When any V4L2 system call is made,  driver that came in picture is "mx6s_capture.c" ["fsl,imx6s-csi"  compatible property, verified using debug print]. Let me know if this is not expected.

Regards,

Dev

0 件の賞賛
返信

4,005件の閲覧回数
weidong_sun
NXP TechSupport
NXP TechSupport

Hello Dev,

     According to your description, It seemed that MIPI CSI driver didn't get data from MIPI camera, so you can try to ajust virtual channel of MIPI in BSP or your camera driver.

    In addtion, our i.MX7D doesn't support ISP, it requires camera should have ISP module , as far as I can tell, there is no ISP function in ov5647 chip, It can only output RAW data,  so even if it's data can be normally tranmitted to MIPI CSI of processor, you can't also see camera image on screen.

     you can try to use ov5640 , or other modules with ISP function.

Best Regards,

Weidong

0 件の賞賛
返信

4,005件の閲覧回数
tailordevang18
Contributor I

Hi Weidong,

Thank you so much for your response. I would like to make clear below points.

1. That means we can't interface OV5647 with IMX7D and  can not capture data from OV5647 camera module due to unavailability of ISP.  Please confirm.

2. The method and CSI is driver I am using to capture image data is right, please confirm.

3. Has any one tested OV5640 camera sensor with IMX7D ?

Regards,

Dev

0 件の賞賛
返信

4,005件の閲覧回数
weidong_sun
NXP TechSupport
NXP TechSupport

Hello Dev,

1. That means we can't interface OV5647 with IMX7D and  can not capture data from OV5647 camera module due to unavailability of ISP.  Please confirm.

[weidong] capture driver can capature RAW data frome ov5647, but doesn't do any handling(such as converting data format), so image can't be displayed on screen.

2. The method and CSI is driver I am using to capture image data is right, please confirm.

[weidong] your method is right, MIPI camera is connected to MIPI interface of I.MX7D.

3. Has any one tested OV5640 camera sensor with IMX7D ?

[weidong] ISP function is supported by ov5640 module, and many i.mx EVK boards(such as I.MX6 series) support ov5640,0v5642, so for i.mx7d, ov5640(mipi interface) is no problem, at same time, ov5640 mipi driver is also supported in our linux bsp.

Best Regards,

Weidong

0 件の賞賛
返信