camera on CSI

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

camera on CSI

11,056 Views
JoshuaParrish
Contributor I

Hello all,

 

I've recently been trying to set up an ov7725 on the csi 0 line. 

I have it coming up and being recognized as a device. 

However, when I try to get a picture out I get nothing. 

 

I've used a couple different tests. but nothing gets a real response.

 

The output I have from /unit_tests/mxc_v4l2_overlay.out is 

g_display_width=240, g_display_height =320

g_display_top=0,g_display_left=0

sensor chip is ov7725

sensor frame size is 640x480

sensor frame format is UYVY

frame_rate is 30

 

frame buffer width 1024, height 768, bytesperline 2048

 

 

 

 

Then about 3 seconds later I get a green pattern at the top of my screen. 

 

My sensor by default puts out 60 frames per second (I have used i2c to control it down to 30 fps). It outputs in 640x480 in YUV format. 

 

The driver I'm using is a clone of the ov3640 driver included with the BSP. 

The big difference between the two drivers is that I have eliminated all the i2c set up data. 

and replaced ov3640 with ov7725. 

 

The main issue here is that I am not getting a picture. Could anyone offer suggestions?

Tags (1)
0 Kudos
59 Replies

1,502 Views
JoshuaParrish
Contributor I

Ok, guys looks like I found that error thanks to your help. 

my custom i2c commands were returning a value of 1 into the retval and should have returned a 0 instead. 

 

Now I get this as my dmesg. 

I attached the file, the copied text wasn't as easy to read. 

 

 

So there is still the same problems, such as the IPU errors.

0 Kudos

1,502 Views
JoshuaParrish
Contributor I

Daiane,

In mxc_v4l2_s_param 9-2

 

this is a printk I added to my mxc_v4l2_capture.c

trying to understand exactly what happened here.

0 Kudos

1,502 Views
daiane_angolini
NXP Employee
NXP Employee

In mxc_v4l2_s_param 9-2
mxc_v4l2_s_param: vidioc_int_s_parm returned an error 1

 

What is 9-2? 

 

I found printk for "9", but where are "-2" from?

0 Kudos

1,502 Views
JoshuaParrish
Contributor I

I made a slight mistake in there where it repeats ioctl_s_parm 1 it should be 10.

If I set the unit_tests to be m 0 not m 1 then the mode changes to 0 as expected; nothing changes image wise.

 

 

 

I have also uploaded what I see in the unit-tests as that may have some debugging help.

Sorry the pic is upside down.

0 Kudos

1,502 Views
JoshuaParrish
Contributor I

Here is the newly updated file.

Attached.

 

 

I ran these commands:

sudo dmesg -c
sh Documents/ports.sh # this is a set up for the gpio ports that control pwdn and reset
sudo insmod ov7725.ko
sudo modprobe mxc_v4l2_capture

/unit_tests/mxc_v4l2_overlay.out -iw 640 -ih 480 -ow 640 -oh 480 -f UYVY -fr 30 -fg -m 1

dmesg

 

 

Here is the output from that.

In ov7725_init 0
In i2c_register_driver 0
In driver_register 0
In driver_register 1
In i2c device probe client df0c8400
In ov7725 probe 0
In ov7725 probe 1
In ov7725 probe 2
In ov7725 probe 3
In ov7725 probe 4
In ov7725 probe 5
In ov7725 probe 6
In ov7725 probe 6-1
In ov7725 probe 6-2
In ov7725 probe 7
In ov7725 probe 8
In ov7725 probe 8-1
In ov7725 probe 9
In ov7725 probe 10
In ov7725 probe 11
In ov7725 ioctl_s_power 0
In ov7725 ioctl_dev_init 0
   Setting mclk to 24 MHz
