2024-12-15 08:18 AM - edited 2024-12-15 08:19 AM
Hi,
I am following the linux-startguide-stbrightsense for the Raspberry Pi 5 (with a clean build of RPi OS Lite, where I only had to install the i2c regmap), and I have come across some problems in the tutorial. I am using two VD66GY cameras, with the entire S-board kit. Hardware connection is OK, as I get I2C communication and I can detect them both via the i2cdetect on i2c4 and i2c6.
I have put both dtoverlays together, as I have both cameras plugged in (basically the same thing except changing some names for conflict reasons):
// SPDX-License-Identifier: GPL-2.0-only
/dts-v1/;
/plugin/;
/{
compatible = "brcm,bcm2835";
fragment@0 {
target-path="/";
__overlay__ {
camera_clk_12M: camera_clk_12M {
#clock-cells = <0>;
compatible = "fixed-clock";
clock-frequency = <12000000>;
};
v1v2: v1v2 {
compatible = "regulator-fixed";
regulator-name = "fixed-supply-1v2";
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <1200000>;
};
v1v8: v1v8 {
compatible = "regulator-fixed";
regulator-name = "fixed-supply-1v8";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
};
v2v8: v2v8 {
compatible = "regulator-fixed";
regulator-name = "fixed-supply-2v8";
regulator-min-microvolt = <2800000>;
regulator-max-microvolt = <2800000>;
};
};
};
fragment@1 {
target = <&i2c_csi_dsi0>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
fox_0: fox@10 {
status = "ok";
compatible = "st,vd66gy";
reg = <0x10>;
clocks = <&camera_clk_12M>;
clock-names = "xclk";
vcore-supply = <&v1v2>;
vddio-supply = <&v1v8>;
vana-supply = <&v2v8>;
reset-gpios = <&gpio 5 1>;
port {
fox_ep_0: endpoint {
clock-lanes = <0>;
data-lanes = <1 2>;
remote-endpoint = <&csi_ep_0>;
clock-noncontinuous;
link-frequencies =
/bits/ 64 <402000000>;
lane-polarities = <1 1 1>;
};
};
};
};
};
fragment@2 {
target = <&csi0>;
csi_0: __overlay__ {
status = "okay";
brcm,media-controller;
port {
csi_ep_0: endpoint {
remote-endpoint = <&fox_ep_0>;
clock-lanes = <0>;
data-lanes = <1 2>;
clock-noncontinuous;
};
};
};
};
fragment@3 {
target = <&cam0_reg>;
__overlay__ {
status = "disable";
};
};
fragment@4 {
target-path = "/__overrides__";
__overlay__ {
cam0-pwdn-ctrl = <&fox_0>, "reset-gpios:0";
cam0-pwdn = <&fox_0>, "reset-gpios:4";
cam1-pwdn-ctrl = <&fox_1>, "reset-gpios:0";
cam1-pwdn = <&fox_1>, "reset-gpios:4";
media-controller = <&csi0>, "brcm,media-controller?",
<&csi1>, "brcm,media-controller?";
};
};
fragment@5 {
target = <&i2c_csi_dsi1>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
fox_1: fox@10 {
status = "ok";
compatible = "st,vd66gy";
reg = <0x10>;
clocks = <&camera_clk_12M>;
clock-names = "xclk";
vcore-supply = <&v1v2>;
vddio-supply = <&v1v8>;
vana-supply = <&v2v8>;
reset-gpios = <&gpio 5 1>;
port {
fox_ep_1: endpoint {
clock-lanes = <0>;
data-lanes = <1 2>;
remote-endpoint = <&csi_ep_1>;
clock-noncontinuous;
link-frequencies =
/bits/ 64 <402000000>;
lane-polarities = <1 1 1>;
};
};
};
};
};
fragment@6 {
target = <&csi1>;
csi_1: __overlay__ {
status = "okay";
brcm,media-controller;
port {
csi_ep_1: endpoint {
remote-endpoint = <&fox_ep_1>;
clock-lanes = <0>;
data-lanes = <1 2>;
clock-noncontinuous;
};
};
};
};
fragment@7 {
target = <&cam1_reg>;
__overlay__ {
status = "disable";
};
};
};
I am attempting to use the VD66GY camera, and the installation process appears to have gone alright, as per dmesg output:
[ 5.526019] rp1-cfe 1f00128000.csi: Using sensor vd56g3 11-0010 for capture
[ 5.526114] rp1-cfe 1f00128000.csi: Registered [rp1-cfe-csi2_ch0] node id 0 successfully as /dev/video0
[ 5.526144] rp1-cfe 1f00128000.csi: Registered [rp1-cfe-embedded] node id 1 successfully as /dev/video1
[ 5.526169] rp1-cfe 1f00128000.csi: Registered [rp1-cfe-csi2_ch2] node id 2 successfully as /dev/video2
[ 5.527131] rp1-cfe 1f00128000.csi: Registered [rp1-cfe-csi2_ch3] node id 3 successfully as /dev/video3
[ 5.527579] rp1-cfe 1f00128000.csi: Registered [rp1-cfe-fe_image0] node id 4 successfully as /dev/video4
[ 5.527643] rp1-cfe 1f00128000.csi: Registered [rp1-cfe-fe_image1] node id 5 successfully as /dev/video5
[ 5.527675] rp1-cfe 1f00128000.csi: Registered [rp1-cfe-fe_stats] node id 6 successfully as /dev/video6
[ 5.527708] rp1-cfe 1f00128000.csi: Registered [rp1-cfe-fe_config] node id 7 successfully as /dev/video7
[ 5.536428] vd56g3 11-0010: Successfully probe vd66gy sensor
[ 5.540065] vc4-drm axi:gpu: bcm2712_iommu_of_xlate: MMU 1000005200.iommu
[ 5.542438] vc4-drm axi:gpu: bound 107c580000.hvs (ops vc4_hvs_ops [vc4])
[ 5.544853] Registered IR keymap rc-cec
[ 5.544901] rc rc0: vc4-hdmi-0 as /devices/platform/soc/107c701400.hdmi/rc/rc0
[ 5.544941] input: vc4-hdmi-0 as /devices/platform/soc/107c701400.hdmi/rc/rc0/input1
[ 5.546979] input: vc4-hdmi-0 HDMI Jack as /devices/platform/soc/107c701400.hdmi/sound/card0/input2
[ 5.548203] vc4-drm axi:gpu: bound 107c701400.hdmi (ops vc4_hdmi_ops [vc4])
[ 5.551630] Registered IR keymap rc-cec
[ 5.551903] rc rc1: vc4-hdmi-1 as /devices/platform/soc/107c706400.hdmi/rc/rc1
[ 5.551987] input: vc4-hdmi-1 as /devices/platform/soc/107c706400.hdmi/rc/rc1/input3
[ 5.559750] rp1-cfe 1f00110000.csi: Using sensor vd56g3 10-0010 for capture
[ 5.559893] input: vc4-hdmi-1 HDMI Jack as /devices/platform/soc/107c706400.hdmi/sound/card1/input4
[ 5.560695] rp1-cfe 1f00110000.csi: Registered [rp1-cfe-csi2_ch0] node id 0 successfully as /dev/video8
[ 5.565399] rp1-cfe 1f00110000.csi: Registered [rp1-cfe-embedded] node id 1 successfully as /dev/video9
[ 5.565894] rp1-cfe 1f00110000.csi: Registered [rp1-cfe-csi2_ch2] node id 2 successfully as /dev/video10
[ 5.566352] vc4-drm axi:gpu: bound 107c706400.hdmi (ops vc4_hdmi_ops [vc4])
[ 5.569471] rp1-cfe 1f00110000.csi: Registered [rp1-cfe-csi2_ch3] node id 3 successfully as /dev/video11
[ 5.569711] vc4-drm axi:gpu: bound 107c500000.mop (ops vc4_txp_ops [vc4])
[ 5.570007] vc4-drm axi:gpu: bound 107c501000.moplet (ops vc4_txp_ops [vc4])
[ 5.574341] vc4-drm axi:gpu: bound 107c410000.pixelvalve (ops vc4_crtc_ops [vc4])
[ 5.576890] vc4-drm axi:gpu: bound 107c411000.pixelvalve (ops vc4_crtc_ops [vc4])
[ 5.577813] rp1-cfe 1f00110000.csi: Registered [rp1-cfe-fe_image0] node id 4 successfully as /dev/video12
[ 5.580877] rp1-cfe 1f00110000.csi: Registered [rp1-cfe-fe_image1] node id 5 successfully as /dev/video13
[ 5.581516] rp1-cfe 1f00110000.csi: Registered [rp1-cfe-fe_stats] node id 6 successfully as /dev/video14
[ 5.581797] rp1-cfe 1f00110000.csi: Registered [rp1-cfe-fe_config] node id 7 successfully as /dev/video15
[ 5.581963] vd56g3 10-0010: Successfully probe vd66gy sensor
Then, I try to follow the v4l2-ctl one liners:
v4l2-ctl --list-formats-ext --list-ctrls --list-ctrls-menu
ioctl: VIDIOC_ENUM_FMT
Type: Video Capture
[0]: 'YUYV' (YUYV 4:2:2)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[1]: 'UYVY' (UYVY 4:2:2)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[2]: 'YVYU' (YVYU 4:2:2)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[3]: 'VYUY' (VYUY 4:2:2)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[4]: 'RGBP' (16-bit RGB 5-6-5)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[5]: 'RGBR' (16-bit RGB 5-6-5 BE)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[6]: 'RGBO' (16-bit A/XRGB 1-5-5-5)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[7]: 'RGBQ' (16-bit A/XRGB 1-5-5-5 BE)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[8]: 'RGB3' (24-bit RGB 8-8-8)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[9]: 'BGR3' (24-bit BGR 8-8-8)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[10]: 'RGB4' (32-bit A/XRGB 8-8-8-8)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[11]: 'BA81' (8-bit Bayer BGBG/GRGR)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[12]: 'GBRG' (8-bit Bayer GBGB/RGRG)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[13]: 'GRBG' (8-bit Bayer GRGR/BGBG)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[14]: 'RGGB' (8-bit Bayer RGRG/GBGB)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[15]: 'pBAA' (10-bit Bayer BGBG/GRGR Packed)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[16]: 'pGAA' (10-bit Bayer GBGB/RGRG Packed)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[17]: 'pgAA' (10-bit Bayer GRGR/BGBG Packed)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[18]: 'pRAA' (10-bit Bayer RGRG/GBGB Packed)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[19]: 'pBCC' (12-bit Bayer BGBG/GRGR Packed)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[20]: 'pGCC' (12-bit Bayer GBGB/RGRG Packed)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[21]: 'pgCC' (12-bit Bayer GRGR/BGBG Packed)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[22]: 'pRCC' (12-bit Bayer RGRG/GBGB Packed)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[23]: 'pBEE' (14-bit Bayer BGBG/GRGR Packed)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[24]: 'pGEE' (14-bit Bayer GBGB/RGRG Packed)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[25]: 'pgEE' (14-bit Bayer GRGR/BGBG Packed)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[26]: 'pREE' (14-bit Bayer RGRG/GBGB Packed)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[27]: 'BYR2' (16-bit Bayer BGBG/GRGR)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[28]: 'GB16' (16-bit Bayer GBGB/RGRG)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[29]: 'GR16' (16-bit Bayer GRGR/BGBG)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[30]: 'RG16' (16-bit Bayer RGRG/GBGB)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[31]: 'PC1R' (PiSP Bayer Compressed Format, compressed)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[32]: 'PC1B' (PiSP Bayer Compressed Format, compressed)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[33]: 'PC1g' (PiSP Bayer Compressed Format, compressed)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[34]: 'PC1G' (PiSP Bayer Compressed Format, compressed)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[35]: 'GREY' (8-bit Greyscale)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[36]: 'Y10P' (10-bit Greyscale (MIPI Packed))
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[37]: 'Y12P' (12-bit Greyscale (MIPI Packed))
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[38]: 'Y14P' (14-bit Greyscale (MIPI Packed))
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[39]: 'Y16 ' (16-bit Greyscale)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
[40]: 'PC1M' (PiSP Bayer Compressed Format, compressed)
Size: Stepwise 16x16 - 16384x16384 with step 2/1
It's missing BA10, which is necessary for the next step:
v4l2-ctl --set-fmt-video width=640,height=480,pixelformat=BA10
The pixelformat 'BA10' is invalid
(I'm guessing I need to use -d /dev/video0)
v4l2-ctl --set-fmt-video width=640,height=480,pixelformat=BA10 -d /dev/video0
The pixelformat 'BA10' is invalid
I have used BA81 instead
v4l2-ctl --set-fmt-video width=640,height=480,pixelformat=BA81 -d /dev/video0
Same problem for the ioctls:
v4l2-ctl --set-ctrl auto_exposure=1 -d /dev/video0
unknown control 'auto_exposure'
I think this is the way the RPi5 implements these things:
media-ctl -d /dev/media2 -p
Media controller API version 6.6.62
Media device information
------------------------
driver rp1-cfe
model rp1-cfe
serial
bus info platform:1f00128000.csi
hw revision 0x114666
driver version 6.6.62
Device topology
- entity 1: csi2 (8 pads, 8 links)
type V4L2 subdev subtype Unknown flags 0
device node name /dev/v4l-subdev0
pad0: Sink
[fmt:SRGGB10_1X10/640x480 field:none colorspace:raw xfer:none ycbcr:601 quantization:full-range]
<- "vd56g3 11-0010":0 [ENABLED,IMMUTABLE]
pad1: Sink
[fmt:unknown/16384x1 field:none]
pad2: Sink
[fmt:SRGGB10_1X10/640x480 field:none colorspace:raw xfer:none ycbcr:601 quantization:full-range]
pad3: Sink
[fmt:SRGGB10_1X10/640x480 field:none colorspace:raw xfer:none ycbcr:601 quantization:full-range]
pad4: Source
[fmt:SRGGB10_1X10/640x480 field:none colorspace:raw xfer:none ycbcr:601 quantization:full-range]
-> "rp1-cfe-csi2_ch0":0 []
-> "pisp-fe":0 []
pad5: Source
[fmt:unknown/16384x1 field:none]
-> "rp1-cfe-embedded":0 []
pad6: Source
[fmt:SRGGB10_1X10/640x480 field:none colorspace:raw xfer:none ycbcr:601 quantization:full-range]
-> "rp1-cfe-csi2_ch2":0 []
-> "pisp-fe":0 []
pad7: Source
[fmt:SRGGB10_1X10/640x480 field:none colorspace:raw xfer:none ycbcr:601 quantization:full-range]
-> "rp1-cfe-csi2_ch3":0 []
-> "pisp-fe":0 []
- entity 10: pisp-fe (5 pads, 7 links)
type V4L2 subdev subtype Unknown flags 0
device node name /dev/v4l-subdev1
pad0: Sink
[fmt:SRGGB16_1X16/640x480 field:none colorspace:raw xfer:none ycbcr:601 quantization:full-range]
<- "csi2":4 []
<- "csi2":6 []
<- "csi2":7 []
pad1: Sink
[fmt:FIXED/16384x1 field:none]
<- "rp1-cfe-fe_config":0 []
pad2: Source
[fmt:SRGGB16_1X16/640x480 field:none colorspace:raw xfer:none ycbcr:601 quantization:full-range]
-> "rp1-cfe-fe_image0":0 []
pad3: Source
[fmt:SRGGB16_1X16/640x480 field:none colorspace:raw xfer:none ycbcr:601 quantization:full-range]
-> "rp1-cfe-fe_image1":0 []
pad4: Source
[fmt:FIXED/16384x1 field:none]
-> "rp1-cfe-fe_stats":0 []
- entity 16: vd56g3 11-0010 (1 pad, 1 link)
type V4L2 subdev subtype Sensor flags 0
device node name /dev/v4l-subdev2
pad0: Source
[fmt:SGRBG8_1X8/1120x1360 field:none colorspace:raw xfer:none quantization:full-range
crop.bounds:(0,0)/1124x1364
crop:(2,2)/1120x1360]
-> "csi2":0 [ENABLED,IMMUTABLE]
- entity 18: rp1-cfe-csi2_ch0 (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video0
pad0: Sink
<- "csi2":4 []
- entity 22: rp1-cfe-embedded (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video1
pad0: Sink
<- "csi2":5 []
- entity 26: rp1-cfe-csi2_ch2 (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video2
pad0: Sink
<- "csi2":6 []
- entity 30: rp1-cfe-csi2_ch3 (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video3
pad0: Sink
<- "csi2":7 []
- entity 34: rp1-cfe-fe_image0 (1 pad, 1 link)
type Node subtype V4L flags 1
device node name /dev/video4
pad0: Sink
<- "pisp-fe":2 []
- entity 38: rp1-cfe-fe_image1 (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video5
pad0: Sink
<- "pisp-fe":3 []
- entity 42: rp1-cfe-fe_stats (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video6
pad0: Sink
<- "pisp-fe":4 []
- entity 46: rp1-cfe-fe_config (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video7
pad0: Source
-> "pisp-fe":1 []
So, if I use another device from this list:
v4l2-ctl --list-ctrls -d /dev/v4l-subdev2
User Controls
exposure 0x00980911 (int) : min=0 max=4341 step=1 default=1420 value=1800
horizontal_flip 0x00980914 (bool) : default=0 value=0 flags=modify-layout
vertical_flip 0x00980915 (bool) : default=0 value=0 flags=modify-layout
temperature_in_celsius 0x00981920 (int) : min=-1024 max=1023 step=1 default=0 value=0 flags=read-only, volatile
ae_light_level_target 0x00981921 (int) : min=0 max=100 step=1 default=30 value=30 flags=grabbed
ae_convg_step_proportion 0x00981922 (int) : min=0 max=256 step=1 default=140 value=140 flags=grabbed
ae_convg_leak_proportion 0x00981923 (int) : min=0 max=32768 step=1 default=11468 value=11468 flags=grabbed
dark_calibration_pedestal 0x00981924 (int) : min=0 max=255 step=1 default=64 value=64
Camera Controls
auto_exposure 0x009a0901 (menu) : min=0 max=1 default=0 value=1 (Manual Mode) flags=update
auto_exposure_bias 0x009a0913 (intmenu): min=0 max=16 default=8 value=8 (0 0x0) flags=grabbed
3a_lock 0x009a091b (bitmask): max=0x00000007 default=0x00000000 value=0 flags=grabbed
Image Source Controls
vertical_blanking 0x009e0901 (int) : min=110 max=64175 step=1 default=808 value=3056
horizontal_blanking 0x009e0902 (int) : min=116 max=116 step=1 default=116 value=116 flags=read-only
analogue_gain 0x009e0903 (int) : min=0 max=28 step=1 default=0 value=0
Image Processing Controls
link_frequency 0x009f0901 (intmenu): min=0 max=0 default=0 value=0 (402000000 0x17f60880) flags=read-only
pixel_rate 0x009f0902 (int64) : min=160800000 max=160800000 step=1 default=160800000 value=160800000 flags=read-only
test_pattern 0x009f0903 (menu) : min=0 max=7 default=0 value=0 (Disabled)
digital_gain 0x009f0905 (int) : min=256 max=2048 step=1 default=256 value=256
Using this device, I can set the ioctls:
v4l2-ctl --set-ctrl auto_exposure=1 -d /dev/v4l-subdev2
v4l2-ctl --set-ctrl exposure=1800 -d /dev/v4l-subdev2
v4l2-ctl --set-ctrl vertical_blanking=3056 -d /dev/v4l-subdev2
Now, for the last command, I have tried every device from the media-ctl list:
v4l2-ctl --stream-mmap --stream-count=20 --stream-to=capture_20f.raw
VIDIOC_STREAMON returned -1 (Invalid argument)
#I either get this or the other error
v4l2-ctl --stream-mmap --stream-count=20 --stream-to=capture_20f.raw -d /dev/video0
VIDIOC_STREAMON returned -1 (Invalid argument)
v4l2-ctl --stream-mmap --stream-count=20 --stream-to=capture_20f.raw -d /dev/v4l-subdev2
unsupported stream type
dmesg output after this exercise gets me:
[ 867.854751] rp1-cfe 1f00128000.csi: csi2_ch0 node link is not enabled.
[ 2675.872238] rp1-cfe 1f00128000.csi: csi2_ch0 node link is not enabled.
[ 2697.608510] rp1-cfe 1f00128000.csi: csi2_ch0 node link is not enabled.
[ 2717.221212] rp1-cfe 1f00128000.csi: embedded node link is not enabled.
[ 2718.689806] rp1-cfe 1f00128000.csi: csi2_ch2 node link is not enabled.
[ 2720.042199] rp1-cfe 1f00128000.csi: csi2_ch3 node link is not enabled.
[ 2721.258953] rp1-cfe 1f00128000.csi: fe_image0 node link is not enabled.
[ 2722.355612] rp1-cfe 1f00128000.csi: fe_image1 node link is not enabled.
[ 2724.313524] rp1-cfe 1f00128000.csi: fe_stats node link is not enabled.
Any ideas on what I need to do in order to make this work? Maybe enabling the link manually? I am not too versed on media-ctl, but I think it can be done through there, but ideally I would like a more permanent fix.