/dev/video0: No Buffer Space Available error with mipi csi2

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

/dev/video0: No Buffer Space Available error with mipi csi2

2,300 Views
srinivasaporam
Contributor II

Hi,

We have got IMX6D custom designed board designed based on imx6Q reference board (Wandboard). in custom board we have 512 MB LPDDR2  where as reference board has 1GB/2GB DDR3 RAM.

Now we have connected mipi csi2 camera (Raspi camera (connector is also customized with 15 pin connector)).

When I am running the command for capturing image or video using avconv or gst-launch-1.0 then, image is not being captured.

When iam running the command as :

$ sudo avconv -f video4linux2 -r 30 -s 640x480 -i /dev/video0 out.avi (or)

$ sudo avconv -f video4linux2 -s 640x480 -i /dev/video0 -ss 0:0:2 -frames 1 test.jpg

then it is giving error as ioctl VIDIOC_REQBUFs

and "/dev/video0: No buffer space available"

Since ov5647 has on board crystal which generates 25 MHz clock, we are using mipi_dphy_clk = <0x28> is this correct or not?? in some cases, it is been given that mipi_dphy_clk = <0x14>??? which one we should use ????

When we are running this command, we are getting CSI_D0M,CSI_D0P, CSI_D1M, CSI_D1P correctly and laos getting 25 MHz clock from the crystal.

But we are not observing CSI_CLK0M (CN), CSI_CLK0P (CP) are not coming???? what could be the reason.

    $gst-launch-1.0 v4l2src device="/dev/video0" num-buffers=1 ! video/x-bayer,width=640,height=480,framerate=1/1 ! bayer2rgb ! videoconvert ! jpegenc ! filesink location=sample_640_480.jpeg

then it is forming sample_640_480.jpeg file but it is not opening.

in all the above commands, when we are entering/running then led on the camera board is glowing and not when terminating the command, then led is going off.

Following are the findings:

1. camera sensor is being detecting in i2c by using i2c-tools (i2cdetect)

root@ubuntu:~# i2cdetect -y 2

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f

00:          -- -- -- -- -- -- -- -- -- -- -- -- --

10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

30: -- -- -- -- -- -- UU -- -- -- -- -- -- -- -- --

40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

70: -- -- -- -- -- -- -- --  

2.

root@ubuntu:~# lsmod

Module                  Size  Used by

mxc_v4l2_capture       28532  1

ipu_bg_overlay_sdc      5401  1 mxc_v4l2_capture

ipu_still               2528  1 mxc_v4l2_capture

ipu_prp_enc             5943  1 mxc_v4l2_capture

ipu_csi_enc             3863  1 mxc_v4l2_capture

ipu_fg_overlay_sdc      6217  1 mxc_v4l2_capture

ov5647_camera_mipi     30906  0

which one we should use mipi_dphy_clock = <0x28> or mipi_dphy_clock = <0x14> if our camera sensor's clock is 25 MHz.

when iam dumping mipi csi2 regs by using devmem2 tool

[root@erez]# devmem 0x21dc000

0x3130302A

[root@erez]# devmem 0x21dc004

0x1

[root@erez]# devmem 0x21dc008

0x1

[root@erez]# devmem 0x21dc00c

0x1

[root@erez]# devmem 0x21dc010

0x1

[root@erez]# devmem 0x21dc014

0x200

[root@erez]# devmem 0x21dc018

0x0

[root@erez]# devmem 0x21dc020

0x00000000

[root@erez]# devmem 0x21dc024

0x0

[root@erez]# devmem 0x21dc02c

0x00000000

[root@erez]# devmem 0x21dc030

0x0

[root@erez]# devmem 0x21dc034

0x0

How resolve the issues????

Labels (5)
0 Kudos
5 Replies

1,411 Views
srinivasaporam
Contributor II

Hi,

This is my dts file for your reference (wrt mipi csi2)

