imx8mp Failed to obtain sensor raw12 data

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

imx8mp Failed to obtain sensor raw12 data

1,233 Views
zoro_li
Contributor I

The code is modified as follows:

struct mxc_isi_fmt mxc_isi_out_formats[] = {
        }, {
        +.name       = "SBGGR12",
        +.fourcc     = V4L2_PIX_FMT_SBGGR12,
        +.depth      = { 12 },
        +.color      = MXC_ISI_OUT_FMT_RAW16,
        +.memplanes  = 1,
        +.colplanes  = 1,
        +.mbus_code  = MEDIA_BUS_FMT_SBGGR12_1X12,
    }
}
struct mxc_isi_fmt mxc_isi_src_formats[] = {
    }, {
    +    .name       = "SBGGR12",
    +    .fourcc     = V4L2_PIX_FMT_SBGGR12,
    +    .depth      = { 12 },
    +    .memplanes  = 1,
    +    .colplanes  = 1,
    +}
}

struct mxc_isi_fmt *mxc_isi_get_src_fmt(struct v4l2_subdev_format *sd_fmt)
{
    ...
    +else if(sd_fmt->format.code == MEDIA_BUS_FMT_SBGGR12_1X12)
    +    index = 3;
    +else
    +    index = 0;
}

dts:

&i2c3 {
    #address-cells = <1>;
    #size-cells = <0>;
    status = "okay";

    mlx75027_mipi@57 {
        assigned-clocks = <&clk IMX8MP_CLK_IPP_DO_CLKO2>;
        assigned-clock-parents = <&clk IMX8MP_CLK_24M>;
        assigned-clock-rates = <8000000>;
        AVDD-supply = <&reg_3p3v>;
        compatible = "mlx75027";
        clock-names = "xclk";
        clocks = <&clk IMX8MP_CLK_IPP_DO_CLKO2>;
        csi_id = <0>;
        DOVDD-supply = <&reg_3p3v>;
        DVDD-supply = <&reg_3p3v>;
        mclk = <8000000>;
        mclk_source = <0>;
        mipi_csi;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_gpio5>, <&pinctrl_gpio6>, <&pinctrl_gpio7>, <&pinctrl_gpio8>;
        //pinctrl-0 = <&pinctrl_gpio5>, <&pinctrl_gpio6>;
        trigger-gpios = <&gpio4 1 GPIO_ACTIVE_LOW>; /* Apalis GPIO4  trigger pin dahlia:SODIMM 222*/  
      
        rst-gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;    /* Apalis GPIO1  reset pin dahlia:SODIMM 216*/ 
        led-gpios = <&gpio1 8 GPIO_ACTIVE_LOW>; /* Apalis GPIO2  led pin dahlia:SODIMM 218*/
        alert-gpios = <&gpio4 3 GPIO_ACTIVE_LOW>;   /* Apalis GPIO3  temperature alert dahlia:SODIMM 2
20*/        
        PVDD-supply = <&reg_3p3v>;
        reg = <0x57>;
        camera_mipi_lanes = <4>;
        status = "okay";

        port {
            mlx75027_ep: endpoint {
                clock-lanes = <0>;
                data-lanes = <1 2 3 4>;
                remote-endpoint = <&mipi_csi0_ep>;
            };      
        };      
    };      
};

&isi_0 {
    status = "okay";

    cap_device {
        status = "okay";
    };      
};


&mipi_csi_0 {
    #address-cells = <1>;
    #size-cells = <0>; 
    /*  
    /delete-property/virtual-channel;
    */
    status = "okay";

    /* Camera 1 MIPI CSI-2 (CSIS0) */
    port@0 {
        reg = <0>;

        mipi_csi0_ep: endpoint {
            csis-hs-settle = <4>;
            csis-clk-settle = <1>;
            csis-wclk;
            data-lanes = <4>;
            remote-endpoint = <&mlx75027_ep>;
        };      
    };      
};


Using v4l2-ctl to capture images, no error will be prompted and no data will be obtained
It seems that the sensor is not connected

dump register info:

