Repository navigation
Description
Hi,
I have been getting issues when trying to get the output of the camera working in 8 bit mode at 640:400 resolution, both through Python and the command line. Everything works fine with 10bit, but as soon as I try rpicam-raw 640:400:8:P or set the bit_depth as 8bit in Python I start getting Broken Pipe errors. I get no other errors in my logs
Here are my listed modes
rpicam-hello --list-cameras
Available cameras
0 : ov9281 [1280x800 10-bit MONO] (/base/axi/pcie@120000/rp1/i2c@88000/ov9281@60)
Modes: 'R8' : 640x400 [309.79 fps - (0, 0)/1280x800 crop]
1280x720 [171.79 fps - (0, 0)/1280x720 crop]
1280x800 [143.66 fps - (0, 0)/1280x800 crop]
'R10_CSI2P' : 640x400 [247.83 fps - (0, 0)/1280x800 crop]
1280x720 [137.42 fps - (0, 0)/1280x720 crop]
1280x800 [114.93 fps - (0, 0)/1280x800 crop]
Am I miss-understanding how this all works. Does setting bit depth to 8 correspond to the R8 mode? In this example what mode is the app actually selecting? R10_CSI2P,640x400/0?
rpicam-hello --camera 0 --mode 640:480:8:P
[0:07:13.057859596] [2369] INFO Camera camera_manager.cpp:284 libcamera v0.2.0+46-075b54d5
[0:07:13.074079445] [2370] INFO RPI pisp.cpp:662 libpisp version v1.0.4 6e3a53d137f4 04-03-2024 (18:25:28)
[0:07:13.075956320] [2370] WARN CameraSensorProperties camera_sensor_properties.cpp:274 No static properties available for 'ov9281'
[0:07:13.076385548] [2370] WARN CameraSensorProperties camera_sensor_properties.cpp:276 Please consider updating the camera sensor properties database
[0:07:13.080948308] [2370] INFO RPI pisp.cpp:1121 Registered camera /base/axi/pcie@120000/rp1/i2c@88000/ov9281@60 to CFE device /dev/media2 and ISP device /dev/media0 using PiSP variant BCM2712_C0
Made X/EGL preview window
Mode selection for 640:400:12:P
R8,640x400/0 - Score: 2000
R8,1280x720/0 - Score: 2306.67
R8,1280x800/0 - Score: 2260
R10_CSI2P,640x400/0 - Score: 1000
R10_CSI2P,1280x720/0 - Score: 1306.67
R10_CSI2P,1280x800/0 - Score: 1260
Stream configuration adjusted
[0:07:13.372661787] [2369] INFO Camera camera.cpp:1183 configuring streams: (0) 640x400-YUV420 (1) 640x400-MONO_PISP_COMP1
[0:07:13.372806308] [2370] INFO RPI pisp.cpp:1405 Sensor: /base/axi/pcie@120000/rp1/i2c@88000/ov9281@60 - Selected sensor format: 640x400-Y10_1X10 - Selected CFE format: 640x400-PC1M
[0:07:13.373938174] [2374] WARN IPARPI ipa_base.cpp:1055 Could not set SHARPNESS - no sharpen algorithm
Activity
naushir commentedon Apr 17, 2024
Can you try running
and see if that gives you what you want?
automaton123456 commentedon Apr 20, 2024
Thanks for the response,
I have tried a few different combos but still the same result. With your command I get the following output from the terminal
rpicam-hello --camera 0 --viewfinder-mode 640:400:8:U
[0:14:13.312375547] [3529] INFO Camera camera_manager.cpp:284 libcamera v0.2.0+47-46b868fe
[0:14:13.323087932] [3530] INFO RPI pisp.cpp:662 libpisp version v1.0.4 6e3a53d137f4 04-03-2024 (18:25:28)
[0:14:13.324124742] [3530] WARN CameraSensorProperties camera_sensor_properties.cpp:274 No static properties available for 'ov9281'
[0:14:13.324139779] [3530] WARN CameraSensorProperties camera_sensor_properties.cpp:276 Please consider updating the camera sensor properties database
[0:14:13.331387992] [3530] INFO RPI pisp.cpp:1121 Registered camera /base/axi/pcie@120000/rp1/i2c@88000/ov9281@60 to CFE device /dev/media0 and ISP device /dev/media2 using PiSP variant BCM2712_C0
[0:14:13.331452844] [3530] INFO RPI pisp.cpp:662 libpisp version v1.0.4 6e3a53d137f4 04-03-2024 (18:25:28)
[0:14:13.332136397] [3530] WARN CameraSensorProperties camera_sensor_properties.cpp:274 No static properties available for 'ov9281'
[0:14:13.332149360] [3530] WARN CameraSensorProperties camera_sensor_properties.cpp:276 Please consider updating the camera sensor properties database
[0:14:13.333825038] [3530] INFO RPI pisp.cpp:1121 Registered camera /base/axi/pcie@120000/rp1/i2c@80000/ov9281@60 to CFE device /dev/media1 and ISP device /dev/media3 using PiSP variant BCM2712_C0
Made X/EGL preview window
Mode selection for 640:400:8:U
R8,640x400/0 - Score: 0
R8,1280x720/0 - Score: 306.667
R8,1280x800/0 - Score: 260
R10_CSI2P,640x400/0 - Score: 1000
R10_CSI2P,1280x720/0 - Score: 1306.67
R10_CSI2P,1280x800/0 - Score: 1260
Stream configuration adjusted
[0:14:13.693232908] [3529] INFO Camera camera.cpp:1183 configuring streams: (0) 640x400-YUV420 (1) 640x400-R16
[0:14:13.693370093] [3530] INFO RPI pisp.cpp:1405 Sensor: /base/axi/pcie@120000/rp1/i2c@88000/ov9281@60 - Selected sensor format: 640x400-Y8_1X8 - Selected CFE format: 640x400-Y16
[0:14:13.694656199] [3535] WARN IPARPI ipa_base.cpp:1055 Could not set SHARPNESS - no sharpen algorithm
[0:14:13.701096249] [3530] ERROR V4L2 v4l2_videodevice.cpp:1906 /dev/video12[16:cap]: Failed to start streaming: Broken pipe
ERROR: *** failed to start camera ***
I have a bad feeling I am going to have to play with kernel driver for the camera
I noticed that the latest builds of the kernel are using a different driver to the past
/linux/blob/rpi-6.6.y/drivers/media/i2c/ov9282.c
6by9 commentedon Apr 22, 2024
The kernel is throwing an error
Extra debug
media-ctl after this error:
Note that you need to build the latest media-ctl. The standard Raspberry Pi OS version doesn't know
MEDIA_BUS_FMT_Y16_1X16csi2:4 would appear to be the mismatch as it reads
when for all other modes it will read
Y16_1X16/640x400. Indeed trying to set it toY8_1X8it "corrects" the format toY16_1X16.It looks like there is a missing
remapentry at https://github.com/raspberrypi/linux/blob/rpi-6.6.y/drivers/media/platform/raspberrypi/rp1_cfe/cfe_fmts.h#L258, meaning we can't remap the Y8 to Y16 to feed it into the FE.gets it working for me, but I'll leave it up to @naushir to confirm the change and create the PR.
naushir commentedon Apr 23, 2024
PR is available at raspberrypi/linux#6122
automaton123456 commentedon Apr 23, 2024
Cheers Guys,
Pulled changes, rebuilt kernel and my tests are working
6by9 commentedon Apr 24, 2024
FYI we have CI running on all kernel PRs, so you can use
sudo rpi-update pulls/6122(substitute the appropriate PR number in there) to pull the relevant CI build instead of having to build the kernel yourself.To answer your other comment over using ov9282, yes I upstreamed all my extra functionality from the downstream ov9281 driver into the mainline ov9282 driver that Intel had originated. We switched in 6.2 via #5304.
OV9281 and OV9282 are the same sensor but with different CRA (Chief Ray Angle) in the optics.