Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8037

Camera board • Re: Higher exposure time for OV9282 driver using continuous clock

$
0
0
Right, I should mention I exclusively tested in 8bit modes since that's what my program uses.
Regarding pixel rate, from my tests with the framerate, 8bit mode seems to effectively run at 192Mpx/s, not 200Mpx/s - at least that is what the observed framerate suggests, verified in the following 8bit modes using continuous clocks: 1280x800, 640x400 and 640x480. So I'm using this formula to set vblank (clamped ofc):
desiredVBlank = 192000000 / (fps * (width+minHBlank)) - height
Correct. Pixel rate should be 192MPix/s. I'll sort a kernel patch in due course.
Thanks for the links regarding the device tree files and your example. I verified to get the same output on my piCore 16 install, too.
That only leaves one variable: I use the V4L2 interface directly, not libcamera, and so I also set need media-controller=0 - so my config looks like this:
dtoverlay=ov9281,media-controller=0,clk-continuous
With that, I still don't get any frames, in any 8bit mode, even at low framerates. Without clk-continuous, I can at least use my patched ov9282 driver that ignores the V4L2 flag to set non-continuous mode.

Outdated:
So can I assume clock-noncontinuous is media-controller/libcamera specific? Is there any other way to configure V4L2 to not use non-continuous clocks? Or default to it being continuous, seeing that it severely limits the capabilities of the sensor?
This might not be specific to OV9281 then, and affect more people using sensors at their limits - at least using the V4L2 interface.


EDIT: Except, wait. While rpicam-hello/-vid do actually show the proper supported framerates, running sudo rpicam-vid --mode 1280:800:8:P still does not produce any frames, and the program locks up trying to restart - no matter what I set as framerate:

Code:

tc@trackcam:~$ sudo rpicam-vid --mode 1280:800:8:P[0:17:06.140639555] [5395] ERROR IPAModule ipa_module.cpp:172 Symbol ipaModuleInfo not found[0:17:06.140993930] [5395] ERROR IPAModule ipa_module.cpp:292 v4l2-compat.so: IPA module has no valid info[0:17:06.141343930] [5395]  INFO Camera camera_manager.cpp:313 libcamera v0.3.0+65-6ddd79b5[0:17:06.158539972] [5396]  WARN CameraSensorProperties camera_sensor_properties.cpp:286 No static properties available for 'ov9281'[0:17:06.158760701] [5396]  WARN CameraSensorProperties camera_sensor_properties.cpp:288 Please consider updating the camera sensor properties database[0:17:06.237521795] [5396]  INFO RPI vc4.cpp:446 Registered camera /base/soc/i2c0mux/i2c@1/ov9281@60 to Unicam device /dev/media0 and ISP device /dev/media1[0:17:06.237773514] [5396]  INFO RPI pipeline_base.cpp:1104 Using configuration file '/usr/local/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'Preview window unavailableMode selection for 1280:800:8:P    R8,640x400/0 - Score: 2080    R8,1280x720/0 - Score: 226.667    R8,1280x800/0 - Score: 0    R10_CSI2P,640x400/0 - Score: 3080    R10_CSI2P,1280x720/0 - Score: 1226.67    R10_CSI2P,1280x800/0 - Score: 1000Stream configuration adjusted[0:17:06.321305493] [5395]  INFO Camera camera.cpp:1183 configuring streams: (0) 640x480-YUV420 (1) 1280x800-R8[0:17:06.322435805] [5396]  INFO RPI vc4.cpp:621 Sensor: /base/soc/i2c0mux/i2c@1/ov9281@60 - Selected sensor format: 1280x800-Y8_1X8 - Selected unicam format: 1280x800-GREY[0:17:07.507951847] [5396]  WARN V4L2 v4l2_videodevice.cpp:2007 /dev/video0[14:cap]: Dequeue timer of 1000000.00us has expired![0:17:07.508184242] [5396] ERROR RPI pipeline_base.cpp:1336 Camera frontend has timed out![0:17:07.508290961] [5396] ERROR RPI pipeline_base.cpp:1337 Please check that your camera sensor connector is attached securely.[0:17:07.508392315] [5396] ERROR RPI pipeline_base.cpp:1338 Alternatively, try another cable and/or sensor.ERROR: Device timeout detected, attempting a restart!!!^CReceived signal 2Terminated
So this is actually the same behaviour I have with my program using V4L2 directly. Can you confirm this works for you? If so, I can only imagine it's piCore 16 specific, an issue with the camera stack that only appears when V4L2 is configured to use continuous clocks - but not when it thinks it uses non-continuous clocks, but the driver actually configures continuous clocks. That sounds quite unlikely.
libcamera requires Media Controller to be enabled.
clk-continuous is orthogonal to that.

