Using Raspberry Pi MIPI Cameras with Rock Pi4

I am looking around and found out that the headers are not installed

sudo dpkg-reconfigure -phigh build-essential linux-headers-uname -r
[sudo] password for rock:
dpkg-query: package ‘linux-headers-4.4.154-999-rockchip-gc26d93d00149’ is not installed and no information is available
Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their contents.
/usr/sbin/dpkg-reconfigure: linux-headers-4.4.154-999-rockchip-gc26d93d00149 is not installed

So i filely installed the Header package with this:
sudo apt-get --reinstall install /home/rock/linux-headers-4.4.154-999-rockchip-gc26d93d00149_4.4.154-999-rockchip_all.deb

After that i was able to run

sudo dpkg-reconfigure -phigh build-essential linux-headers-uname -r

For /boot/extlinux/extlinux.conf, please edit /etc/default/extlinux file and run /usr/local/sbin/update_extlinux.sh manually to take effect.

Hi @jack and thanks for the reply.

this is what i see now with Dmesg

   rock@master:~$ dmesg | grep cam
[    2.699346] of_get_named_gpiod_flags: parsed 'pwdn-gpios' property of node '/i2c@ff3d0000/camera-module@10[0]' - status (0)
rock@master:~$ dmesg | grep vid
[    0.000000] rockchip_cpuclk_pre_rate_change: limiting alt-divider 33 to 31
[    1.540624] Linux video capture interface: v2.00
[    2.728286] usbcore: registered new interface driver uvcvideo
rock@master:~$ i2cdetect -l
i2c-0   unknown         rk3x-i2c                                N/A
i2c-1   unknown         rk3x-i2c                                N/A
i2c-2   unknown         rk3x-i2c                                N/A
i2c-4   unknown         rk3x-i2c                                N/A
i2c-7   unknown         rk3x-i2c                                N/A
i2c-9   unknown         DesignWare HDMI                         N/A

 rock@master:~$ sudo i2cdetect -y 1

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- UU -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

I also found the code for the driver : ov5647.c

How can we make a module with this so we can load it in the kernel?

hello, @Pierre
About the “rkximagesink”, here is the related pages from github

So, the [gstreamer-rockchip-extra] library and the related rockchip libraries may be necessary to run this command, i think.

gst-launch-1.0 v4l2src device=/dev/video0 io-mode=4 ! videoconvert ! video/x-raw,format=NV12,width=1920,height=1080 ! rkximagesink

Btw, i am trying to make a raspberry pi camera module working on rock pi as well.
Hope we can make it done quickly.

Good luck!

I give it a try Thanks!

Hi everyone,

Any news on this ? @Pierre, did it work?

@jack the devicetree you pasted puts imx219 on i2c4, but the schematics for Rockpi4 the camera should be on either i2c2 or i2c7. What am I missing here?

Thanks!
Eze

Ah, I wasn’t reading the schematics right. With the right I2C and the right GPIO enabled, now the camera is detected!

1 Like

Hi @jack,

I am also trying to get ov5647 sensor working with rock pi and I have followed your instruction by editing /etc/default/extlinux file and running /usr/local/sbin/update_extlinux.sh. However, I can’t still get it working and the i2c port (i2c-4, as follows) on the MIPI CSI slot doesn’t seem to be detected.

rock@rockpi:~$ i2cdetect -l
i2c-0	unknown   	rk3x-i2c                        	N/A
i2c-1	unknown   	rk3x-i2c                        	N/A
i2c-2	unknown   	rk3x-i2c                        	N/A
i2c-7	unknown   	rk3x-i2c                        	N/A
i2c-9	unknown   	DesignWare HDMI                 	N/A

Do I need to enable the i2c port or something?

FYI: I’m using Ubuntu Server 18.04 and have upgraded to the latest Radxa kernel version (4.4.154-95).

Thanks,
Cheston

OV5647 is supported. First make sure you have ov5647.dtbo under /boot/overlays, then edit /boot/hw_intfc.conf to enable it by uncommenting the following line:

intfc:dtoverlay=ov5647

Hi @jack! After your comment, I have got the directory /boot/overlays by installing

sudo apt-get install rockchip-fstab
sudo apt-get install rockpi4-dtbo

and uncommented intfc:dtoverlay=ov5647 in /boot/hw_intfc.conf.

I then tried to run Cheese to see the webcam output but the pi freezed like before. What else need to be done?

Here is some output that may be helpful to diagnose:


rock@rockpi:~$ v4l2-ctl --list-devices
rkisp1-statistics (platform: rkisp1):
	/dev/video2
	/dev/video3

rkisp1_mainpath (platform:ff910000.rkisp1):
	/dev/video0
	/dev/video1

rock@rockpi:~$ media-ctl -d /dev/media0 -p
Media controller API version 0.1.0

Media device information
------------------------
driver          rkisp1
model           rkisp1
serial          
bus info        
hw revision     0x0
driver version  0.0.0

Device topology
- entity 1: rkisp1-isp-subdev (4 pads, 0 link)
            type V4L2 subdev subtype Unknown flags 0
	pad0: Sink
	pad1: Sink
	pad2: Source
	pad3: Source

- entity 2: rkisp1_mainpath (1 pad, 0 link)
            type Node subtype V4L flags 0
            device node name /dev/video0
	pad0: Sink

- entity 3: rkisp1_selfpath (1 pad, 0 link)
            type Node subtype V4L flags 0
            device node name /dev/video1
	pad0: Sink

- entity 4: rkisp1-statistics (1 pad, 0 link)
            type Node subtype V4L flags 0
            device node name /dev/video2
	pad0: Sink

- entity 5: rkisp1-input-params (1 pad, 0 link)
            type Node subtype V4L flags 0
            device node name /dev/video3
	pad0: Source

- entity 6: rockchip-sy-mipi-dphy (2 pads, 0 link)
            type V4L2 subdev subtype Unknown flags 0
	pad0: Sink
	pad1: Source

Hi @jack! I have reimaged my rock pi 4b to the official rock pi debian 9 image and followed the instructions to the get the camera working but I’m still getting errors.

I have checked /boot/overlays that I do have ov5647.dtbo and uncommented intfc:dtoverlay=ov5647 in /boot/hw_intfc.conf. I have also checked https://wiki.radxa.com/Rockpi4/hardware/devtree_overlays to see I have the correct number of files in /boot, knowing that I don’t have the rockpi-4b-linux.dtb file. I’m not sure how significant this file is and I don’t know how to generate this file. Could this be the problem?

Anyway, I’ve got to this page (https://wiki.radxa.com/Rockpi4/MIPI_Camera) and ran

test_camera-rkisp1.sh

Finally I got this error message

linaro@rockpi:~$ test_camera-rkisp1.sh
Start RKISP Camera Preview!
Password: 
Setting pipeline to PAUSED ...
libGL error: MESA-LOADER: failed to retrieve device information
libGL error: unable to load driver: rockchip_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: rockchip
libGL error: MESA-LOADER: failed to retrieve device information
libGL error: unable to load driver: rockchip_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: rockchip
Caught SIGSEGV
Spinning.  Please run 'gdb gst-launch-1.0 3928' to continue debugging, Ctrl-C to quit, or Ctrl-\ to dump core.

I tried googling every line of this error message but none of the workaround worked for me. Please advise what other changes I could make.

Hi, can anyone help me to understand how to distinguish which version of raspicam I have , if on the camera no labels appear?
I have also a Pi3 (from which I’m tryng to migrate) if this can help.
Moreover script test_camera-rkisp1.sh is not found. How to install it?

My system is Armbian+xfce with ROS and Opencv 4.1.1
Tank you