how to interface camera hm5065 in imx6sl

cancel
Showing results for 
Search instead for 
Did you mean: 

how to interface camera hm5065 in imx6sl

652 Views
Contributor II

hi everyone,

i am working imx6sl custom board. using 4.4.2 kitkat kernel 3.0.35..

i started to work on camera interface heg module  H004JWP-WM8-C .using hm5065 sensor connected in i2c2 interface.

IN   my board file 

{

   I2C_BOARD_INFO("hm5065", 0x3E),

                   .platform_data = (void *)&camera_data,

}

static struct fsl_mxc_camera_platform_data camera_data = {

  .mclk = 24000000,

        .mclk_source = 0,

  .csi = 0,

  .io_init = mx6sl_csi_io_init,

  .pwdn = mx6sl_csi_cam_powerdown,

  .core_regulator = "VGEN2_1V5",

  .analog_regulator = "VGEN6_2V8",

};

static void mx6sl_csi_io_init(void)

{

mxc_iomux_v3_setup_multiple_pads(mx6sl_brd_csi_enable_pads, \

  ARRAY_SIZE(mx6sl_brd_csi_enable_pads));  

// Camera power down

  gpio_request(MX6SL_BRD_CSI_PWDN, "cam-pwdn");

  gpio_direction_output(MX6SL_BRD_CSI_PWDN, 1);

  msleep(5);

  gpio_set_value(MX6SL_BRD_CSI_PWDN, 0);

  msleep(5);

  gpio_set_value(MX6SL_BRD_CSI_PWDN, 1);

static void mx6sl_csi_cam_powerdown(int powerdown)

{

  if (powerdown)

  gpio_set_value(MX6SL_BRD_CSI_PWDN, 1);

  else

  gpio_set_value(MX6SL_BRD_CSI_PWDN, 0);

}

static iomux_v3_cfg_t mx6sl_brd_csi_enable_pads[] = {

  MX6SL_PAD_EPDC_GDRL__CSI_MCLK,

        MX6SL_PAD_I2C2_SCL__I2C2_SCL,

  MX6SL_PAD_I2C2_SDA__I2C2_SDA,

  MX6SL_PAD_EPDC_GDCLK__CSI_PIXCLK,

  MX6SL_PAD_EPDC_GDSP__CSI_VSYNC,

  MX6SL_PAD_EPDC_GDOE__CSI_HSYNC,

  MX6SL_PAD_EPDC_SDLE__CSI_D_9,

  MX6SL_PAD_EPDC_SDCLK__CSI_D_8,

  MX6SL_PAD_EPDC_D7__CSI_D_7,

  MX6SL_PAD_EPDC_D6__CSI_D_6,

  MX6SL_PAD_EPDC_D5__CSI_D_5,

  MX6SL_PAD_EPDC_D4__CSI_D_4,

  MX6SL_PAD_EPDC_D3__CSI_D_3,

  MX6SL_PAD_EPDC_D2__CSI_D_2,

}

added my driver hm5065.c  under  drivers/media/video/mxc/capture/<.c>

then in kconfig

  drivers/media/video/mxc/capture/kconfig

config MXC_CAMERA_HM5065

  tristate "hm5065 camera support for rockchip":

        depends on !VIDEO_MXC_EMMA_CAMERA

  select MXC_CAMERA_SENSOR_CLK

  #depends on SOC_CAMERA && I2C

  help

   This is a HM5065 camera driver for rockchip

in imx6s_android_defconfig

CONFIG_MXC_CAMERA_HM5065=Y

I done these things.. my driver file is compiled. and its loaded while booting. but i get error as

hm5065_read_reg:write reg error:reg=0

it was due to i2c_master_send got failed

but in i2cdetect -y 1

i can found address as 0x1f.. but my address is 0x3e.

Labels (1)
0 Kudos
16 Replies

13 Views
Contributor II

i changed the address now my driver loaded ..

i dint get any error..

how to implement HAL LAYER  in init. rc i edited as

setprop back_camera_name hm5065

    setprop back_camera_orient 90

0 Kudos

13 Views
NXP TechSupport
NXP TechSupport

In the Android documentation, there is Android_Frequently_Asked_Questions.pdf. Please read the section 25 for the camera.

0 Kudos

13 Views
Contributor II

hi jimmychan,

ya i configured as per the document in init.rc file.

setprop back_camera_name hm5065

    setprop back_camera_orient 90

if i give logcat | grep HAL

I/FslCameraHAL( 2136): Face Back Camera is hm5065, orient is 90

I/FslCameraHAL( 2136): Face Front Camera is 0, orient is 0

I/FslCameraHAL( 2136): Camera ID 0: name hm5065, Facing 0, orientation 90, dev path

in dev folder i got video1 by static.. for camera.

my doubt is whether i should get single video1 alone or  list of video*?

i configured power down pin  should high.

as per hm5065  driver there is no need  of reset pin in driver file.

should i configure reset pin ?

i dont know

0 Kudos

13 Views
Contributor II

how to probe camera further..

i browsed  in fsl community.. saying about gst plugins.. kindly help me  where i stuck ...

i attached my boot log..

0 Kudos

13 Views
NXP TechSupport
NXP TechSupport

I cannot see any error message about your camera. I think the driver is loaded and the camera chip ID can be read via I2C.

0 Kudos

13 Views
Contributor II

thanks jimmychan,

but when i click camera app it showing can't connect to the camera.

i don know  why it showing like this..

0 Kudos

13 Views
Contributor II

hi,

i had  doubt in csi and ipu  whether it should 0 or 1.. ??

what about this file mxc_v4l2_capture??

0 Kudos

13 Views
NXP TechSupport
NXP TechSupport

there is no ipu in i.mx6SL. you don't need to set the ipu number. and csi number..

0 Kudos

13 Views
Contributor II

Thanks jimmychan,

everthing is fine.

but why its showing can't connect to camera??

0 Kudos

13 Views
NXP TechSupport
NXP TechSupport

any error show in logcat when you are using the camera app?

0 Kudos

13 Views
Contributor II

hi jimmychan,

ya while click on the camera application iam getting error..

01-02 00:07:35.710 W/InputMethodManagerService( 2480): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@41c22840 attribute=null, token = andr8

01-02 00:07:48.450 I/ActivityManager( 2480): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.camera/.Camera bnds=[137,231][203,297]} 3

