Failing to initialise ov9281 cameras using V4L2

  1. Where did you get the camera module(s)?
    Robotshop

  2. Model number of the product(s)?
    Arducam OV9281 1MP Mono Global Shutter MIPI Camera for Raspberry Pi
    Product Code: RB-Adu-109

UV-599 Rev. B

  1. What hardware/platform were you working on?
    Computer module 4 with Ochin carried board dual camera configuration
    https://www.seeedstudio.com/Ochin-Tiny-Carrier-Board-for-Raspberry-Pi-Compute-Module-4-p-5463.html

  2. Instructions you have followed. (link/manual/etc.)
    I have been able to successfully run all the examples with libcamera with both cameras.

$ libcamera-vid --list-cameras
Available cameras
-----------------
0 : ov9281 [1280x800] (/base/soc/i2c0mux/i2c@0/ov9281@60)
    Modes: 'R8' : 640x400 [325.52 fps - (0, 0)/1280x800 crop]
                  1280x720 [180.51 fps - (0, 40)/1280x720 crop]
                  1280x800 [150.97 fps - (0, 0)/1280x800 crop]
           'R10_CSI2P' : 640x400 [260.42 fps - (0, 0)/1280x800 crop]
                         1280x720 [144.40 fps - (0, 40)/1280x720 crop]
                         1280x800 [120.76 fps - (0, 0)/1280x800 crop]
1 : ov9281 [1280x800] (/base/soc/i2c0mux/i2c@1/ov9281@60)
    Modes: 'R8' : 640x400 [325.52 fps - (0, 0)/1280x800 crop]
                  1280x720 [180.51 fps - (0, 40)/1280x720 crop]
                  1280x800 [150.97 fps - (0, 0)/1280x800 crop]
           'R10_CSI2P' : 640x400 [260.42 fps - (0, 0)/1280x800 crop]
                         1280x720 [144.40 fps - (0, 40)/1280x720 crop]
                         1280x800 [120.76 fps - (0, 0)/1280x800 crop]

I can stream both cameras feeds.

  1. Problems you were having?
    V4L2 can not initialise any of the cameras failing with error 25 or 22. It seems it is not possible to access or set the cameras properties through V4L2 interface. I am not interested to rewrite already available code

Using usb_cam ros node:

Opening streaming device /dev/video0
Video4Linux: internal error occurred, hoping for device fallback
Cannot set stream parameters (25)

The command: v4l2-ctl --device=/dev/video0 -L. Produces no output.

But v4l2-ctl --all -d /dev/video0 produces correct output:

$ v4l2-ctl --all -d /dev/video0
Driver Info:
	Driver name      : unicam
	Card type        : unicam
	Bus info         : platform:fe800000.csi
	Driver version   : 6.1.34
	Capabilities     : 0xa5a00001
		Video Capture
		Metadata Capture
		Read/Write
		Streaming
		Extended Pix Format
		Device Capabilities
	Device Caps      : 0x25200001
		Video Capture
		Read/Write
		Streaming
		Extended Pix Format
Media Driver Info:
	Driver name      : unicam
	Model            : unicam
	Serial           : 
	Bus info         : platform:fe800000.csi
	Media version    : 6.1.34
	Hardware revision: 0x00000000 (0)
	Driver version   : 6.1.34
Interface Info:
	ID               : 0x03000005
	Type             : V4L Video
Entity Info:
	ID               : 0x00000003 (3)
	Name             : unicam-image
	Function         : V4L2 I/O
	Flags         : default
	Pad 0x01000004   : 0: Sink
	  Link 0x02000007: from remote pad 0x1000002 of entity 'ov9281 0-0060': Data, Enabled, Immutable
Priority: 2
Video input : 0 (unicam-image: ok)
Format Video Capture:
	Width/Height      : 640/480
	Pixel Format      : 'YUYV' (YUYV 4:2:2)
	Field             : Interlaced
	Bytes per Line    : 1280
	Size Image        : 614400
	Colorspace        : SMPTE 170M
	Transfer Function : Rec. 709
	YCbCr/HSV Encoding: ITU-R 601
	Quantization      : Limited Range
	Flags             : 