ssi_ext1_clk frequency = 23529411
In ov7725 init_mode 0
Product ID 77:21
ov7725 Addr = 0012 data = 80
ov7725 Addr = 0011 data = 01
ov7725 Addr = 000c data = 11
ov7725 Addr = 0012 data = 20
ov7725 Addr = 0015 data = 00
In ov7725 init_mode 1
In ov7725 ioctl_g_frm_cap 0
In ov7725 probe 12
In ov7725 ioctl_g_ifparm 0
   clock_curr=mclk=23529411
In ov7725 ioctl_g_frm_cap 0
In ov7725 ioctl_g_chip_ident 0
In ov7725 ioctl_enum_framesizes 0
In ov7725 ioctl_enum_fmt_cap 0
In mxc_v4l2_s_param 0
In mxc_v4l2_s_param 2
In mxc_v4l2_s_param 3
In mxc_v4l2_s_param 4
In mxc_v4l2_s_param 5
In ov7725 ioctl_g_parm 0
In ov7725 ioctl_g_parm 1
In mxc_v4l2_s_param 6
In mxc_v4l2_s_param 7
   Current capabilities are 1001
   Current capturemode is 0  change to 1
   Current framerate is 30  change to 30
In mxc_v4l2_s_param 8
In mxc_v4l2_s_param 9
In ov7725 ioctl_s_parm 0
In ov7725 ioctl_s_parm 0-1
In ov7725 ioctl_s_parm 1
In ov7725 ioctl_s_parm 2
In ov7725 ioctl_s_parm 3
In ov7725 ioctl_s_parm 4
In ov7725 ioctl_s_parm 5
In ov7725 ioctl_s_parm 6
In ov7725 ioctl_s_parm 6-2
In ov7725 ioctl_s_parm 7 timeperframe=1
In ov7725 ioctl_s_parm 8  capturemode=1
In ov7725 ioctl_s_parm 9 capturemode=1
In ov7725 init_mode 0
Product ID 77:21
ov7725 Addr = 0012 data = 80
ov7725 Addr = 0011 data = 01
ov7725 Addr = 0012 data = 20
In ov7725 init_mode 1
In ov7725 ioctl_s_parm 1
In mxc_v4l2_s_param 9-1
In mxc_v4l2_s_param 9-2
mxc_v4l2_s_param: vidioc_int_s_parm returned an error 1
In mxc_v4l2_s_param 24
In ov7725 ioctl_g_parm 0
In ov7725 ioctl_g_parm 1
mxc_ipu mxc_ipu: Channel already disabled 10
mxc_ipu mxc_ipu: Channel already uninitialized 10
mxc_ipu mxc_ipu: Channel already disabled 10
mxc_ipu mxc_ipu: Channel already uninitialized 10
mxc_ipu mxc_ipu: IPU Error - IPU_INT_STAT_5 = 0x00200000

IPU_CONF =      0x000006A4
IDMAC_CONF =    0x0000002F
IDMAC_CHA_EN1 =         0x08A00000
IDMAC_CHA_EN2 =         0x00000000
IDMAC_CHA_PRI1 =        0x18800001
IDMAC_CHA_PRI2 =        0x00000000
IDMAC_BAND_EN1 =        0x00000000
IDMAC_BAND_EN2 =        0x00000000
IPU_CHA_DB_MODE_SEL0 =  0x08A00000
IPU_CHA_DB_MODE_SEL1 =  0x00000000
DMFC_WR_CHAN =  0x00000090
DMFC_WR_CHAN_DEF =      0x202020F6
DMFC_DP_CHAN =  0x0000968A
DMFC_DP_CHAN_DEF =      0x2020F6F6
DMFC_IC_CTRL =  0x00000002
IPU_FS_PROC_FLOW1 =     0x00000000
IPU_FS_PROC_FLOW2 =     0x00000000
IPU_FS_PROC_FLOW3 =     0x00000000
IPU_FS_DISP_FLOW1 =     0x00000000
mxc_ipu mxc_ipu: warning: disable ipu dma channel 21 during its busy state
mxc_ipu mxc_ipu: Channel already disabled 10
mxc_ipu mxc_ipu: Channel already uninitialized 10
mxc_v4l_close: release resource