V/CameraHolder( 3038): open camera 0

01-02 00:09:53.100 E/CameraService( 2136): CameraService::connect X (pid 3038) rejected (invalid cameraId 0).

01-02 00:09:53.100 W/CameraBase( 3038): An error occurred while connecting to camera: 0

01-02 00:09:53.100 E/CameraHolder( 3038): fail to connect Camera

01-02 00:09:53.100 E/CameraHolder( 3038): java.lang.RuntimeException: Fail to connect to camera service

01-02 00:09:53.100 E/CameraHolder( 3038):       at android.hardware.Camera.native_setup(Native Method)

01-02 00:09:53.100 E/CameraHolder( 3038):       at android.hardware.Camera.<init>(Camera.java:350)

01-02 00:09:53.100 E/CameraHolder( 3038):       at android.hardware.Camera.open(Camera.java:309)

01-02 00:09:53.100 E/CameraHolder( 3038):       at com.android.camera.CameraHolder.open(CameraHolder.java:131)

01-02 00:09:53.100 E/CameraHolder( 3038):       at com.android.camera.Util.openCamera(Util.java:267)

01-02 00:09:53.100 E/CameraHolder( 3038):       at com.android.camera.Camera$4.run(Camera.java:1100)

01-02 00:09:53.100 E/CameraHolder( 3038):       at java.lang.Thread.run(Thread.java:841)

0 Kudos

13 Views
Contributor II

Hi ,

is there any solution?..

0 Kudos

13 Views
NXP TechSupport
NXP TechSupport

is there a "video0" in /dev/ ?

0 Kudos

13 Views
Contributor II

hi Jimmychan,

ya i am getting video0 under /dev

i also cheked under sys/class/video4linux/videoo/cat name

it shows hm5065

0 Kudos

13 Views
Contributor II

hi

i confirmed that my cameraid is taking as 0 and numberofcameras is also 0. so only iam getting below error .