But list of available formats shows unexpected output:

 v4l2-ctl --device /dev/video0 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
	Type: Video Capture

	[0]: 'YUYV' (YUYV 4:2:2)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[1]: 'UYVY' (UYVY 4:2:2)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[2]: 'YVYU' (YVYU 4:2:2)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[3]: 'VYUY' (VYUY 4:2:2)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[4]: 'RGBP' (16-bit RGB 5-6-5)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[5]: 'RGBR' (16-bit RGB 5-6-5 BE)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[6]: 'RGBO' (16-bit A/XRGB 1-5-5-5)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[7]: 'RGBQ' (16-bit A/XRGB 1-5-5-5 BE)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[8]: 'RGB3' (24-bit RGB 8-8-8)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[9]: 'BGR3' (24-bit BGR 8-8-8)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[10]: 'RGB4' (32-bit A/XRGB 8-8-8-8)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[11]: 'BA81' (8-bit Bayer BGBG/GRGR)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[12]: 'GBRG' (8-bit Bayer GBGB/RGRG)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[13]: 'GRBG' (8-bit Bayer GRGR/BGBG)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[14]: 'RGGB' (8-bit Bayer RGRG/GBGB)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[15]: 'pBAA' (10-bit Bayer BGBG/GRGR Packed)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[16]: 'BG10' (10-bit Bayer BGBG/GRGR)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[17]: 'pGAA' (10-bit Bayer GBGB/RGRG Packed)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[18]: 'GB10' (10-bit Bayer GBGB/RGRG)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[19]: 'pgAA' (10-bit Bayer GRGR/BGBG Packed)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[20]: 'BA10' (10-bit Bayer GRGR/BGBG)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[21]: 'pRAA' (10-bit Bayer RGRG/GBGB Packed)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[22]: 'RG10' (10-bit Bayer RGRG/GBGB)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[23]: 'pBCC' (12-bit Bayer BGBG/GRGR Packed)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[24]: 'BG12' (12-bit Bayer BGBG/GRGR)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[25]: 'pGCC' (12-bit Bayer GBGB/RGRG Packed)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[26]: 'GB12' (12-bit Bayer GBGB/RGRG)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[27]: 'pgCC' (12-bit Bayer GRGR/BGBG Packed)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[28]: 'BA12' (12-bit Bayer GRGR/BGBG)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[29]: 'pRCC' (12-bit Bayer RGRG/GBGB Packed)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[30]: 'RG12' (12-bit Bayer RGRG/GBGB)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[31]: 'pBEE' (14-bit Bayer BGBG/GRGR Packed)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[32]: 'BG14' (14-bit Bayer BGBG/GRGR)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[33]: 'pGEE' (14-bit Bayer GBGB/RGRG Packed)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[34]: 'GB14' (14-bit Bayer GBGB/RGRG)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[35]: 'pgEE' (14-bit Bayer GRGR/BGBG Packed)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[36]: 'GR14' (14-bit Bayer GRGR/BGBG)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[37]: 'pREE' (14-bit Bayer RGRG/GBGB Packed)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[38]: 'RG14' (14-bit Bayer RGRG/GBGB)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[39]: 'GREY' (8-bit Greyscale)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[40]: 'Y10P' (10-bit Greyscale (MIPI Packed))
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[41]: 'Y10 ' (10-bit Greyscale)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[42]: 'Y12P' (12-bit Greyscale (MIPI Packed))
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[43]: 'Y12 ' (12-bit Greyscale)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[44]: 'Y14P' (14-bit Greyscale (MIPI Packed))
		Size: Stepwise 16x16 - 16376x16376 with step 1/1
	[45]: 'Y14 ' (14-bit Greyscale)
		Size: Stepwise 16x16 - 16376x16376 with step 1/1

  1. The dmesg log from your hardware?
    This appears using yavta:
    yavta --capture=1 /dev/video0 -F/tmp/test-#.bin
[ 2372.142357] unicam fe800000.csi: Wrong width or height 640x360 (remote pad set to 1280x800)
[ 2372.142382] unicam fe800000.csi: Failed to start media pipeline: -22
  1. Troubleshooting attempts you’ve made?
    Upgrade kernel drivers, reinstall libv4l packages, install yavta.

  2. What help do you need?
    Could you clarify expected V4L2 support for this camera? I am really not interested on rewriting the drivers using libcamera-app examples. I can do it, but it would mean a huge distraction.

Additional info:
Using Raspbian Bullseye

$ uname -a
Linux quadcm4 6.1.34-v8+ #1657 SMP PREEMPT Fri Jun 16 12:36:29 BST 2023 aarch64 GNU/Linux
$ dmesg
[    8.833221] ov9281 0-0060: Detected OV009281 sensor
[    8.833475] ov9281 0-0060: Consider updating driver ov9281 to match on endpoints
[    8.849803] ov9281 10-0060: Detected OV009281 sensor
[    8.849898] ov9281 10-0060: Consider updating driver ov9281 to match on endpoints

@Shokman

You may need to understand the framework used by the Raspberry Pi first.
https://forums.raspberrypi.com/viewtopic.php?t=322076

like

v4l2-ctl --device=/dev/v4l-subdev0