[   36.514445] bypass csc
[   36.523442] mxc-isi 32e00000.isi: ISI CHNLC register dump, isi0
[   36.523447] mxc-isi 32e00000.isi:            CHNL_CTRL[0x00]: e0000000
[   36.523451] mxc-isi 32e00000.isi:        CHNL_IMG_CTRL[0x04]: f000001
[   36.523455] mxc-isi 32e00000.isi:    CHNL_OUT_BUF_CTRL[0x08]: 7c707
[   36.523459] mxc-isi 32e00000.isi:         CHNL_IMG_CFG[0x0c]: 1e00280
[   36.523463] mxc-isi 32e00000.isi:             CHNL_IER[0x10]: 3cfc0000
[   36.523467] mxc-isi 32e00000.isi:             CHNL_STS[0x14]: 100
[   36.523471] mxc-isi 32e00000.isi:    CHNL_SCALE_FACTOR[0x18]: 10001000
[   36.523475] mxc-isi 32e00000.isi:    CHNL_SCALE_OFFSET[0x1c]: 00
[   36.523479] mxc-isi 32e00000.isi:        CHNL_CROP_ULC[0x20]: 00
[   36.523482] mxc-isi 32e00000.isi:        CHNL_CROP_LRC[0x24]: 00
[   36.523486] mxc-isi 32e00000.isi:      CHNL_CSC_COEFF0[0x28]: 00
[   36.523490] mxc-isi 32e00000.isi:      CHNL_CSC_COEFF1[0x2c]: 00
[   36.523493] mxc-isi 32e00000.isi:      CHNL_CSC_COEFF2[0x30]: 00
[   36.523497] mxc-isi 32e00000.isi:      CHNL_CSC_COEFF3[0x34]: 00
[   36.523500] mxc-isi 32e00000.isi:      CHNL_CSC_COEFF4[0x38]: 00
[   36.523504] mxc-isi 32e00000.isi:      CHNL_CSC_COEFF5[0x3c]: 00
[   36.523508] mxc-isi 32e00000.isi:     CHNL_ROI_0_ALPHA[0x40]: 00
[   36.523511] mxc-isi 32e00000.isi:       CHNL_ROI_0_ULC[0x44]: 00
[   36.523515] mxc-isi 32e00000.isi:       CHNL_ROI_0_LRC[0x48]: 00
[   36.523519] mxc-isi 32e00000.isi:     CHNL_ROI_1_ALPHA[0x4c]: 00
[   36.523523] mxc-isi 32e00000.isi:       CHNL_ROI_1_ULC[0x50]: 00
[   36.523526] mxc-isi 32e00000.isi:       CHNL_ROI_1_LRC[0x54]: 00
[   36.523534] mxc-isi 32e00000.isi:     CHNL_ROI_2_ALPHA[0x58]: 00
[   36.523537] mxc-isi 32e00000.isi:       CHNL_ROI_2_ULC[0x5c]: 00
[   36.523541] mxc-isi 32e00000.isi:       CHNL_ROI_2_LRC[0x60]: 00
[   36.523545] mxc-isi 32e00000.isi:     CHNL_ROI_3_ALPHA[0x64]: 00
[   36.523548] mxc-isi 32e00000.isi:       CHNL_ROI_3_ULC[0x68]: 00
[   36.523552] mxc-isi 32e00000.isi:       CHNL_ROI_3_LRC[0x6c]: 00
[   36.523556] mxc-isi 32e00000.isi: CHNL_OUT_BUF1_ADDR_Y[0x70]: d2100000
[   36.523559] mxc-isi 32e00000.isi: CHNL_OUT_BUF1_ADDR_U[0x74]: 00
[   36.523563] mxc-isi 32e00000.isi: CHNL_OUT_BUF1_ADDR_V[0x78]: 00
[   36.523567] mxc-isi 32e00000.isi:   CHNL_OUT_BUF_PITCH[0x7c]: 500
[   36.523570] mxc-isi 32e00000.isi:     CHNL_IN_BUF_ADDR[0x80]: 00
[   36.523574] mxc-isi 32e00000.isi:    CHNL_IN_BUF_PITCH[0x84]: 00
[   36.523578] mxc-isi 32e00000.isi:     CHNL_MEM_RD_CTRL[0x88]: 00
[   36.523636] mxc-isi 32e00000.isi: CHNL_OUT_BUF2_ADDR_Y[0x8c]: d0100000
[   36.523643] mxc-isi 32e00000.isi: CHNL_OUT_BUF2_ADDR_U[0x90]: 00
[   36.523648] mxc-isi 32e00000.isi: CHNL_OUT_BUF2_ADDR_V[0x94]: 00
[   36.523653] mxc-isi 32e00000.isi:     CHNL_SCL_IMG_CFG[0x98]: 1e00280
[   36.523656] mxc-isi 32e00000.isi:       CHNL_FLOW_CTRL[0x9c]: 00

[   36.867448] mxc-mipi-csi2.0: fmt: 0x3008, 640 x 480

