AnsweredAssumed Answered

Problems with RPi2 camera and Yocto

Question asked by evan kahn on Jul 1, 2016
Latest reply on Aug 9, 2016 by evan kahn


Hi all -

 

I am trying to get video4linux working with the Raspberry Pi 2 camera (board v.1.3, sensor model OV5647), which is plugged into the MIPI/CSI port on my i.mx6 developer board (QWKS-SCMIMX6). Thus far it is recognized as an i2c device but does not show up under /dev/video0.

 

I am new to working with the Linux kernel and I can retrace the steps taken to get here -- please let me know if I have any misunderstandings that are leading to this not working.

 

I did a relatively clean build of yocto, starting from the meta-fsl-arm layer, and applied board-specific patch files for the SCM-IMX6.

 

After an initial build where I confirmed that yocto worked and booted, I spent a while grepping through the device tree files. Eventually I found the following code in the build folder, in the device tree file /arch/arm/boot/dts/imx6q.dtsi:

 

 aips-bus@02100000 { /* AIPS2 */
                        mipi_dsi: mipi@021e0000 {
                                compatible = "fsl,imx6q-mipi-dsi";
                                reg = <0x021e0000 0x4000>;
                                interrupts = <0 102 0x04>;
                                gpr = <&gpr>;
                                clocks = <&clks IMX6QDL_CLK_HSI_TX>, <&clks IMX6QDL_CLK_VIDEO_27M>;
                                clock-names = "mipi_pllref_clk", "mipi_cfg_clk";
                                status = "disabled";
                        };
                };

 

So I pushed a patch that changed status = "disabled" to status="enabled". I do not know if this was the right thing to do, but it seemed to make sense. The patch worked and yocto compiled without any issues.

 

After flashing to an SD card and booting the device, I then made sure that the proper kernel modules were present. Using this page as a rough guide and looking through modules.dep, I found that the kernel modules I wanted to get the camera to work were at least present: ov5647_camera_mipi.ko, and mxc_v4l2_capture. I also double-checked with "bitbake -c configure virtual/kernel" that all of the kernel drivers required to run the ov5647 were configured to be installed in the recipe. (By the way, HDMI output works properly, and I can confirm that v4l can output test patterns, just not read input from a camera. I have also tested the Pi camera with a Raspberry Pi and it worked fine.)

 

I used modprobe to enable ov5647_camera_mipi, v4l2_int_device, and mxc_v4l2_capture. The latter module also turned on several dependencies. At that point lsmod returned a list of dependencies equal to the one on the previously linked Tinyrex webpage, the only difference being that v4l2_int_device did not rely on ov5647_camera_mipi. Using i2cdetect I could see that the camera was showing up at i2c1, address 0x36; exactly what I expected. However, when I use i2cdump on that address I get all zeroes with maybe 2 bytes of data; and nothing shows up as /dev/video0.

 

I also tried using modules-load.d to load the three modules at boot. None of it made a difference. I grepped through dmesg to try and find any mention of a camera or an i2c device that looked familiar; still nothing under /dev/video0.

 

Most recently I rolled back the change that I made with the kernel patch above and repeated all these steps again to no avail.

 

If anyone could shed a little bit of light on why this isn't working it would be very much appreciated. I'm happy to provide any information that might be needed to troubleshoot this problem. Thanks very much!

Outcomes