Just testing now with a Pi4 on a 6.12.62 kernel with a very quick patch to set the 8bit pixel rate to 192MPix/s
"dtoverlay=ov9281,clk-continuous" and libcamera gives me:

Code:

pi@raspberrypi:~ $ rpicam-hello --list-camerasAvailable cameras-----------------0 : ov9281 [1280x800 10-bit MONO] (/base/soc/i2c0mux/i2c@1/ov9281@60)    Modes: 'R8' : 640x400 [325.52 fps - (0, 0)/1280x800 crop]                  1280x720 [180.51 fps - (0, 0)/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, 0)/1280x720 crop]                         1280x800 [120.76 fps - (0, 0)/1280x800 crop]
"rpicam-hello --viewfinder-mode 640:400:10:P --framerate 200" is giving me 199.8fps
"--viewfinder-mode 640:400:8:P" is also giving me 199.8fps

"dtoverlay=ov9281,clk-continuous,media-controller=0"

Code:

pi@raspberrypi:~ $ v4l2-ctl -VFormat Video Capture:Width/Height      : 1280/720Pixel Format      : 'Y10P' (10-bit Greyscale (MIPI Packed))Field             : NoneBytes per Line    : 1600Size Image        : 1152000Colorspace        : RawTransfer Function : NoneYCbCr/HSV Encoding: Default (maps to ITU-R 601)Quantization      : Default (maps to Full Range)Flags             : pi@raspberrypi:~ $ v4l2-ctl --stream-mmap=3 --stream-count=1000 --stream-to=/dev/null<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 63.05 fps<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 63.05 fps<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 63.05 fps<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 63.05 fps<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 63.05 fps<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 63.05 fps<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 63.05 fps<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 63.05 fps<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 63.05 fps<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 63.05 fps<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 63.05 fps<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 63.05 fps<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 63.05 fps<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 63.05 fps<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 63.05 fps<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<pi@raspberrypi:~ $ v4l2-ctl -V^Cpi@raspberrypi:~ $ v4l2-ctl -v pixelformat=GREYpi@raspberrypi:~ $ v4l2-ctl -VFormat Video Capture:Width/Height      : 1280/720Pixel Format      : 'GREY' (8-bit Greyscale)Field             : NoneBytes per Line    : 1280Size Image        : 921600Colorspace        : RawTransfer Function : NoneYCbCr/HSV Encoding: Default (maps to ITU-R 601)Quantization      : Default (maps to Full Range)Flags             : pi@raspberrypi:~ $ v4l2-ctl --stream-mmap=3 --stream-count=500 --stream-to=/dev/null<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<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<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 92.67 fps<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
I haven't checked the images are valid, but see no reason that they shouldn't be.

Edit /boot/firmware/cmdline.txt to add "trace_event=i2c", and run "v4l2-ctl -v width=640,height=400,pixelformat=GREY" and "v4l2-ctl --stream-mmap=3 --stream-count=500 --stream-to=/dev/null". Log of all I2C traffic is then available in /sys/kernel/debug/tracing/trace. Grep for "48-00" as the relevant register for clock lane behaviour, and I get [48-00-00] which is not gated clock (ie continuous).
Switch config.txt to not have "clk-continuous" and I get [48-00-20] which is gated or non-continuous clock.

That's all exactly as I expect. I have no idea what piCore is doing, so I'd suggest you at least test on Raspberry Pi OS to confirm behaviour there.
Under Raspberry Pi OS you should never need to run rpicam-apps with sudo.

Statistics: Posted by 6by9 — Tue Dec 23, 2025 3:17 pm



Viewing all articles
Browse latest Browse all 8037

Trending Articles