[   36.883597] mxc-mipi-csi2.0: --- mipi_csis_s_stream ---
[   36.883603] mxc-mipi-csi2.0:         CSIS_VERSION[0]: 0x03060301
[   36.883605] mxc-mipi-csi2.0:        CSIS_CMN_CTRL[4]: 0x00004b05
[   36.883608] mxc-mipi-csi2.0:        CSIS_CLK_CTRL[8]: 0x000f0010
[   36.883610] mxc-mipi-csi2.0:          CSIS_INTMSK[10]: 0x0fffff1f
[   36.883612] mxc-mipi-csi2.0:          CSIS_INTSRC[14]: 0x00000000
[   36.883616] mxc-mipi-csi2.0:      CSIS_DPHYSTATUS[20]: 0x00000002
[   36.883621] mxc-mipi-csi2.0:        CSIS_DPHYCTRL[24]: 0x0440001f
[   36.883626] mxc-mipi-csi2.0:     CSIS_DPHYBCTRL_L[30]: 0x000001f4
[   36.883630] mxc-mipi-csi2.0:     CSIS_DPHYBCTRL_H[34]: 0x00000000
[   36.883636] mxc-mipi-csi2.0:     CSIS_DPHYSCTRL_L[38]: 0x00000000
[   36.883643] mxc-mipi-csi2.0:     CSIS_DPHYSCTRL_H[3c]: 0x00000000
[   36.883646] mxc-mipi-csi2.0:   CSIS_ISPCONFIG_CH0[40]: 0x000000b0
[   36.883651] mxc-mipi-csi2.0:   CSIS_ISPCONFIG_CH1[50]: 0x000008fd
[   36.883654] mxc-mipi-csi2.0:   CSIS_ISPCONFIG_CH2[60]: 0x000008fe
[   36.883657] mxc-mipi-csi2.0:   CSIS_ISPCONFIG_CH3[70]: 0x000008ff
[   36.883660] mxc-mipi-csi2.0:    CSIS_ISPRESOL_CH0[44]: 0x01e00280
[   36.883664] mxc-mipi-csi2.0:    CSIS_ISPRESOL_CH1[54]: 0x80008000
[   36.883667] mxc-mipi-csi2.0:    CSIS_ISPRESOL_CH2[64]: 0x80008000
[   36.883670] mxc-mipi-csi2.0:    CSIS_ISPRESOL_CH3[74]: 0x80008000
[   36.883673] mxc-mipi-csi2.0:     CSIS_ISPSYNC_CH0[48]: 0x00000000
[   36.883676] mxc-mipi-csi2.0:     CSIS_ISPSYNC_CH1[58]: 0x00000000
[   36.883679] mxc-mipi-csi2.0:     CSIS_ISPSYNC_CH2[68]: 0x00000000
[   36.883682] mxc-mipi-csi2.0:     CSIS_ISPSYNC_CH3[78]: 0x00000000
[   36.883686] mxc-mipi-csi2.0: --- mipi_csis_s_stream ---
[   36.883691] mxc-mipi-csi2.0:    GPR_GASKET_0_CTRL[60]: 0xffff8000
[   36.883694] mxc-mipi-csi2.0:   GPR_GASKET_0_HSIZE[64]: 0xffff8000
[   36.883697] mxc-mipi-csi2.0:   GPR_GASKET_0_VSIZE[68]: 0xffff8000

[   36.883708] isi-capture 32e00000.isi:cap_device: mxc_isi.0.capture is no v4l2 subdev
[   36.883734] isi-capture 32e00000.isi:cap_device: mxc_isi_cap_g_fmt_mplane
[   38.891295] isi-capture 32e00000.isi:cap_device: cap_vb2_stop_streaming

 

media :

root@verdin-imx8mp-07154640:~# media-ctl -pd /dev/media0  
Media controller API version 5.4.[ 1904.454865] mlx75027_get_fmt
193

Media device information
------------------------
driver          mxc-md
model           FSL Capture Media Device
serial          
bus info        
hw revision     0x0
driver version  5.4.193

Device topology
- entity 1: mxc_isi.0 (16 pads, 2 links)
            type V4L2 subdev subtype Unknown flags 0
        pad0: Sink
                <- "mxc-mipi-csi2.0":4 [ENABLED]
        pad1: Sink
        pad2: Sink
        pad3: Sink
        pad4: Sink
        pad5: Sink
        pad6: Sink
        pad7: Sink
        pad8: Sink
        pad9: Sink
        pad10: Sink
        pad11: Sink
        pad12: Source
                -> "mxc_isi.0.capture":0 [ENABLED]
        pad13: Source
        pad14: Source
        pad15: Sink

- entity 18: mxc_isi.0.capture (1 pad, 1 link)
             type Node subtype V4L flags 0
             device node name /dev/video0
        pad0: Sink
                <- "mxc_isi.0":12 [ENABLED]