v4l2_cap_0 {

        compatible = "fsl,imx6q-v4l2-capture";

        ipu_id = <0>;

        csi_id = <1>;

                //csi_id = <0>;

        mclk_source = <0>;

                mipi_camera = <1>;

                default_input = <1>;

        status = "okay";

    };

    v4l2_out {

        compatible = "fsl,mxc_v4l2_output";

        status = "okay";

    };

&i2c3 {

        clock-frequency = <100000>;

        pinctrl-names = "default";

        pinctrl-0 = <&pinctrl_i2c3_3>;

        status = "okay";

       

       ov5647_mipi@36 {

        compatible = "ovti,ov5647_mipi";

        reg = <0x36>;

        // Pi camera has its own 25MHz clock.

        clocks = <&clks 0>;

        clock-names = "csi_mclk";

       

        DOVDD-supply = <&reg_3p3v>;

        AVDD-supply = <&reg_3p3v>;

        DVDD-supply = <&reg_3p3v>;

        pwn-gpios = <&gpio5 31 GPIO_ACTIVE_HIGH>;

        led-gpios = <&gpio5 19 GPIO_ACTIVE_HIGH>;

        ipu_id = <0>;

        csi_id = <1>;

                //csi_id = <0>;

       

       mclk = <25000000>;

        mclk_source = <0>;

        //pinctrl-names = "default";

        //pinctrl-0 = <&pinctrl_mipi_csi_1>;

         extended-buffer;

          

      };

       

};

&iomuxc {

    pinctrl-names = "default";

    pinctrl-0 = <&pinctrl_hog_1>;

    imx6qdl-wandboard {

        pinctrl_hog_1: hoggrp-1 {

            fsl,pins = <

                             

                                MX6QDL_PAD_CSI0_DAT12__GPIO5_IO30            0x80000000

                                 MX6QDL_PAD_CSI0_DAT13__GPIO5_IO31            0x0f0b0

                                MX6QDL_PAD_CSI0_MCLK__GPIO5_IO19                0x80000000

              >;

};

};

};

&mipi_csi {

    ipu_id = <0>;

    csi_id = <1>;

        //csi_id = <0>;

    v_channel = <0>;

    lanes = <2>;

        mipi_dphy_clk = <0x28>;

    status = "okay";

};

Still the problem is that v4l2_int_device entry is not there??? what could be possible error....

0 Kudos

1,411 Views
srinivasaporam
Contributor II

Hi,

I already had v4l2_cap_0 for mipi_camera. But still it is not creating any entry for v4l2_int_device.

0 Kudos

1,411 Views
srinivasaporam
Contributor II

Hi,

Thanks for the reply. I have already run the lsmod command. ov5647_camera_mipi entry is there but v4l2_int_device  entry is not there. Please find output of my lsmod as below:

root@ubuntu:~# lsmod

Module                  Size  Used by

mxc_v4l2_capture       28532  1

ipu_bg_overlay_sdc      5401  1 mxc_v4l2_capture

ipu_still               2528  1 mxc_v4l2_capture

ipu_prp_enc             5943  1 mxc_v4l2_capture

ipu_csi_enc             3863  1 mxc_v4l2_capture

ipu_fg_overlay_sdc      6217  1 mxc_v4l2_capture

ov5647_camera_mipi     30906  0

why v4l2_int_device entry is not there. what could be the problem?????? i have v4l2_int_device.c file and v4l2_int_device.h files. What could be possible error

0 Kudos

1,411 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hi

Looks like you need also add the v4l2_cap_0 for mipi_camera on your dts file.

/Regards

0 Kudos

1,411 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hi Srinivasa Poram,

Since the I2c is already in communication with the camera, I suggest to use mipi_csi configuration as show:

&mipi_csi {

  ipu_id = <0>;

  csi_id = <1>;

  v_channel = <0>;

  lanes = <2>;

  mipi_dphy_clk = <0x28>;

  status = "okay";

};

Once you boot the board make sure that the ov5647 is loaded on your modules:

$ lsmod

ov5647_camera_mipi     30906  0

v4l2_int_device         2930  2 ov5647_camera_mipi,mxc_v4l2_capture

hope this helps

0 Kudos