0 Kudos

1,502 Views
daiane_angolini
NXP Employee
NXP Employee

I couldn´t find the error. But this is the function returning the error:

 

static int ioctl_s_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a)

can you place some debug messages in order to get some clue?

0 Kudos

1,502 Views
JoshuaParrish
Contributor I

Hake and Daiane,

 

Thanks guys for continuing to help me.

Since most of this is reliant all on my driver I've just included that here as an attachment.

0 Kudos

1,502 Views
daiane_angolini
NXP Employee
NXP Employee

yes, the problem is that you should be seting some wrong value for parm.

 

Once parm is a big structure I cannot understand what value is wrong. That's why you should double check it.

 

For example, it can be the case you set capture mode = 3, x_resolution = 12345 and fps=12. But your camera, when it operates on capture mode =3 using x_resolution = 12345 it can only achieve fps = 15 or fps = 25.

 

It was a dumb example, I don't know your camera so I don't know your parameters. You should look into your camera driver to figure out your possibilities.

0 Kudos

1,502 Views
hake
NXP Employee
NXP Employee

see below line

{vidioc_int_s_parm_num, (v4l2_int_ioctl_func *)ioctl_s_parm},

take ov3640.c as an example

0 Kudos

1,502 Views
JoshuaParrish
Contributor I

I have found that 

err = vidioc_int_s_parm(cam->sensor, parm);

 

is the line that is failing. 

This is on line ~1209 in mxc_v4l2_capture.c *I've added lines so it's close to this line*

 

 

I can't seem to find the vidioc_int_s_parm function declared in the system. 

I've grepped to try and find it, however, it didn't return anything other than patches and other devices that make the same call. 

0 Kudos

1,502 Views
JoshuaParrish
Contributor I

Daiane,

 

Thank you so much. I will post my updates here. 

 

So far I can see that the driver is outputting in BT.656 mode so I have turned that on. 

0 Kudos

1,502 Views
daiane_angolini
NXP Employee
NXP Employee
0 Kudos

1,502 Views
JoshuaParrish
Contributor I

Daiane, 

 

You have been more helpful! Thank you so much for your continued support. 

 

What do you mean by set on the debugger. I would like to see the pr_debug messages. 

0 Kudos

1,502 Views
daiane_angolini
NXP Employee
NXP Employee

You have at least one error you should take care:

 

mxc_v4l2_s_param: vidioc_int_s_parm returned an error 1

 

If you open ./drivers/media/video/mxc/capture/mxc_v4l2_capture.c you will see the function

static int mxc_v4l2_s_param(cam_data *cam, struct v4l2_streamparm *parm)

 

This function will configures camera driver sending a struct of parameters. Take a look if you're configuring the camera using the right parameters (set on debugger if you need)

0 Kudos

1,502 Views
JoshuaParrish
Contributor I

Thanks Daiane,

 

After running the above mxc_v4l2_overlay

I get a dmesg that is 

