Ov5647 Camera on CM3 using RPI IO Board

I have spent some time getting the 5MP ov5647 raspberry pi camera working on the radxa cm3 using the raspi cm4 io board running the latest build of bullseye. It is working, and recording photos using python and opencv, thanks to related posts, contribution from @abel and @avaf , and device tree overlays that I was able to patch together my own device tree overlay. For anyone trying to do the same this may help, I have attached my .dts and .dtbo files. This overlay is specific to the raspi cm4 io board and the cam0 connector. I have also added the opencv python script

Initially the image is dark and green but I found a good starting point by making these adjustments:

v4l2-ctl --set-ctrl=white_balance_automatic=1 --set-ctrl=analogue_gain=100 --set-ctrl=exposure=1964 --set-ctrl=auto_exposure=1

Although I can record images, I do get an error about the rkisp. I am not sure what this means or if I should be concerned. Can anyone comment?

rock@radxa-cm3-io:~$ dmesg | grep rkisp
[ 3.486646] iommu: Adding device fdff0000.rkisp to group 7
[ 3.491399] rkisp_hw fdff0000.rkisp: Linked as a consumer to fdff1a00.iommu
[ 3.496300] rkisp_hw fdff0000.rkisp: is_thunderboot: 0
[ 3.500823] rkisp_hw fdff0000.rkisp: max input:0x0@0fps
[ 3.505274] rkisp_hw fdff0000.rkisp: can’t request region for resource [mem 0xfdff0000-0xfdffffff]
[ 3.510947] rkisp rkisp-vir1: rkisp driver version: v01.06.01
[ 3.515673] rkisp rkisp-vir1: No memory-region-thunderboot specified
[ 3.520604] rkisp rkisp-vir1: Entity type for entity rkisp-isp-subdev was not initialized!
[ 3.525359] rkisp rkisp-vir1: Entity type for entity rkisp-csi-subdev was not initialized!
[ 3.537834] rkisp-vir1: Async subdev notifier completed
[ 4.230519] rkisp rkisp-vir1: clear unready subdev num: 0

and when I use opencv to start and stop the camera I see this:

[ 141.463581] rkisp-vir1: nonsupport pixelformat:BGR3
[ 141.463612] rkisp-vir1: nonsupport pixelformat:RGB3
[ 141.463626] rkisp-vir1: nonsupport pixelformat:YV12
[ 144.000470] rkisp rkisp-vir1: can not get first iq setting in stream on
[ 335.573695] rkisp-vir1: MIPI error: packet: 0x01000000

Other related information:

Camera:

rock@radxa-cm3-io:~$ dmesg | grep ov5647
[ 2.944933] ov5647 2-0036: OV5647 power on
[ 3.472751] ov5647 2-0036: OV5647 power off
[ 3.479884] ov5647 2-0036: OmniVision OV5647 camera driver probed
[ 3.532262] rockchip-csi2-dphy csi2-dphy2: dphy2 matches ov5647 2-0036:bus type 4
[ 144.002945] ov5647 2-0036: stream start
[ 144.002958] ov5647 2-0036: OV5647 power on
[ 247.974048] ov5647 2-0036: stream stop
[ 247.975501] ov5647 2-0036: OV5647 power off

rock@radxa-cm3-io:~$ uname -r
4.19.193-58-rockchip-gbac1feba87f0

rock@radxa-cm3-io:~$ ls /dev/video*
/dev/video-camera0 /dev/video0 /dev/video3 /dev/video6
/dev/video-dec0 /dev/video1 /dev/video4 /dev/video7
/dev/video-enc0 /dev/video2 /dev/video5 /dev/video8

I can use opencv, gstreamer, and v4l2 to view a live video and capture images but when using fswebcam, ffplay, or ffmpeg with -i /dev/video0 I get an error saying that /dev/video0 is not a video capture device. Is this a ov5647 driver issue or can it be related to my rkisp issue?

rk3566-radxa-cm3-rpi-ov5647-cam0.zip (2.2 KB)

That’s because normal capture device type is V4L2_BUF_TYPE_VIDEO_CAPTURE,but rockchip rkisp type is V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, if you want to use fswebcam or other software, you may should add libv4l2 library, and use v4l2_ioctl/v4l2_open/v4l2_close instead of ioctl/open/close