- entity 22: mxc-mipi-csi2.0 (8 pads, 2 links)
             type Node subtype V4L flags 0
             device node name /dev/v4l-subdev0
        pad0: Sink
                <- "mlx75027 2-0057":0 [ENABLED,IMMUTABLE]
        pad1: Sink
        pad2: Sink
        pad3: Sink
        pad4: Source
                -> "mxc_isi.0":0 [ENABLED]
        pad5: Source
        pad6: Source
        pad7: Source

- entity 31: mlx75027 2-0057 (1 pad, 1 link)
             type V4L2 subdev subtype Sensor flags 0
             device node name /dev/v4l-subdev1
        pad0: Source
                [fmt:SBGGR12_1X12/640x480 field:none colorspace:raw]
                -> "mxc-mipi-csi2.0":0 [ENABLED,IMMUTABLE]
0 Kudos
Reply
8 Replies

1,219 Views
joanxie
NXP TechSupport
NXP TechSupport

since you use raw data, why don't you use ISP instead of ISI? and I don't think you need to add this

 +else if(sd_fmt->format.code == MEDIA_BUS_FMT_SBGGR12_1X12)
    +    index = 3;
    +else
    +    index = 0;

refer to the source code,

/* Pixel link master will transfer format to RGB32 or YUV32 */
	src_f->fmt = mxc_isi_get_src_fmt(&src_fmt);

so you just keep the index to 0 if you use raw12

0 Kudos
Reply

1,209 Views
zoro_li
Contributor I

HI:

     Thanks for you reply.

      In structure mxc_ isi_ src_ In formats, RAW12 is not supported, so the above pair is added.

      Now I just need to get the raw12 data, so I used isi

      My understanding is that isi stores sensor data directly into ram, while isp needs to cooperate with some parameters to convert images into yuv format. Is that right?

0 Kudos
Reply

1,199 Views
joanxie
NXP TechSupport
NXP TechSupport

refer to the source code I sent to you, you don't need add this format, you can try to remove it, because you use index=3, but mxc_isi_src_formats structure only has two members, you can try it firstly

yes you are correct, ISI couldn't handle raw data, only capture and store in the memory

 

0 Kudos
Reply

1,195 Views
zoro_li
Contributor I

I have solved the problem that sensor data cannot be obtained.

1. My sensor mipi clk uses a continuous clock and does not enter the lps mode.
2. mxc_isi_pipeline_enable function, the starting sequence is sensor ->dphy ->csi2
The sensor starts before dphy, which causes dphy to fail to parse,i t seems that dphy does not support the continuous clock mode.
It can only detect the switch from low speed to high speed.

The solution is to set the sensor mipi clk to discontinuous mode.

0 Kudos
Reply

1,196 Views
zoro_li
Contributor I

I added 2 members to the mxc_isi_src_formats structure, so for BG12, the index value is 3

struct mxc_isi_fmt mxc_isi_src_formats[] = {
    {    
        .name       = "RGB32",
        .fourcc     = V4L2_PIX_FMT_RGB32,
        .depth      = { 32 },
        .memplanes  = 1, 
        .colplanes  = 1, 
    }, { 
        .name       = "YUV32 (X-Y-U-V)",
        .fourcc     = V4L2_PIX_FMT_YUV32,
        .depth      = { 32 },
        .memplanes  = 1, 
        .colplanes  = 1, 
    }, { 
        .name       = "SBGGR8",
        .fourcc     = V4L2_PIX_FMT_SBGGR8,
        .depth      = { 8 }, 
        .memplanes  = 1, 
        .colplanes  = 1, 
    }, { 
        .name       = "SBGGR12",
        .fourcc     = V4L2_PIX_FMT_SBGGR12,
        .depth      = { 12 },
        .memplanes  = 1, 
        .colplanes  = 1, 
    }    
};

I have solved the problem that sensor data cannot be obtained.

1. My sensor mipi clk uses a continuous clock and does not enter the lps mode.
2. mxc_isi_pipeline_enable function, the starting sequence is sensor ->dphy ->csi2
The sensor starts before dphy, which causes dphy to fail to parse,i t seems that dphy does not support the continuous clock mode.
It can only detect the switch from low speed to high speed.

The solution is to set the sensor mipi clk to discontinuous mode.

0 Kudos
Reply

1,182 Views
joanxie
NXP TechSupport
NXP TechSupport

ok I don't see your whole source code, but in fact, imx8mp mipi csi can support continuous mode

0 Kudos
Reply

1,179 Views
zoro_li
Contributor I

Can you tell me how to modify the code to make imx8mp support continuous mode?

0 Kudos
Reply

1,163 Views
joanxie
NXP TechSupport
NXP TechSupport

as I known, no special configuration for this

0 Kudos
Reply