In ov7725 ioctl_g_ifparm 0In ov7725 ioctl_g_frm_cap 0In ov7725 ioctl_g_chip_ident 0In ov7725 ioctl_enum_framesizes 0In ov7725 ioctl_enum_fmt_cap 0In mxc_v4l2_s_param 0In ov7725 ioctl_g_parm 0In ov7725 ioctl_g_parm 1In mxc_v4l2_s_param 1In mxc_v4l2_s_param 2In ov7725 ioctl_s_parm 0In ov7725 ioctl_g_parm 0In ov7725 init_mode 0Product ID 77:21ov7725 Addr = 0011 data = 01ov7725 Addr = 0022 data = 7fov7725 Addr = 0023 data = 03ov7725 Addr = 0012 data = 20ov7725 Addr = 000c data = 19ov7725 Addr = 0015 data = 00In ov7725 init_mode 1mxc_v4l2_s_param: vidioc_int_s_parm returned an error 1In ov7725 ioctl_g_parm 0In ov7725 ioctl_g_parm 1   case VIDIOC_S_FMTRGB565mxc_ipu mxc_ipu: IPU Error - IPU_INT_STAT_5 = 0x00200000IPU_CONF =      0x000006ACIDMAC_CONF =    0x0000002FIDMAC_CHA_EN1 =         0x00A00000IDMAC_CHA_EN2 =         0x00024000IDMAC_CHA_PRI1 =        0x18800001IDMAC_CHA_PRI2 =        0x00000000IDMAC_BAND_EN1 =        0x00000000IDMAC_BAND_EN2 =        0x00000000IPU_CHA_DB_MODE_SEL0 =  0x00A00000IPU_CHA_DB_MODE_SEL1 =  0x00004000DMFC_WR_CHAN =  0x00000090DMFC_WR_CHAN_DEF =      0x202020F6DMFC_DP_CHAN =  0x0000968ADMFC_DP_CHAN_DEF =      0x2020F6F6DMFC_IC_CTRL =  0x00000002IPU_FS_PROC_FLOW1 =     0x00000000IPU_FS_PROC_FLOW2 =     0x00000000IPU_FS_PROC_FLOW3 =     0x00000000IPU_FS_DISP_FLOW1 =     0x00000000mxc_ipu mxc_ipu: warning: disable ipu dma channel 21 during its busy statemxc_v4l_close: release resource

 

 

Then I ran /unit_tests/mxc_v4l2_capture.out -iw 640 -ih 480 -ow 640 -oh 480
in_width = 640, in_height = 480
out_width = 640, out_height = 480
top = 0, left = 0
sensor chip is ov7725
sensor frame size is 640x480
sensor frame format is UYVY
         Width = 640     Height = 480    Image size = 614400
         pixelformat = 1498831189
VIDIOC_DQBUF failed.
VIDIOC_QBUF failed

My dmesg:
In ov7725 ioctl_g_ifparm 0
In ov7725 ioctl_g_frm_cap 0
In ov7725 ioctl_g_chip_ident 0
In ov7725 ioctl_enum_framesizes 0
In ov7725 ioctl_enum_fmt_cap 0
In mxc_v4l2_s_param 0
In ov7725 ioctl_g_parm 0
In ov7725 ioctl_g_parm 1
In mxc_v4l2_s_param 1
In mxc_v4l2_s_param 2
In ov7725 ioctl_s_parm 0
In ov7725 ioctl_g_parm 0
In ov7725 init_mode 0
Product ID 77:21
ov7725 Addr = 0011 data = 03
ov7725 Addr = 0022 data = 7f
ov7725 Addr = 0023 data = 03
ov7725 Addr = 0012 data = 20
ov7725 Addr = 000c data = 19
ov7725 Addr = 0015 data = 00
In ov7725 init_mode 1
mxc_v4l2_s_param: vidioc_int_s_parm returned an error 1
   case VIDIOC_S_FMT
UYVY
mxc_ipu mxc_ipu: IDMAC20's EBA0 is not 8-byte aligned
mxc_ipu mxc_ipu: IDMAC20's EBA1 is not 8-byte aligned
mxc_ipu mxc_ipu: IPU Error - IPU_INT_STAT_5 = 0x00100000
ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0
ERROR: v4l2 capture: VIDIOC_QBUF: buffer already queued
IPU_CONF =      0x000006A4
IDMAC_CONF =    0x0000002F
IDMAC_CHA_EN1 =         0x00900000
IDMAC_CHA_EN2 =         0x00000000
IDMAC_CHA_PRI1 =        0x18800001
IDMAC_CHA_PRI2 =        0x00000000
IDMAC_BAND_EN1 =        0x00000000
IDMAC_BAND_EN2 =        0x00000000
IPU_CHA_DB_MODE_SEL0 =  0x00900000
IPU_CHA_DB_MODE_SEL1 =  0x00000000
DMFC_WR_CHAN =  0x00000090
DMFC_WR_CHAN_DEF =      0x202020F6
DMFC_DP_CHAN =  0x0000968A
DMFC_DP_CHAN_DEF =      0x2020F6F6
DMFC_IC_CTRL =  0x00000002
IPU_FS_PROC_FLOW1 =     0x00000000
IPU_FS_PROC_FLOW2 =     0x00000000
IPU_FS_PROC_FLOW3 =     0x00000000
IPU_FS_DISP_FLOW1 =     0x00000000
mxc_ipu mxc_ipu: warning: disable ipu dma channel 20 during its busy state
mxc_v4l_close: release resource

 

 

 

 

