Navigation

    VEYE IMAGING Forum

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • Recent
    • Popular
    • Users
    • WIKI
    • veye.cc

    SOLVED 相机抓图相关问题

    Rockchip App camera
    2
    8
    1434
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • 潘
      潘阳刚 last edited by

      我尝试做转接板让edge2开发板支持raw-mipi-sc132m相机。
      编译好驱动后,更改设备树如下:

      // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
      / {
      	vcc_mipidphy0: vcc-mipidcphy0-regulator {//cam2-sc132m
      		status = "okay";
      		compatible = "regulator-fixed";
      		gpio = <&gpio1 RK_PB2 GPIO_ACTIVE_HIGH>;
      		pinctrl-names = "default";
      		pinctrl-0 = <&mipidphy0_pwr>;
      		regulator-name = "vcc_mipidphy0";
      		enable-active-high;
      		regulator-always-on;
      	};
      };
      &csi2_dcphy0 {//cam2
      	status = "okay";
      
      	ports {
      		#address-cells = <1>;
      		#size-cells = <0>;
      		port@0 {
      			reg = <0>;
      			#address-cells = <1>;
      			#size-cells = <0>;
      
      			mipi_in_dcphy0: endpoint@1 {
      				reg = <1>;
      				remote-endpoint = <&mvcam_out0>;
      				data-lanes = <1 2>;
      			};
      		};
      		port@1 {
      			reg = <1>;
      			#address-cells = <1>;
      			#size-cells = <0>;
      
      			csidcphy0_out: endpoint@0 {
      				reg = <0>;
      				remote-endpoint = <&mipi0_csi2_input>;
      			};
      		};
      	};
      };
      
      &mipi_dcphy0 {
      	status = "okay";
      };
      
      &csi2_dcphy1 {//cam1
      	status = "okay";
      
      	ports {
      		#address-cells = <1>;
      		#size-cells = <0>;
      		port@0 {
      			reg = <0>;
      			#address-cells = <1>;
      			#size-cells = <0>;
      
      			mipi_in_dcphy1: endpoint@1 {
      				reg = <1>;
      				remote-endpoint = <&imx415f_out1>;
      				data-lanes = <1 2 3 4>;
      			};
      		};
      		port@1 {
      			reg = <1>;
      			#address-cells = <1>;
      			#size-cells = <0>;
      
      			csidcphy1_out: endpoint@0 {
      				reg = <0>;
      				remote-endpoint = <&mipi1_csi2_input>;
      			};
      		};
      	};
      };
      
      &mipi_dcphy1 {
      	status = "okay";
      };
      
      &csi2_dphy0 {//cam3
      	status = "okay";
      
      	ports {
      		#address-cells = <1>;
      		#size-cells = <0>;
      		port@0 {
      			reg = <0>;
      			#address-cells = <1>;
      			#size-cells = <0>;
      
      			mipidphy0_in_ucam0: endpoint@1 {
      				reg = <1>;
      				remote-endpoint = <&imx415c_out0>;
      				data-lanes = <1 2 3 4>;
      			};
      		};
      		port@1 {
      			reg = <1>;
      			#address-cells = <1>;
      			#size-cells = <0>;
      
      			csidphy0_out: endpoint@0 {
      				reg = <0>;
      				remote-endpoint = <&mipi2_csi2_input>;
      			};
      		};
      	};
      };
      
      &csi2_dphy0_hw {
      	status = "okay";
      };
      
      &i2c4 {//cam2
      	status = "okay";
      	pinctrl-names = "default";
      	pinctrl-0 = <&i2c4m3_xfer>;
      
      	dw9714b: dw9714b@c {
      		compatible = "dongwoon,dw9714";
      		status = "disable";
      		reg = <0x0c>;
      		pinctrl-names = "focusb_gpios";
      		pinctrl-0 = <&focusb_gpio>;
      		focus-gpios = <&gpio1 RK_PA0 GPIO_ACTIVE_HIGH>;
      		rockchip,vcm-start-current = <20>;
      		rockchip,vcm-rated-current = <76>;
      		rockchip,vcm-step-mode = <0>;
      		rockchip,camera-module-index = <0>;
      		rockchip,camera-module-facing = "back";
      	};
      
      	imx415b: imx415b@1a {
      		compatible = "sony,imx415";
      		status = "disable";
      		reg = <0x1a>;
      		clocks = <&cru CLK_MIPI_CAMARAOUT_M1>;
      		clock-names = "xvclk";
      		power-domains = <&power RK3588_PD_VI>;
      		pinctrl-names = "default", "camb_gpios";
      		pinctrl-0 = <&mipim1_camera1_clk>, <&camb_gpio>;
      		rockchip,grf = <&sys_grf>;
      		reset-gpios = <&gpio1 RK_PB2 GPIO_ACTIVE_LOW>;
      		pwdn-gpios = <&gpio1 RK_PB3 GPIO_ACTIVE_HIGH>;
      		rockchip,camera-module-index = <0>;
      		rockchip,camera-module-facing = "back";
      		rockchip,camera-module-name = "CMK-OT2022-PX1";
      		rockchip,camera-module-lens-name = "IR0147-50IRC-8M-F20";
      		lens-focus = <&dw9714b>;
      		port {
      			imx415b_out0: endpoint {
      				remote-endpoint = <&mipi_in_dcphy0>;
      				data-lanes = <1 2 3 4>;
      			};
      		};
      	};
      	mvcam: mvcam@3b{
              compatible = "veye,mvcam";
      		status = "okay";
              reg = <0x3b>;
              clocks = <&cru CLK_MIPI_CAMARAOUT_M1>;
              clock-names = "xvclk";
              pinctrl-names = "default";
              pinctrl-0 = <&mipim1_camera1_clk>;
              power-domains = <&power RK3588_PD_VI>;
      
              //power-gpios = <&gpio1 RK_PC4 GPIO_ACTIVE_LOW>;
              reset-gpios = <&gpio3 RK_PA6 GPIO_ACTIVE_HIGH>;//用原来的19和20引脚,SC132M似乎不需要考虑这两个引脚
              pwdn-gpios = <&gpio1 RK_PB3 GPIO_ACTIVE_HIGH>;
      
              //avdd-supply = <&vcc_mipidcphy0>;
              //firefly,clkout-enabled-index = <0>;
              rockchip,camera-module-index = <0>;
              rockchip,camera-module-facing = "back";
              rockchip,camera-module-name = "NC";
              rockchip,camera-module-lens-name = "NC";
                     
              port {
                  mvcam_out0: endpoint {
                      remote-endpoint = <&mipi_in_dcphy0>;
                      data-lanes = <1 2>;
                  };
              };
          };
      };
      
      &i2c3 {//cam1
      	status = "okay";
      	pinctrl-names = "default";
      	pinctrl-0 = <&i2c3m0_xfer>;
      
      	dw9714f: dw9714f@c {
      		compatible = "dongwoon,dw9714";
      		status = "okay";
      		reg = <0x0c>;
      		pinctrl-names = "focusf_gpios";
      		pinctrl-0 = <&focusf_gpio>;
      		focus-gpios = <&gpio1 RK_PA1 GPIO_ACTIVE_HIGH>;
      		rockchip,vcm-start-current = <20>;
      		rockchip,vcm-rated-current = <76>;
      		rockchip,vcm-step-mode = <0>;
      		rockchip,camera-module-index = <1>;
      		rockchip,camera-module-facing = "front";
      	};
      
      	imx415f: imx415f@1a {
      		compatible = "sony,imx415";
      		status = "okay";
      		reg = <0x1a>;
      		clocks = <&cru CLK_MIPI_CAMARAOUT_M2>;
      		clock-names = "xvclk";
      		power-domains = <&power RK3588_PD_VI>;
      		pinctrl-names = "default", "camf_gpios";
      		pinctrl-0 = <&mipim1_camera2_clk>, <&camf_gpio>;
      		rockchip,grf = <&sys_grf>;
      		reset-gpios = <&gpio3 RK_PC6 GPIO_ACTIVE_LOW>;
      		pwdn-gpios = <&gpio3 RK_PC5 GPIO_ACTIVE_HIGH>;
      		rockchip,camera-module-index = <1>;
      		rockchip,camera-module-facing = "front";
      		rockchip,camera-module-name = "CMK-OT2022-PX1";
      		rockchip,camera-module-lens-name = "IR0147-50IRC-8M-F20";
      		lens-focus = <&dw9714f>;
      		port {
      			imx415f_out1: endpoint {
      				remote-endpoint = <&mipi_in_dcphy1>;
      				data-lanes = <1 2 3 4>;
      			};
      		};
      	};
      };
      
      &i2c8 {//cam3
      	status = "okay";
      	pinctrl-names = "default";
      	pinctrl-0 = <&i2c8m2_xfer>;
      
      	dw9714c: dw9714c@c {
      		compatible = "dongwoon,dw9714";
      		status = "okay";
      		reg = <0x0c>;
      		pinctrl-names = "focusc_gpios";
      		pinctrl-0 = <&focusc_gpio>;
      		focus-gpios = <&gpio1 RK_PA6 GPIO_ACTIVE_HIGH>;
      		rockchip,vcm-start-current = <20>;
      		rockchip,vcm-rated-current = <76>;
      		rockchip,vcm-step-mode = <0>;
      		rockchip,camera-module-index = <0>;
      		rockchip,camera-module-facing = "back";
      	};
      
      	imx415: imx415@1a {
      		compatible = "sony,imx415";
      		reg = <0x1a>;
      		clocks = <&cru CLK_MIPI_CAMARAOUT_M3>;
      		clock-names = "xvclk";
      		pinctrl-names = "default", "camc_gpios";
      		pinctrl-0 = <&mipim1_camera3_clk>, <&camc_gpio>;
      		power-domains = <&power RK3588_PD_VI>;
      		reset-gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>;	
      		pwdn-gpios = <&gpio1 RK_PA4 GPIO_ACTIVE_HIGH>;
      		rockchip,camera-module-index = <0>;
      		rockchip,camera-module-facing = "back";
      		rockchip,camera-module-name = "CMK-OT2022-PX1";
      		rockchip,camera-module-lens-name = "IR0147-50IRC-8M-F20";
      		lens-focus = <&dw9714c>;
      		port {
      			imx415c_out0: endpoint {
      				remote-endpoint = <&mipidphy0_in_ucam0>;
      				data-lanes = <1 2 3 4>;
      			};
      		};
      	};
      };
      
      &pinctrl {
      	cam {
      		mipidphy0_pwr: mipidphy0-pwr {
      			rockchip,pins =
      				/* camera power en */
      				<1 RK_PB2 RK_FUNC_GPIO &pcfg_output_high>;
      		};
      		camf_gpio: camf-gpio {//imx415
      			rockchip,pins =
      				<3 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>,
      				<3 RK_PC5 RK_FUNC_GPIO &pcfg_pull_none>;
      		};
      		camb_gpio: camb-gpio {//imx415
      			rockchip,pins =
      				<1 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>,
      				<1 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
      		};
      		camc_gpio: camc-gpio {//imx415
      			rockchip,pins =
      				<3 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>,
      				<1 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>;
      		};
      		focusb_gpio: focusb-gpio {//dw9714
      			rockchip,pins =
      				<1 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>;
      		};
      		focusf_gpio: focusf-gpio {//dw9714
      			rockchip,pins =
      				<1 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
      		};
      		focusc_gpio: focusc-gpio {//dw9714
      			rockchip,pins =
      				<1 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>;
      		};
      	};
      };
      
      &mipi0_csi2 {//cam2
      	status = "okay";
      
      	ports {
      		#address-cells = <1>;
      		#size-cells = <0>;
      
      		port@0 {
      			reg = <0>;
      			#address-cells = <1>;
      			#size-cells = <0>;
      
      			mipi0_csi2_input: endpoint@1 {
      				reg = <1>;
      				remote-endpoint = <&csidcphy0_out>;
      			};
      		};
      
      		port@1 {
      			reg = <1>;
      			#address-cells = <1>;
      			#size-cells = <0>;
      
      			mipi0_csi2_output: endpoint@0 {
      				reg = <0>;
      				remote-endpoint = <&cif_mipi_in0>;
      			};
      		};
      	};
      };
      
      &mipi1_csi2 {//cam1
      	status = "okay";
      
      	ports {
      		#address-cells = <1>;
      		#size-cells = <0>;
      
      		port@0 {
      			reg = <0>;
      			#address-cells = <1>;
      			#size-cells = <0>;
      
      			mipi1_csi2_input: endpoint@1 {
      				reg = <1>;
      				remote-endpoint = <&csidcphy1_out>;
      			};
      		};
      
      		port@1 {
      			reg = <1>;
      			#address-cells = <1>;
      			#size-cells = <0>;
      
      			mipi1_csi2_output: endpoint@0 {
      				reg = <0>;
      				remote-endpoint = <&cif_mipi_in1>;
      			};
      		};
      	};
      };
      
      &mipi2_csi2 {//cam3
      	status = "okay";
      
      	ports {
      		#address-cells = <1>;
      		#size-cells = <0>;
      
      		port@0 {
      			reg = <0>;
      			#address-cells = <1>;
      			#size-cells = <0>;
      
      			mipi2_csi2_input: endpoint@1 {
      				reg = <1>;
      				remote-endpoint = <&csidphy0_out>;
      			};
      		};
      
      		port@1 {
      			reg = <1>;
      			#address-cells = <1>;
      			#size-cells = <0>;
      
      			mipi2_csi2_output: endpoint@0 {
      				reg = <0>;
      				remote-endpoint = <&cif_mipi2_in0>;
      			};
      		};
      	};
      };
      
      &rkcif {
      	status = "okay";
      };
      
      &rkcif_mipi_lvds {
      	status = "okay";
      
      	port {
      		cif_mipi_in0: endpoint {
      			remote-endpoint = <&mipi0_csi2_output>;
      		};
      	};
      };
      
      &rkcif_mipi_lvds_sditf {
      	status = "okay";
      
      	port {
      		mipi_lvds_sditf: endpoint {
      			remote-endpoint = <&isp0_vir0>;
      		};
      	};
      };
      
      &rkcif_mipi_lvds1 {
      	status = "okay";
      
      	port {
      		cif_mipi_in1: endpoint {
      			remote-endpoint = <&mipi1_csi2_output>;
      		};
      	};
      };
      
      &rkcif_mipi_lvds1_sditf {
      	status = "okay";
      
      	port {
      		mipi1_lvds_sditf: endpoint {
      			remote-endpoint = <&isp0_vir1>;
      		};
      	};
      };
      
      &rkcif_mipi_lvds2 {
      	status = "okay";
      
      	port {
      		cif_mipi2_in0: endpoint {
      			remote-endpoint = <&mipi2_csi2_output>;
      		};
      	};
      };
      
      &rkcif_mipi_lvds2_sditf {
      	status = "okay";
      
      	port {
      		mipi_lvds2_sditf: endpoint {
      			remote-endpoint = <&isp1_vir0>;
      		};
      	};
      };
      
      &rkcif_mmu {
      	status = "okay";
      };
      
      &rkisp0 {
      	status = "okay";
      
      };
      
      &isp0_mmu {
      	status = "okay";
      };
      
      &rkisp0_vir0 {
      	status = "okay";
      
      	port {
      		#address-cells = <1>;
      		#size-cells = <0>;
      
      		isp0_vir0: endpoint@0 {
      			reg = <0>;
      			remote-endpoint = <&mipi_lvds_sditf>;
      		};
      	};
      };
      
      &rkisp0_vir1 {
      	status = "okay";
      
      	port {
      		#address-cells = <1>;
      		#size-cells = <0>;
      
      		isp0_vir1: endpoint@0 {
      			reg = <0>;
      			remote-endpoint = <&mipi1_lvds_sditf>;
      		};
      	};
      };
      
      &rkisp1 {
      	status = "okay";
      };
      
      &isp1_mmu {
      	status = "okay";
      };
      
      &rkisp1_vir0 {
      	status = "okay";
      
      	port {
      		#address-cells = <1>;
      		#size-cells = <0>;
      
      		isp1_vir0: endpoint@0 {
      			reg = <0>;
      			remote-endpoint = <&mipi_lvds2_sditf>;
      		};
      	};
      };
      
      

      开发板能够识别到相机:

      [   10.868932] mvcam 4-003b: veye mv series camera driver version: 01.01.04
      [   11.872574] mvcam 4-003b: camera is: RAW-MIPI-SC132M
      [   11.873598] mvcam 4-003b: firmware version: 0x1040000
      [   11.877481] mvcam 4-003b: mvcam_get_mipifeature: lane num 2, datarate 1500000000 bps
      [   11.877588] mvcam 4-003b: Success to get mvcam endpoint data lanes, dts uses 2 lanes
      [   11.891182] mvcam 4-003b: mvcam_enum_controls success
      

      但是使用命令

      v4l2-ctl -d /dev/video0 --set-fmt-video=width=1080,height=1280,pixelformat=GREY --stream-mmap --stream-count=1 --stream-to=y8-1088x1280.raw
      

      会报错:

      [ 2912.107051] rkcif-mipi-lvds: ERROR: csi size err, intstat:0x1000000, lastline:0!!
      

      之后我通过v4l2-ctl -L命令发现:

      [ 3120.790050] rockchip-csi2-dphy csi2-dcphy0: csi2_dphy_update_sensor_mbus fail to get dphy param, used default value
      

      我不知道哪里出现了问题,请问我该如何排查?

      veye_xumm 1 Reply Last reply Reply Quote 0
      • veye_xumm
        veye_xumm @潘阳刚 last edited by

        @潘阳刚 这个问题有可能是edge2的linux kernel 源码缺少一些对数据格式的支持。
        kernel\drivers\media\platform\rockchip\cif\capture.c
        附件这份代码,你聊做参考。
        capture.c.txt

        潘 1 Reply Last reply Reply Quote 0
        • 潘
          潘阳刚 @veye_xumm last edited by

          @veye_xumm 确实缺少支持,我修改了这个文件。重新烧录镜像之后再次尝试,现在的log是这样的:

          v4l2-ctl -d /dev/video0 --set-fmt-video=width=1080,height=1280,pixelformat=GREY --stream-mmap --stream-count=1 --stream-to=y8-1088x1280.raw
          [ 1189.005947] rockchip-csi2-dphy csi2-dcphy0: csi2_dphy_update_sensor_mbus fail to get dphy param, used default value
          [ 1189.009415] rockchip-csi2-dphy csi2-dcphy0: csi2_dphy_update_sensor_mbus fail to get dphy param, used default value
          [ 1189.009978] rockchip-mipi-csi2 fdd10000.mipi0-csi2: stream on, src_sd: 000000002ff232b9, sd_name:rockchip-csi2-dphy0
          [ 1189.010005] rockchip-mipi-csi2 fdd10000.mipi0-csi2: stream ON
          [ 1189.010037] rockchip-csi2-dphy csi2-dcphy0: csi2_dphy_update_sensor_mbus fail to get dphy param, used default value
          [ 1189.010057] rockchip-csi2-dphy csi2-dcphy0: csi2_dphy_update_sensor_mbus fail to get dphy param, used default value
          [ 1189.010084] rockchip-csi2-dphy csi2-dcphy0: csi2_dphy_update_sensor_mbus fail to get dphy param, used default value
          <[ 1189.032767] rockchip-mipi-csi2 fdd10000.mipi0-csi2: stream off, src_sd: 000000002ff232b9, sd_name:rockchip-csi2-dphy0
          [ 1189.032803] rockchip-mipi-csi2 fdd10000.mipi0-csi2: stream OFF
          

          还是没能获取到图像数据。

          veye_xumm 1 Reply Last reply Reply Quote 0
          • veye_xumm
            veye_xumm @潘阳刚 last edited by

            @潘阳刚 感觉你现在问题更麻烦了。 上次给你的文件,不能直接替换掉,你从中把关于数据类型的几个地方修改到原来edge2的源码中即可。

            潘 1 Reply Last reply Reply Quote 0
            • 潘
              潘阳刚 @veye_xumm last edited by 潘阳刚

              capture.txt @veye_xumm 我没有直接替换,原始文件和您给我的文件只有如下几处不一样,我进行了修改:
              A2.png

              A1.png
              绿色的几行本不在原始文件中。
              其他有区别但是我未作改动的:
              A4.png

              A3.png

              其他的都一致。现在的问题有没有可能是转接板PCB设计不恰当导致的?
              capture.txt

              veye_xumm 1 Reply Last reply Reply Quote 0
              • veye_xumm
                veye_xumm @潘阳刚 last edited by

                @潘阳刚 整体上我看你的操作没有太大问题。 现在不出图,不太清楚是咋回事。 要不你把板子寄过来,我们给看一下吧。

                潘 1 Reply Last reply Reply Quote 0
                • 潘
                  潘阳刚 @veye_xumm last edited by

                  @veye_xumm 地址是什么?

                  veye_xumm 1 Reply Last reply Reply Quote 0
                  • veye_xumm
                    veye_xumm @潘阳刚 last edited by

                    已私信。已私信。

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post