01-02 00:09:53.100 E/CameraService( 2136): CameraService::connect X (pid 3038) rejected (invalid cameraId 0).

how to get correct cameraid and numberofcameras.

I/CameraService( 2100): CameraService started (pid=2100)

I/CameraService( 2100): Loaded "Freescale CameraHal Module" camera module

I/FslCameraHAL( 2100): Face Back Camera is hm5065, orient is 0

I/FslCameraHAL( 2100): Face Front Camera is 0, orient is 0

I/FslCameraHAL( 2100): Camera ID 0: name hm5065, Facing 0, orientation 0, dev path

I/PackageManager( 2455): /system/priv-app/GoogleCamera.apk changed; collecting certs

I/PackageManager( 2455): /system/app/LegacyCamera.apk changed; collecting certs

W/PackageManager( 2455): Package com.google.android.GoogleCamera desires unavailable shared library com.google.android.media.effects; ignoring!

W/PackageManager( 2455): Package com.google.android.GoogleCamera desires unavailable shared library com.google.android.gestureservice; ignoring!

W/PackageManager( 2455): Package com.google.android.GoogleCamera desires unavailable shared library com.google.android.camera2; ignoring!

W/PackageManager( 2455): Unknown permission com.google.android.gallery3d.permission.GALLERY_PROVIDER in package com.google.android.GoogleCamera

W/PackageManager( 2455): Unknown permission com.google.android.providers.gsf.permission.READ_GSERVICES in package com.google.android.GoogleCamera

I/PackageManager( 2455): Running dexopt on: com.google.android.GoogleCamera

W/PackageManager( 2455): Unknown permission com.google.android.gallery3d.permission.GALLERY_PROVIDER in package com.google.android.GoogleCamera

W/PackageManager( 2455): Unknown permission com.google.android.providers.gsf.permission.READ_GSERVICES in package com.google.android.GoogleCamera

I/ActivityManager( 2455): Start proc com.google.android.GoogleCamera for broadcast com.google.android.GoogleCamera/com.android.camera.DisableCameraReceiver: pid=2955 uid=10007 gids={50007, 3003, 1}

I/DisableCameraReceiver( 2955): no back camera

I/DisableCameraReceiver( 2955): disable all camera activities

I/ActivityManager( 2455): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.camera/.Camera bnds=[137,231][203,297]} from pid 2828

I/ActivityManager( 2455): Start proc com.android.camera for activity com.android.camera/.Camera: pid=3184 uid=10030 gids={50030, 1028, 1015}

V/CameraHolder( 3184): open camera 0

E/CameraService( 2100): CameraService::connect X (pid 3184) rejected (invalid cameraId 0).

W/CameraBase( 3184): An error occurred while connecting to camera: 0

E/CameraHolder( 3184): fail to connect Camera

E/CameraHolder( 3184): java.lang.RuntimeException: Fail to connect to camera service

E/CameraHolder( 3184):  at android.hardware.Camera.native_setup(Native Method)

E/CameraHolder( 3184):  at android.hardware.Camera.<init>(Camera.java:350)

E/CameraHolder( 3184):  at android.hardware.Camera.open(Camera.java:309)

E/CameraHolder( 3184):  at com.android.camera.CameraHolder.open(CameraHolder.java:131)

E/CameraHolder( 3184):  at com.android.camera.Util.openCamera(Util.java:267)

E/CameraHolder( 3184):  at com.android.camera.Camera$4.run(Camera.java:1100)

E/CameraHolder( 3184):  at java.lang.Thread.run(Thread.java:841)

I/ActivityManager( 2455): Displayed com.android.camera/.Camera: +692ms

I/ActivityManager( 2455): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.camera/.Camera bnds=[137,231][203,297]} from pid 2828

V/CameraHolder( 3184): open camera 0

E/CameraService( 2100): CameraService::connect X (pid 3184) rejected (invalid cameraId 0).

W/CameraBase( 3184): An error occurred while connecting to camera: 0

E/CameraHolder( 3184): fail to connect Camera

0 Kudos

13 Views
Contributor II

hi everyone

Another issue is my camera module is getting heat..

my iovdd is 2.8v 

anolog vdd is 2.8 

core volt is 1.8

0 Kudos