Then I ran  gst-launch mfw_v4lsrc ! mfw_v4lsink

MFW_GST_V4LSRC_PLUGIN 1.9.7-1 build on Jan 28 2011 13:26:16.MFW_GST_V4LSINK_PLUGIN 1.9.7-1 build on Jan 28 2011 13:35:23.Setting pipeline to PAUSED ...Pipeline is live and does not need PREROLL ...Setting pipeline to PLAYING ...New clock: GstSystemClockCaught SIGSEGV accessing address 0x18#0  0x2ad1c976 in ?? ()#1  0x2ad30722 in ?? ()Spinning.  Please run 'gdb gst-launch 13339' to continue debugging, Ctrl-C to quit, or Ctrl-\ to dump core.^CCaught interrupt -- handling interrupt.Interrupt: Stopping pipeline ...Execution ended after 16222320375 ns.Setting pipeline to PAUSED ...^C

with a dmesg of

In ov7725 ioctl_g_ifparm 0In ov7725 ioctl_g_frm_cap 0In mxc_v4l2_s_param 0In ov7725 ioctl_g_parm 0In ov7725 ioctl_g_parm 1In mxc_v4l2_s_param 1In mxc_v4l2_s_param 2In ov7725 ioctl_s_parm 0In ov7725 ioctl_g_parm 0In ov7725 init_mode 0Product ID 77:21ov7725 Addr = 0011 data = 01ov7725 Addr = 0022 data = 7fov7725 Addr = 0023 data = 03ov7725 Addr = 0012 data = 20ov7725 Addr = 000c data = 19ov7725 Addr = 0015 data = 00In ov7725 init_mode 1mxc_v4l2_s_param: vidioc_int_s_parm returned an error 1   case VIDIOC_S_FMTNV12mxc_ipu mxc_ipu: IDMAC20's EBA0 is not 8-byte alignedmxc_ipu mxc_ipu: IDMAC20's EBA1 is not 8-byte alignedmxc_ipu mxc_ipu: IPU Error - IPU_INT_STAT_5 = 0x00100000ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0mxc_v4l_close: release resource

 

As far as capture mode goes I am not sure exactly what you were getting at. 

In mxc_v4l2_overlay.c in the source bsp I see a capture mode setting that can be changed. 

With both capture modes there is no difference in what I see. 

0 Kudos

1,502 Views
daiane_angolini
NXP Employee
NXP Employee

I'm supposing you done the right job around adding ov7725 stuff into ov3640 driver.

 

Please, open mxc_v4l2_overlay and search for capture mode. I'm almost sure there is a hardcoded capture mode definition that would work only for ov3640 (and how I don't know your camera, I cannot tell you this is the same capture mode your camera needs)

 

 

Another tip would be using gstreamer to take a preview:

 

gst-launch mfw_v4lsrc ! mfw_v4lsink

 

I think it would work.

 

Please, post any log you got.

0 Kudos

1,502 Views
JoshuaParrish
Contributor I

Hake,

 

I guess I'm a little confused on what you need. 

What other settings would be helpful?

0 Kudos

1,502 Views
hake
NXP Employee
NXP Employee

can you post you setting here?

0 Kudos