i.mx6:two camera work at the same time

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

i.mx6:two camera work at the same time

17,182 Views
GaoJianzhong
Contributor IV

Hi,

I am using i.mx6q SD board to get two camera(ov5640 and ov3640) work at the same time.

It is no need to display the image on display, i just want to get the camera datas in memory and

save them to local files.

To confirm is it support two camera at the same time, I do the follow things:

1. Put the OV5640 camera image on display with mxc_v4l2_overlay.

2. then capture the OV3640 data to local file with use mxc_vpu_test

But i got following error when i do second step:

imx-ipuv3.0: handler already installed on irq 0

So i checked the drivers,and found that there is only CSI_MEM(which is CSI_MEM0),

I think that if want use two cameras at the same time,

It is need to add a CSI_MEM1  to let second camera data use CSI_MEM1 channel to memory.

Am i right? and is there any ideas to save two camera data to memory at same time?

Thank you.

Labels (1)
Tags (1)
37 Replies

1,351 Views
liyu1
Contributor III

   hi josh watts:

        Is this patch verified?

0 Kudos

1,351 Views
rogerio_silva
NXP Employee
NXP Employee

Hi Josh,

Thanks a lot for you feedback.

I hadn't a chance to check but seems that the cameras VDD are connected together and the source is not being able to provide current enough, causing a flickering (I'm just supposing). If possible, could you check if cameras VDD have some kind of ripple when playing both cameras at the same time? I'll also try to check it on my board.

BTW, how are you planning to capture 4 cameras at the same time? Will you use 4 MIPI cameras?

Best Regards,

Rogerio

0 Kudos

1,351 Views
jwatts
Contributor I

I'm not too concerned with the flickering as it appears to be a function of the board schematic/layout rather than the utilization of the SOC. That said, next time I've got both cameras running (probably in the next day or two) I'll grab a scope capture for you.

As for our upcoming design, we will have between 1 and 4 cameras connected via parallel (from PAL decoder) and from MIPI (from FPD Link III de-serializer) feeding into an FPGA where we'll be muxing the data into MIPI with 4 virtual channels to the IMX6's MIPI port.

Currently I've been able to change the OV5640's virtual channel and the corresponding code in the MXC V4L2 & MIPI drivers, but it seems I'm missing some bit of setup in the capture chain: Everything looks fine when I leave the OV5640 (and related drivers) at the default VC/CSI/IPU, but using VC 2 and 3 result in a randomly-tiled, false-color image. If you've seen this before (I assume I'm missing an obvious step somewhere in the code), let me know, otherwise I'll eventually track it down ;-)

0 Kudos

1,351 Views
rogerio_silva
NXP Employee
NXP Employee

Hi Josh,

About changing the VC, you can take a look on this page:

https://community.freescale.com/docs/DOC-102233

Regards,

Rogerio

0 Kudos

1,358 Views
Raana
Contributor III

0 Kudos

1,358 Views
edison_fernande
Contributor III

Hi Raana,

If you see at the ipu_csi_enc.c you'll see that for both cameras the driver is using the same irq and DMA channel and for that reason it is complaining when you try to use both cameras at the same time. What i did is assign the irq and channel depending on the camera so you don't have a resource conflict.

You can take a look at the patch a posted above. It is for kernel version 3.0.35-4.0.0, if you are using a different version then you'll need to modify it but it should work.

Edison

0 Kudos

1,358 Views
rogerio_silva
NXP Employee
NXP Employee

Hi,

Unfortunately with current drivers it's not possible to process on ipu 2 signals coming from 2 different CSIs (although the processor is capable to do it).

You can use at the same time 2 mxc_v4l2_capture.out instances to caputure. One using csi->prp_enc->mem and other using csi->mem:

./mxc_v4l2_capture.out -i 1 -d /dev/video1 test.aaa & ./mxc_v4l2_capture.out -d /dev/video0 test.bbb

This way you will record the 2 video files at the same time.

Rgds

Rogerio

1,358 Views
DipenPatel1z
Contributor III

Hi Roger,

Is it possible to capture 2 simultaneous 1280x720p stream from two cameras on i.MX6Q?

My goal is simultaneous capture from two camera at 1280x720p resolution and perform H.264 encoding and stream.

Appreciate your earliest response.

Regards,

Dipen Patel

0 Kudos

1,358 Views
edison_fernande
Contributor III

Hi Rogerio,

I know this thread is closed but i'm still having the same results even with your recommendation. I used gstreamer to capture video from both cameras at the same time (using a Sabre-SDP), thhis is the pipeline i used:

gst-launch -e mfw_v4lsrc input=0 ! 'video/x-raw-yuv,width=176,height=144' ! vpuenc codec=6 ! matroskamux ! filesink location=test0.mkv mfw_v4lsrc device=/dev/video1 input=1 ! vpuenc codec=6 ! matroskamux ! filesink location=test1.mkv

As you can see in the attached videos, test0.mkv has an annoying interference.  This is exactly the same results i get by using the patch i mentioned previously. Is this an analog issue or is a conflict with DMA channels?. I don't think it has to be with the memory because with the method that you suggested both cameras are using totally different channels and by applying the patch the DMA channel is assigned depending on the CSI.

Any advice wold be appreciated!!

Regards,

Edison

0 Kudos

1,358 Views
karina_valencia
NXP Apps Support
NXP Apps Support

rogeriopimentel can you continue with the  follow up on this case?

0 Kudos

1,358 Views
GaoJianzhong
Contributor IV

Hi

Sorry to later.

I have the same result.

Is it an analog reason.

0 Kudos

1,358 Views
LeonardoSandova
Specialist I

GaoJianzhong please mark this thread as unanswered. karinavalencia we need to escalate this issue, several customer are asking for a fix.

Leo

0 Kudos

1,358 Views
GaoJianzhong
Contributor IV
0 Kudos

1,358 Views
karina_valencia
NXP Apps Support
NXP Apps Support

As soon as  we have an update engineer will   post the  comments here.

0 Kudos

1,358 Views
GaoJianzhong
Contributor IV

Hi

You just need to copy the "drivers/media/video/mxc/capture/ipu_csi_enc.c", name it to ipu_csi_enc1.c.

And modify the ipu_csi_enc.c 's csi to use csi0,

modify the ipu_csi_enc1.c 's csi to use csi1.

And add some processes of ipu_csi_enc1.c and Makefile.

In tha application, you can use ioctl "VIDIOC_S_INPUT" with 1 & 2 to control which camera you use.

I attached the file i modified, you can referenc them.

It may be not all the files needs to modify, i 'm not sure whi !ch file i modified.

0 Kudos

1,358 Views
linuslin
Contributor I

Hi, Gao,

Would you mind sharing the vendor or source of your camera module?

Thank you

Linus

0 Kudos

1,358 Views
LeonardoSandova
Specialist I

yes.

gst-launch videotestsrc ! tee name=t ! queue ! vpuenc codec=avc ! filesink location=file.h264 t. ! queue ! vpuenc codec=mjpg ! filesink location=file.mjpg

0 Kudos