CSI Camera on Android with AiStarVison MIPI Adapter V2.0

Hi all,

The ov5645 + AiStarVison MIPI adapter V2.0 + db410C works fine on Debian 16.06.
(through CSI-0, 2-lane, controlled by I2C2)

But on android, whether 5.1.1 or 6.0.1, I’ve tried with no luck :disappointed: :

for android 6.0.1 (linux_android_board_support_package_vla.br_.1.2.7-01010-8x16.0-4):
‘mm-qcamera-daemon’ seems bad, like this thread mentioned: Marshmallow camera support

for android 5.1.1 (linux_android_board_support_package_vla.br_.1.2.4-01810-8x16.0-3):
it seems there is something wrong with cci(i2c) and cannot read the ID of ov5645:

<3>[ 7.539662] msm_cci_init: Failed in getting TOP gdscr regulator handle
<6>[ 7.545325] msm_cci_init:763: hw_version = 0x10000008
<3>[ 7.550726] msm_cci_irq:930 MASTER_0 error 0x10000000
<3>[ 7.555334] msm_cci_i2c_read:428 read_words = 0, exp words = 1
<3>[ 7.561183] msm_cci_i2c_read_bytes:506 failed rc -22
<3>[ 7.566064] msm_camera_cci_i2c_read: line 48 rc = -22
<3>[ 7.571099] msm_sensor_match_id: ov5645: read id failed
<3>[ 7.579370] msm_sensor_check_id:1336 match id failed rc -22

Does anyone have succeeded in using CSI camera on Android(5 or 6)?
Any help will be appreciated :relaxed:

reference links:

http://www.ebay.com/itm/96Boards-MIPI-Adapter-with-OV5645-auto-focus-module/252921532336?_trksid=p2047675.c100011.m1850&_trkparms=aid%3D222007%26algo%3DSIC.MBE%26ao%3D1%26asc%3D40130%26meid%3D888b8b602f634572aa8e027d41de9d0f%26pid%3D100011%26rk%3D2%26rkt%3D3%26sd%3D132021014353

https://builds.96boards.org/releases/dragonboard410c/linaro/debian/16.06/

https://developer.qualcomm.com/hardware/dragonboard-410c/tools

Hello,
I did not try this specific setup, but if it works on Debian it should also work on Android.
Marshmallow release does not support camera, do not try it.
Lollipop release support it and it should work, so start there.
You should do the following to run the camera:

  1. Correctly define OV5645 to be connected to correct CSI lanes and gpios until the kernel will be able the probe the camera.

  2. Enable camera server in the init.rc file.

      Good Luck, Leonid.
1 Like

Hi bobhsiao,

could you share ov5645 + AiStarVison MIPI adapter V2.0 + db410C whether could work well on android L?

very thanks for your update.

Hi jasonz,

Yes, “ov5645 + AiStarVison MIPI adapter V2.0 + db410C” could work on android 5.1.1.
here are my steps:

** software:

  • modify: device/qcom/msm8916_64/init.target.rc: comment out the ‘disabled’ at line 76, to enable qcamerasvr.

** hardware:

  • connect I2C2_SDA/SCL to CAM2_SDA/SCL on MIPI adapter, as shown below:

  • the ov5645 module should be connected to J4 on MIPI adapter.

that’s all :blush:

Hi bobhsiao,

Really appreciate for your share. So CSI camera also could works well in android 6.0.1.

one more question is in android system, do you try any bayer raw sensor? I saw many developer want to check raw10/raw12 whether is supported well and whether could be transformed to common 2bytes format through VFE driver in db410c of android now.

Thanks again and I will follow your steps. Hope to discuss with you later.

Hi jasonz,

It seems CSI camera could NOT work in Marshmallow, leonid has mentioned it.

Hi leonid,

Per previous issue of csi camera in Marshmallow release (CANNOT LINK EXECUTABLE: cannot locate symbol “af_haf_tof_update_func_tbl” referenced by “/system/vendor/lib/libmmcamera2_q3a_core.so”…), is it because that many camera functions code are not included in Marshmallow release?

So if we could comment out these function call, basic camera feature could also run in M, right? and of course the best way is according patches could be updated in QDN for us.

Thanks!

Hello,
I did not tried to comment out function calls, so maybe it will work.
As i understand there is no plans to add camera support to Android M, so do not expect any updates in QDN.
Thank you, Leonid.

Hi leonid,

Thanks for quickly support.

And there is a question confused me that I found camera node is configured in blsp_i2c6 bus in apq8016-sbc.dtsi of debian, not in cci bus. But in android dts, camera node is configured in cci bus generally. Actually camera sensor control interface is connected to cci bus by the HW schematic design, and camera sensor could works well on both debian and android. So could you share why?

