AnsweredAssumed Answered

iMX7D custom board OV5640 not working in Android Marshmallow

Question asked by shravan kumar on Jul 6, 2017
Latest reply on Jul 6, 2017 by igorpadykov

Hi All,

 

Please help to solve the problem. my project is delayed because of camera.

I am using iMX7D custom board with NXP Android M6.0.1_2.1.0 BSP (4.1 kernel).

problem : ov5640 is not working

camera driver probed properly and /dev/video0 node also created ...

 

Android camera open failed logcat :

*********************************************************************************

 959 I ActivityManager: Start proc 1370:com.android.camera/u0a33 for activity com.android.camera/.Camera
1370 I art     : Late-enabling JIT
1370 I art     : JIT created with code_cache_capacity=2MB compile_threshold=1000
 675 W art     : Long monitor contention event with owner method=void com.android.server.wm.WindowAnimator$1.doFrame(long) from WindowAnimator.
 1385 V CameraHolder: open camera 0
  834 I CameraService: CameraService::connect call (PID 1370 "com.android.camera", camera ID 0) for HAL version default and Camera API version 1
  834 W AudioFlinger: acquireAudioSessionId() unknown client 1370 for session 26
 1387 D NuPlayerDriver: notifyListener_l(0xb5f57680), (1, 0, 0)
  834 W AudioFlinger: acquireAudioSessionId() unknown client 1370 for session 27
 1389 D NuPlayerDriver: notifyListener_l(0xb5f57620), (1, 0, 0)
  834 W AudioFlinger: acquireAudioSessionId() unknown client 1370 for session 28
 1391 D NuPlayerDriver: notifyListener_l(0xb5f57320), (1, 0, 0)
  834 I CameraClient: Opening camera 0
  834 I FslCameraHAL: camera_device open: 0
  834 I FslCameraHAL: initialize name:csi, path:/dev/video0
  834 I FslCameraHAL: DeviceAdapter: Create ov5640 device
  834 I FslCameraHAL: sfmt[0]=NV12, dfmt[0]=YUYV
  834 I FslCameraHAL: sfmt[1]=YUYV, dfmt[0]=YUYV
  834 I FslCameraHAL: pixel format: 0x14
  834 I FslCameraHAL: sfmt[0]=NV12, dfmt[0]=YUYV
  834 I FslCameraHAL: sfmt[1]=YUYV, dfmt[0]=YUYV
  834 I FslCameraHAL: pixel format: 0x14
  834 I FslCameraHAL: SupportedPictureSizes is
  834 I FslCameraHAL: SupportedPreviewSizes is
  834 I FslCameraHAL: SupportedFPS is 15,30
  834 I FslCameraHAL: Preview callback not enabled c0d
  834 I FslCameraHAL: enableMsgType 0xc0d
 1395 D Camera  : app passed NULL surface
--------- beginning of crash
1395 E AndroidRuntime: FATAL EXCEPTION: Thread-116
1395 E AndroidRuntime: Process: com.android.camera, PID: 1370
1395 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke interface method 'java.util.Iterator java.lang.Iterable.iterator()' on
 a null object reference
1395 E AndroidRuntime:        at com.android.camera.CameraSettings.setCameraPictureSize(CameraSettings.java:126)
1395 E AndroidRuntime:        at com.android.camera.Camera.updateCameraParametersPreference(Camera.java:1950)
1395 E AndroidRuntime:        at com.android.camera.Camera.setCameraParameters(Camera.java:2070)
1395 E AndroidRuntime:        at com.android.camera.Camera.startPreview(Camera.java:1858)
1395 E AndroidRuntime:        at com.android.camera.Camera.-wrap13(Camera.java)
1395 E AndroidRuntime:        at com.android.camera.Camera$4.run(Camera.java:1112)
1395 E AndroidRuntime:        at java.lang.Thread.run(Thread.java:818)
 959 W ActivityManager:   Force finishing activity com.android.camera/.Camera
 959 I WindowManager: Screenshot max retries 4 of Token{da433d ActivityRecord{b622c94 u0 com.android.camera/.Camera t114 f}} appWin=Window{6e5c
83 u0 Starting com.android.camera} drawState=4

*********************************************************************************

 

My kernel patch:

*********************************************************************************

&csi1 {
       csi-mux-mipi = <&gpr 0x14 4>;
       status = "okay";

       port {
               csi_ep: endpoint {
                       remote-endpoint = <&csi_mipi_ep>;
               };
       };
};

&mipi_csi {
       clock-frequency = <240000000>;
       status = "okay";
       port {
               mipi_sensor_ep: endpoint1 {
                       remote-endpoint = <&ov5640_mipi_ep>;
                       data-lanes = <2>;
                       csis-hs-settle = <13>;
                       csis-clk-settle = <2>;
                       csis-wclk;
               };

               csi_mipi_ep: endpoint2 {
                       remote-endpoint = <&csi_ep>;
               };

       };
};

 

&i2c4 {
       ov5640_mipi: ov5640_mipi@3c {
               compatible = "ovti,ov5640_mipi";
               pinctrl-names = "default";
               pinctrl-0 = <&pinctrl_ov5640>;
               reg = <0x3c>;
               clocks = <&clks IMX7D_CLK_DUMMY>;
               clock-names = "csi_mclk";
               csi_id = <0>;
               pwn-gpios = <&gpio4 19 GPIO_ACTIVE_HIGH>;
               rst-gpios = <&gpio4 18 GPIO_ACTIVE_HIGH>;
               AVDD-supply = <&vgen6_reg>;
               mclk = <24000000>;
               mclk_source = <0>;
               status = "okay";
               port {
                       ov5640_mipi_ep: endpoint {
                               remote-endpoint = <&mipi_sensor_ep>;
                       };
               };
};

***********************************************************************

 

Thanks,

Shravan.

Outcomes