i.MX 6Quad ov5640 csi driver problem

cancel
Showing results for 
Search instead for 
Did you mean: 

i.MX 6Quad ov5640 csi driver problem

2,593 Views
tonnywong
Contributor III

Hi, I wired OV5640 camera to the CSI0 interface of the i.MX 6Quad Sabrelite board, the os is android 4.0.4,kernel is 3.0.15.

After I ran the camera application, it displayed black screen and  got some error like below:

/*******************************************************************/

ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0

ERROR: v4l2 capture: VIDIOC_QBUF: buffer already queued

ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0

ERROR: v4l2 capture: VIDIOC_QBUF: buffer already queued

ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0

ERROR: v4l2 capture: VIDIOC_QBUF: buffer already queued

ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0

ERROR: v4l2 capture: VIDIOC_QBUF: buffer already queued

ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0

ERROR: v4l2 capture: VIDIOC_QBUF: buffer already queued

ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0

ERROR: v4l2 capture: VIDIOC_QBUF: buffer already queued

ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0

/*******************************************************************/

The I2C communication is ok, because the ov5640 driver could read the id of the ov5640 chip:

/*******************************************************************/

<<-OV5640-DEBUG->>[1531]ov5640 Model ID 0x5640, Revision 0xb0

/*******************************************************************/



I used oscilloscope to detect the signals of hardware, and it seemed no problem:

1)the MCLK  pin outputs 24M waveform

2)the HSYNC, VSYNC output square wave

3) CSI0_DAT12~CSI0_DAT19 output waveform




the file for ov5640 driver is drivers/media/video/mxc/capture/ov5640.c, i only made some change in probe() function for porting:


static int ov5640_probe(struct i2c_client *client,

const struct i2c_device_id *id)

{

...

ov5640_data.mclk = plat_data->mclk;                                          //24M

ov5640_data.csi = plat_data->csi; //csi0

ov5640_data.io_init = plat_data->io_init;                                       //see board-mx6q_sabrelite.c         

ov5640_data.i2c_client = client;

ov5640_data.pix.pixelformat = V4L2_PIX_FMT_YUYV;                  //choose output format

ov5640_data.pix.width = 1280;//640;                                            //set the width 1280

ov5640_data.pix.height = 760;//480;                                             //set the height 760

ov5640_data.streamcap.capability = V4L2_MODE_HIGHQUALITY |

   V4L2_CAP_TIMEPERFRAME;

ov5640_data.streamcap.capturemode = 4;//0;                              //set mode ov5640_mode_720P_1280_720

...

}

the io_init refers to the function mx6q_csi0_io_ini of board-mx6q_sabrelite.c:

static void mx6q_csi0_io_init(void)

{

...

gpio_request(MX6Q_SABRELITE_CAM2_RST, "cam2-reset");

gpio_direction_output(MX6Q_SABRELITE_CAM2_RST, 0);

gpio_request(MX6Q_SABRELITE_CAM2_PWN, "cam2-pwdn");

gpio_direction_output(MX6Q_SABRELITE_CAM2_PWN, 1);

msleep(5);

gpio_set_value(MX6Q_SABRELITE_CAM2_PWN, 0);

msleep(1);

gpio_set_value(MX6Q_SABRELITE_CAM2_RST, 1);

}


can anyone know how to fix this problem ?




Labels (4)
0 Kudos
3 Replies

84 Views
yangthomas
Contributor II

ov5640_data.pix.height = 760;//480;                                             //set the height 760

ov5640_data.streamcap.capturemode = 4;//0;                              //set mode ov5640_mode_720P_1280_720

760?

0 Kudos

84 Views
alxdc
Contributor III

Same problem with ov5640_mipi camera, and kernel 3.0.35.

If the capturemode is set to 255 in: hardware/imx/mx6/libcamera/V4l2CsiDevice.cpp, a green screen appears with the 'Camera' app, and the error is gone but no image. If any other capturemode is forced the error still.

0 Kudos

84 Views
alxdc
Contributor III

I did not change anything in the ov5640_mipi.c

driver problem?

0 Kudos