snippet
/----------------------------------------------------------------------------/
&blsp_i2c6 {
status = “ok”;

    camera_rear@76 {
            compatible = "ovti,ov5645";
            reg = <0x76>;

            enable-gpios = <&msmgpio 34 0>;
            reset-gpios = <&msmgpio 35 1>;
            pinctrl-names = "default";
            pinctrl-0 = <&camera_rear_default>;

            clocks = <&gcc GCC_CAMSS_MCLK0_CLK>;
            clock-names = "xclk";
            clock-frequency = <23880000>;

            vdddo-supply = <&camera_vdddo_1v8>;
            vdda-supply = <&camera_vdda_2v8>;
            vddd-supply = <&camera_vddd_1v5>;

            status = "disabled";

            port {
                    ov5645_ep: endpoint {
                            clock-lanes = <1>;
                            data-lanes = <0 2>;
                            remote-endpoint = <&csiphy0_ep>;
                    };
            };
    };

/--------------------------------------------------------------------------------------/
snippet

Thanks!
Jasonz

Hello,
The two interfaces (CCI and I2C6) share the same pins,
I assume in Android the camera uses CCI bus and in Linux it is easier to use I2C (there is no need to implement CCI driver).
Thank you, Leonid.

Hi leonid,

Sorry to disturb u again.

For blsp_i2c6, gpio22 and gpio23 are configured and used.

For cci0, only one cci interface in db410c, and gpio29 and gpio30 is configured and used.

So how is share the same gpio?

Thanks!
Jasonz

This is just a temporary solution with the current temporary CCI driver. A proper implementation of the CCI driver is in progress and this will be fixed. The cci uses its own pins, as you have seen.

Hi todor,

Thanks for share the info, and also thanks for leonid.

So camera sensor is connected to gpio29 and gpio30, and it is temporary CCI driver based i2c on debian system.

Thanks!
Jasonz

Hi bobhsiao,

Excuse me, what apk do you used for camera preview/capture/recording? or you used mm-qcamera-app to test camera without UI?

Thanks!
Jasonz

Hi jasonz,

I used this to test camera: https://play.google.com/store/apps/details?id=hibernate.v2.testyourandroid
I just test preview function only

Best Regards.

1 Like

Hi todor,

we had try ov5645 on android L, the sympton as following,

  1. default ov5645 is configured with csiphy1/csid1, front camera in dtsi, and we also use default libmmcamera_ov5645.so, then ov5645 could preview as front camera on android.

  2. we try modify ov5645 to csiphy0/csid0, rear camera in dtsi, then camera open failed by HAL.

So I suspect the reason is default libmmcamera_ov5645.so which provided is only support csi1, is it right?

for csi0, need to modify source code and replace libmmcamera_ov5645.so.

Thanks!
Jasonz

Hi @jasonz

I tried a simple experiment with Debian Linux. I have two different Mezzanine boards that support dual OV5645 cameras, one from STMicro, and one from AiStarVision. When I use the STMicro board I can enable either of both cameras by simply enabling them in the file arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi. When I use the AiStarVision mezzanine card, enabling csiphy0_ep works as expected, but enabling csiphy1_ep does not work (fails to enumerate).

I have not debugged the issue at this time, it could be as simple as not setting a jumper correctly, or the AiStarVision card may use different I2C connections for the second camera.

I have a suspicion that this difference is also the reason your camera is not working under Android.

Full Disclosure: I am an employee of Qualcomm Canada any opinions I may have expressed in this or any other post may not reflect the opinions of my employer.

Hi ljking,

Thanks for your response.

I have run two ov5645 camera successfully on AiStarVision MIPI Adapter V2.0, Android L 5.1.1.

For front camera ov5645, we should make the connection per above share of bobhsiao.

For rear camera ov5645, the modification should be as following,

** software:

modify: 1) device/qcom/msm8916_64/init.target.rc: comment out the 'disabled' at line 76, to enable qcamerasvr.
             2) change dtsi and libmmcamera_ov5645.so to csiphy/csid channel 0, position 0, right gpio/mclk setting.

** hardware:

1) connect I2C2_SDA/SCL to CAM1_SDA/SCL on MIPI adapter, this is convenient by jumper. 
2) the ov5645 module should be connected to J3 on MIPI adapter.

Thanks!
Jasonz

1 Like

Has there been any progress on this? Ideally I’d like to use the CCI i2c bus for the camera and the blsp_i2c6 for another i2c device. Is this possible? Would it just be a change to the DT - replacing blsp_i2c6 with cci?

Yes, you can expect the new CCI driver in the next Linaro release. The camera nodes will be removed from blsp_i2c6 and put in a new cci node in DT.