What I need to do with MIPI adater?

Current issue

I was bought MIPI stereo camera adaptor and two of ov5645 cameras in eBay.
And I’m trying to it works well on my Rock960(B, 4GB+32GB model) kernel, but there’s many problems.
So I did asked before in Rock960, but still in problem to not sense new devices ( even I asked to manufacturer, AIStarVision - They are not gives right feedback to me )

stereo MIPI camera config.

aistarvision_stereo_mipibd_config

Background explain

  • I am using own ARM64 build of official Rock960 debian stretch sources.
  • Using base of rock960ab configuration.
  • kernel configured to use SoC cameras after doing rock960ab definition.
  • Now I am changing i2c section of file ‘rock960-model-ab-linux.dts’ on kernel/arch/arm64/boot/dts/rockchip.

Asking to …

  • Is there any reference to how to change dts for dual ov5645 cameras ?
  • Or, some samples for RK3399 ? ( I don’t think so Qualcomm Snapdragon references are may gives me any help )
  • Any HELP !

Regards, Raph.

I suggest you to debug progressively.

First:

  • Enable only one sensor
  • Check that i2c device is bound to the camera driver at init.
  • If driver init fails, check that camera is correctly powered

I have modified rock960-model-ab-linux.dts at 551 line as like this:

 551 &i2c2 {
 552     status = "okay";
 553
 554     camera0: camera-module@10 {
 555         compatible = "ovti,ov5645";
 556         reg = <0x10>;
 557         device_type = "v4l2-i2c-subdev";
 558         clocks = <&cru SCLK_CIF_OUT>;
 559         clock-names = "clk_cif_out";
 560         pinctrl-names = "rockchip,camera_default";
 561         pinctrl-0 = <&cam0_default_pins>;
 562         pintctl-1 = <&cam0_sleep_pins>;
 563
 564         rockchip,pwr-gpio = <&gpio4 4 GPIO_ACTIVE_HIGH>;
 565         rockchip,rst-gpio = <&gpio3 29 GPIO_ACTIVE_LOW>;
 566         rockchip,camera-module-mclk-name = "clk_cif_out";
 567         rockchip,camera-module-facing = "back";
 568         rockchip,camera-module-flash-support = <0>;
 569         rockchip,camera-module-mipi-dphy-index = <0>;
 570     };

And build kernel and flashed it, then dmesg appears failure like this:

 651 [    1.230827] i2c i2c-2: of_i2c: modalias failure on /i2c@ff120000/camera-     module@36
 652 [    1.231506] rk3x-i2c ff120000.i2c: Initialized RK3xxx I2C bus at ffffff8     00955e000
 653 [    1.232579] rk3x-i2c ff150000.i2c: Initialized RK3xxx I2C bus at ffffff8     009572000

I am not good in configure like this.
Should I get helped ?

it seems you also have camera-module@36, you can remove it for now.
If once booted, you get a device under /sys/bus/i2c/devices/ with the address (0x10) and with name property (ov5645), then that means driver has been correctly bound. Please check this before.

Dear Loic,

First of all, thanks for reply to me!
I blanc camera-module@36 as {}; and build kernel again for successfully build it.
Then flashed to Rock960.
Now I can see ov5645 device in your path as like this:

 linaro@linaro-alip  ~  cd /sys/bus/i2c/devices/i2c-2
 linaro@linaro-alip  /sys/bus/i2c/devices/i2c-2  ll
total 0
drwxr-xr-x 3 root root    0 Nov  6 08:42 2-0010
--w------- 1 root root 4.0K Nov  6 08:42 delete_device
lrwxrwxrwx 1 root root    0 Nov  6 08:42 device -> ../../ff120000.i2c
drwxr-xr-x 3 root root    0 Nov  6 08:42 i2c-dev
-r--r--r-- 1 root root 4.0K Nov  6 08:42 name
--w------- 1 root root 4.0K Nov  6 08:42 new_device
lrwxrwxrwx 1 root root    0 Nov  6 08:42 of_node -> ../../../../firmware/devicetree/base/i2c@ff120000
drwxr-xr-x 2 root root    0 Nov  6 08:42 power
lrwxrwxrwx 1 root root    0 Nov  6 08:42 subsystem -> ../../../../bus/i2c
-rw-r--r-- 1 root root 4.0K Nov  6 08:42 uevent
 linaro@linaro-alip  /sys/bus/i2c/devices/i2c-2  cat name
rk3x-i2c
 linaro@linaro-alip  /sys/bus/i2c/devices/i2c-2  cat 2-0010/name
ov5645
 linaro@linaro-alip  /sys/bus/i2c/devices/i2c-2 

Is it device loaded as well ?
I can see only camera 32 module error in dmesg as like this:

 linaro@linaro-alip  /sys/bus/i2c/devices/i2c-2  dmesg | grep camera
[    1.253250] i2c i2c-2: of_i2c: modalias failure on /i2c@ff120000/camera-module@35

Now what is next step for make video node in device directory?
Or something need to other ?
Please help me more to use camera module.

( checked dmesg for v4l, there’s error like this )

 801 [    1.373280] cif_isp10_v4l2_drv_probe: probing...
 802 [    1.373768] cif_isp10_pltfrm_dev_init(1224) ERR: could not get default p     instate
 803 [    1.374416] cif_isp10_pltfrm_dev_init WARN: could not get pins_sleep pin     state
 804 [    1.375046] cif_isp10_pltfrm_dev_init WARN: could not get pins_inactive     pinstate
 805 [    1.376031] cif_isp10_img_src_to_img_src(70) ERR: to_img_src failed!
 806 [    1.376598] cif_isp10_img_src_to_img_src(78) ERR: failed with error -14
 807 [    1.377182] cif_isp10_img_srcs_init(1099) ERR: failed with error -14
 808 [    1.377746] cif_isp10_create(5772) ERR: cif_isp10_img_srcs_init failed
 809 [    1.378318] cif_isp10_create(5808) ERR: failed with error -14

Best regards, Raph.

Hi @Raph_K,

I’m also trying to get OV5645 working on Rock960 using MIPI adapter. Will share my findings here or as a guide in 96Boards Documentation site soon. For me, I don’t work on the vendor kernel, instead I use upstream kernel.

You can use this tree for tracking: manivannan.sadhasivam/96b-common.git - [no description]

Thanks,
Mani

1 Like

For using the OV5645 cameras on MIPI adapter v2.1 board, below settings on the board are needed:

For camera 1 (CSI0):
1.2. Connect the camera adapter board (AISTAR-IPEX ADP) with the IPEX
cable to J10 (this is the CSI0 interface) on the mezzanine.
1.3. Set jumpers 19-20 and 21-22 closed on J13 - this selects I2C2 (CCI)
bus for camera on J10.
1.4. Set jumper 7-8 closed (and 5-6 open) on J14 - this selects the
external clock for camera on J10 - to use SoC’s CAM_MCLK0 output.
1.5. Set jumper 6-23 closed on J15 - power down for camera on J10.

For camera 2 (CSI1):
2.2. Connect the camera adapter board (AISTAR-IPEX ADP) with the IPEX
cable to J1 (this is the CSI1 interface) on the mezzanine.
2.3. Set jumpers 15-16 and 17-18 closed on J13 - this selects I2C2 (CCI)
bus for camera on J1.
2.4. Set jumper 1-2 closed (and 3-4 open) on J14 - this selects the
external clock for camera on J1 - to use SoC’s CAM_MCLK1 output.
2.5. Set jumper 6-23 closed on J15 - power down for camera on J1

1 Like

Dear Mani,
Wow ! You the best !
Thank you so much, I wish it will be works for Rock960 board soon !
I will track your tree.
Regards, Raph.

Does the DTB also work with an OV5647?
As I actually know, the difference is only in the resolution.

No, it won’t work. You need to modify the sensor node as below:

                ov: camera@36 {
                        compatible = "ovti,ov5647";
                        reg = <0x36>;
                        clocks = <&camera_clk>;
                        port {
                                camera_1: endpoint {
                                        remote-endpoint = <&csi1_ep1>;
                                };
                        };
                };
1 Like

Dear @Mani.

I’ve been clonned your rock960_isp branch source with build completed and made boot.img.
But it stopped before “Starting kernel …”.

U-Boot 2017.09-g01c5534 (Oct 23 2018 - 17:28:37 +0900)

Model: Rockchip RK3399 Evaluation Board
DRAM:  3.9 GiB
MMC:   dwmmc@fe320000: 1, sdhci@fe330000: 0
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Model: Rockchip RK3399 Evaluation Board
Pcie:  Enable Power
Net:   No ethernet found.
Hit any key to stop autoboot:  0
switch to partitions #0, OK
mmc0(part 0) is current device
Scanning mmc 0:4...
Found /extlinux/extlinux.conf
Retrieving file: /extlinux/extlinux.conf
reading /extlinux/extlinux.conf
183 bytes read in 11 ms (15.6 KiB/s)
1:      kernel-4.4
Retrieving file: /Image
reading /Image
18500096 bytes read in 828 ms (21.3 MiB/s)
append: earlyprintk console=ttyFIQ0,1500000n8 rw root=PARTUUID=b921b045-1d rootfstype=ext4 init=/sbin/init rootwait
Retrieving file: /rk3399-rock960.dtb
reading /rk3399-rock960.dtb
53250 bytes read in 17 ms (3 MiB/s)
## Flattened Device Tree blob at 01f00000
   Booting using the fdt blob at 0x1f00000
   Loading Device Tree to 00000000f5ef4000, end 00000000f5f04001 ... OK

Starting kernel ...

Am I need build all u-boot and kernel again, or some more options, maybe ?
I just used rock960 source, and switched kernel source to your repo with some different options for build it.
Should I get some more help ?

Many thanks with regards, Raph.

Hi @Raph_K,

I have just updated my tree. Please fetch it! Btw, for booting mainline kernel, you need to use the below .conf file

label kernel-4.19-rc1
    kernel /Image
    fdt /rk3399-rock960.dtb
    append earlycon=uart8250,mmio32,0xff1a0000 console=ttyS2,1500000n8 rw root=PARTUUID=b921b045-1d rootwait rootfstype=ext4 init=/sbin/init

I have solved the Camera sensor issue but still need to fix up the ISP bits.

Thanks,
Mani

Dear, @Mani

I can successfully booted, and it appears login, then reached to prompt on Putty well.
But it going to be stopped on here, no input availed, no HDMI out, no response at all.

Debian GNU/Linux 9 linaro-alip ttyS2

linaro-alip login: root (automatic login)

Last login: Thu Nov  8 10:12:03 UTC 2018 on ttyS2
Linux linaro-alip 4.19.0-rc1-g38f9984 #3 SMP PREEMPT Fri Nov 9 15:47:48 KST 2018 aarch64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
root@linaro-alip:~# [    7.572166] phy phy-ff770000.syscon:usb2-phy@e450.2: charger = USB_SDP_CHARGER

Should I guess what I did wrong ?

Regards, Raph.K.

Looks strange. HDMI should work out of the box. Does it hang or you can’t type into the console?

Please make sure that your Tx line is wired!

Thanks,
Mani

Yes, I am trying to use this, but still some weird … Keeping try to solve this.
Thanks for all Mani !

No response to writing problem was belong to USB-Serial device.
I could solve this by changing to a new device.
But still HDMI not working … weird !
And no /dev/fb ! Maybe I didn’t configured to use frame buffer ?
I will trying to solve this.
Thanks for @Mani !

Dear @Mani,
I’ve configured jumpers and kernel written to boot partition,
Progress now prompt on shell.

But, no /dev/fb, no /dev/media* or /dev/video*.
I can see name of ov5645 on i2c device on sys directory.

Am I did wrong ?

Thanks for all !

I’m trying to get my camera + AIStarVision board work with HiKey960. Is there anyone successful on that ? Thanks

But, no /dev/fb, no /dev/media* or /dev/video*.
I can see name of ov5645 on i2c device on sys directory.

As I said, the work is still in progress. I’m trying to resolve few issues which is causing the ISP to error out during probe. Please stay tuned for updates!

1 Like

Hi @ptphucbk,

The same I’m working along with Rock960. Please stay tuned for updates!

2 Likes