This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TDA4VM: V4L2 camera capture hangs - capture problem

Part Number: TDA4VM

Hello, everyone.

I created a v4l2 camera driver for the board tda4vm. I'm new to the board, so I opted to start with a clear stream from the Nvidia Jetson board, which I've had some experience with. It was all well, and I was able to stream from my RGGB12 3840x2160 camera.

Then I adjust the driver for TDA4VM board and it all wen't fine, it writes it's registers to serializer, deserializer and camera. There are no concerns here; it successfully probes.

Then I run the following commands to link the media to /dev/video2:

media-ctl -d /dev/media0 --set-v4l2 '"cdns_csi2rx.4504000.csi-bridge":0 [fmt:SRGGB12_1X12/3840x2160]'
media-ctl -d /dev/media0 --links '"cdns_csi2rx.4504000.csi-bridge":1 -> "4500000.ticsi2rx":0[1]'

And afterwards using yavta, to get frames:

yavta /dev/video2 -c8 -f SRGGB12 -F5.raw -s 3840x2160

However when I execute the yavta command, it just hangs, and doesn't capture any frames at all.

I looked through the forum and discovered a couple of others that had similar problems as myself, but none of the solutions they found worked.

How can I solve this problem ?

Here's the dtso file for my camera.

/dts-v1/;
/plugin/;

#include <dt-bindings/gpio/gpio.h>
#include "k3-pinctrl.h"

&{/} {
	clk_s5k1h1sb_fixed: s5k1h1sb-xclk {
		compatible = "fixed-clock";
		#clock-cells = <0>;
		clock-frequency = <25000000>;
	};
};

&main_pmx0 {
	csi2_exp_pins_default: csi2-exp-pins-default {
		pinctrl-single,pins = <
			J721E_IOPAD(0x140, PIN_OUTPUT, 7) /* (AG29) PRG0_PRU1_GPO16.GPIO0_79 */
		>;
	};
};

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

	i2c-switch@70 {
		compatible = "nxp,pca9543";
		#address-cells = <1>;
		#size-cells = <0>;
		reg = <0x70>;

		ti_cam0_i2c: i2c@0 {
			#address-cells = <1>;
			#size-cells = <0>;
			reg = <0>;

			dser_0: max9296@28 {
				compatible = "max9296_gmsl2";
				reg = <0x28>;
				csi-mode = "2x4";
				max-src = <1>;
			};
			ser_prim_0: max9295_prim@40 {
				compatible = "max9295_gmsl2";
				reg = <0x40>;
				is-prim-ser;
				gmsl-dser-device = <&dser_0>;
				rclkout;
			};
			s5k1h1sb_serdes_0@10 {
				compatible = "samsung_s5k1h1sb";
				reg = <0x10>;
				def-addr = <0x10>;
				clocks = <&clk_s5k1h1sb_fixed>;
				gmsl-ser-device = <&ser_prim_0>;
				gmsl-dser-device = <&dser_0>;
				
				port{
					csi2_cam0: endpoint {
						clock-lanes = <0>;
						data-lanes = <1 2>;
						remote-endpoint = <&csi2rx0_in_sensor>;
						link-frequencies = /bits/ 64 <215000000>;
					};
				};
				gmsl-link {
					src-csi-port = "b";
					dst-csi-port = "a";
					serdes-csi-link = "a";
					csi-mode = "1x4";
					st-vc = <0>;
					vc-id = <0>;
					num-lanes = <2>;
					streams = "yuv422";
				};
			};
		};
	};
};

&csi0_port0 {
	status = "okay";
	csi2rx0_in_sensor: endpoint {
		remote-endpoint = <&csi2_cam0>;
		bus-type = <4>; /* CSI2 DPHY */
		clock-lanes = <0>;
		data-lanes = <1 2>;
	};
};



Thanks.

  • Hi,

    Are you running this on the EVM or on the SK (Starter Kit) Board?

    May I know which SDK have you used to run this usecase?

    Regards,

    Nikhil

  • Hi Nikhil,

    Are you running this on the EVM or on the SK (Starter Kit) Board?

    EVM.

    - May I know which SDK have you used to run this usecase?

    ti-processor-sdk-linux-edgeai-j721e-evm-09_01_00_06

    Thanks.

  • Hi,

    There is a script in the /opt/edge_ai_apps/script which could be used to route and set formats to the sensor. 

    setup_cameras.sh « scripts - edgeai/edge_ai_apps - Unnamed repository; edit this file 'description' to name the repository.

    Could you run the same and share the logs for "media-ctl -p" ?

    Regards,

    Nikhil

  • Hi Nikhil,

    Here is the logs you asked for:

    Before setup_cameras.sh:

    media-ctl -p
    Media controller API version 6.1.46
    
    Media device information
    ------------------------
    driver          j721e-csi2rx
    model           TI-CSI2RX
    serial          
    bus info        platform:4500000.ticsi2rx
    hw revision     0x1
    driver version  6.1.46
    
    Device topology
    - entity 1: 4500000.ticsi2rx (17 pads, 17 links, 1 route)
                type V4L2 subdev subtype Unknown flags 0
                device node name /dev/v4l-subdev0
    	routes:
    		0/0 -> 1/0 [ACTIVE]
    	pad0: Sink
    		[stream:0 fmt:UYVY8_1X16/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range]
    		<- "cdns_csi2rx.4504000.csi-bridge":1 [ENABLED,IMMUTABLE]
    	pad1: Source
    		[stream:0 fmt:UYVY8_1X16/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range]
    		-> "4500000.ticsi2rx context 0":0 [ENABLED,IMMUTABLE]
    	pad2: Source
    		-> "4500000.ticsi2rx context 1":0 [ENABLED,IMMUTABLE]
    	pad3: Source
    		-> "4500000.ticsi2rx context 2":0 [ENABLED,IMMUTABLE]
    	pad4: Source
    		-> "4500000.ticsi2rx context 3":0 [ENABLED,IMMUTABLE]
    	pad5: Source
    		-> "4500000.ticsi2rx context 4":0 [ENABLED,IMMUTABLE]
    	pad6: Source
    		-> "4500000.ticsi2rx context 5":0 [ENABLED,IMMUTABLE]
    	pad7: Source
    		-> "4500000.ticsi2rx context 6":0 [ENABLED,IMMUTABLE]
    	pad8: Source
    		-> "4500000.ticsi2rx context 7":0 [ENABLED,IMMUTABLE]
    	pad9: Source
    		-> "4500000.ticsi2rx context 8":0 [ENABLED,IMMUTABLE]
    	pad10: Source
    		-> "4500000.ticsi2rx context 9":0 [ENABLED,IMMUTABLE]
    	pad11: Source
    		-> "4500000.ticsi2rx context 10":0 [ENABLED,IMMUTABLE]
    	pad12: Source
    		-> "4500000.ticsi2rx context 11":0 [ENABLED,IMMUTABLE]
    	pad13: Source
    		-> "4500000.ticsi2rx context 12":0 [ENABLED,IMMUTABLE]
    	pad14: Source
    		-> "4500000.ticsi2rx context 13":0 [ENABLED,IMMUTABLE]
    	pad15: Source
    		-> "4500000.ticsi2rx context 14":0 [ENABLED,IMMUTABLE]
    	pad16: Source
    		-> "4500000.ticsi2rx context 15":0 [ENABLED,IMMUTABLE]
    
    - entity 19: cdns_csi2rx.4504000.csi-bridge (5 pads, 2 links, 1 route)
                 type V4L2 subdev subtype Unknown flags 0
                 device node name /dev/v4l-subdev1
    	routes:
    		0/0 -> 1/0 [ACTIVE]
    	pad0: Sink
    		[stream:0 fmt:UYVY8_1X16/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range]
    		<- "samsung_s5k1h1sb 6-0010":0 [ENABLED,IMMUTABLE]
    	pad1: Source
    		[stream:0 fmt:UYVY8_1X16/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range]
    		-> "4500000.ticsi2rx":0 [ENABLED,IMMUTABLE]
    	pad2: Source
    	pad3: Source
    	pad4: Source
    
    - entity 25: samsung_s5k1h1sb 6-0010 (1 pad, 1 link, 0 route)
                 type V4L2 subdev subtype Sensor flags 0
                 device node name /dev/v4l-subdev2
    	pad0: Source
    		-> "cdns_csi2rx.4504000.csi-bridge":0 [ENABLED,IMMUTABLE]
    
    - entity 31: 4500000.ticsi2rx context 0 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video2
    	pad0: Sink
    		<- "4500000.ticsi2rx":1 [ENABLED,IMMUTABLE]
    
    - entity 37: 4500000.ticsi2rx context 1 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video3
    	pad0: Sink
    		<- "4500000.ticsi2rx":2 [ENABLED,IMMUTABLE]
    
    - entity 43: 4500000.ticsi2rx context 2 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video4
    	pad0: Sink
    		<- "4500000.ticsi2rx":3 [ENABLED,IMMUTABLE]
    
    - entity 49: 4500000.ticsi2rx context 3 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video5
    	pad0: Sink
    		<- "4500000.ticsi2rx":4 [ENABLED,IMMUTABLE]
    
    - entity 55: 4500000.ticsi2rx context 4 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video6
    	pad0: Sink
    		<- "4500000.ticsi2rx":5 [ENABLED,IMMUTABLE]
    
    - entity 61: 4500000.ticsi2rx context 5 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video7
    	pad0: Sink
    		<- "4500000.ticsi2rx":6 [ENABLED,IMMUTABLE]
    
    - entity 67: 4500000.ticsi2rx context 6 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video8
    	pad0: Sink
    		<- "4500000.ticsi2rx":7 [ENABLED,IMMUTABLE]
    
    - entity 73: 4500000.ticsi2rx context 7 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video9
    	pad0: Sink
    		<- "4500000.ticsi2rx":8 [ENABLED,IMMUTABLE]
    
    - entity 79: 4500000.ticsi2rx context 8 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video10
    	pad0: Sink
    		<- "4500000.ticsi2rx":9 [ENABLED,IMMUTABLE]
    
    - entity 85: 4500000.ticsi2rx context 9 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video11
    	pad0: Sink
    		<- "4500000.ticsi2rx":10 [ENABLED,IMMUTABLE]
    
    - entity 91: 4500000.ticsi2rx context 10 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video12
    	pad0: Sink
    		<- "4500000.ticsi2rx":11 [ENABLED,IMMUTABLE]
    
    - entity 97: 4500000.ticsi2rx context 11 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video13
    	pad0: Sink
    		<- "4500000.ticsi2rx":12 [ENABLED,IMMUTABLE]
    
    - entity 103: 4500000.ticsi2rx context 12 (1 pad, 1 link, 0 route)
                  type Node subtype V4L flags 0
                  device node name /dev/video14
    	pad0: Sink
    		<- "4500000.ticsi2rx":13 [ENABLED,IMMUTABLE]
    
    - entity 109: 4500000.ticsi2rx context 13 (1 pad, 1 link, 0 route)
                  type Node subtype V4L flags 0
                  device node name /dev/video15
    	pad0: Sink
    		<- "4500000.ticsi2rx":14 [ENABLED,IMMUTABLE]
    
    - entity 115: 4500000.ticsi2rx context 14 (1 pad, 1 link, 0 route)
                  type Node subtype V4L flags 0
                  device node name /dev/video16
    	pad0: Sink
    		<- "4500000.ticsi2rx":15 [ENABLED,IMMUTABLE]
    
    - entity 121: 4500000.ticsi2rx context 15 (1 pad, 1 link, 0 route)
                  type Node subtype V4L flags 0
                  device node name /dev/video17
    	pad0: Sink
    		<- "4500000.ticsi2rx":16 [ENABLED,IMMUTABLE]
    
    
    


    After setup_cameras.sh:

    root@tda4vm-sk:/opt/edgeai-gst-apps# ./setup_cameras.sh
    root@tda4vm-sk:/opt/edgeai-gst-apps/scripts# media-ctl -p
    Media controller API version 6.1.46
    
    Media device information
    ------------------------
    driver          j721e-csi2rx
    model           TI-CSI2RX
    serial          
    bus info        platform:4500000.ticsi2rx
    hw revision     0x1
    driver version  6.1.46
    
    Device topology
    - entity 1: 4500000.ticsi2rx (17 pads, 17 links, 1 route)
                type V4L2 subdev subtype Unknown flags 0
                device node name /dev/v4l-subdev0
    	routes:
    		0/0 -> 1/0 [ACTIVE]
    	pad0: Sink
    		[stream:0 fmt:UYVY8_1X16/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range]
    		<- "cdns_csi2rx.4504000.csi-bridge":1 [ENABLED,IMMUTABLE]
    	pad1: Source
    		[stream:0 fmt:UYVY8_1X16/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range]
    		-> "4500000.ticsi2rx context 0":0 [ENABLED,IMMUTABLE]
    	pad2: Source
    		-> "4500000.ticsi2rx context 1":0 [ENABLED,IMMUTABLE]
    	pad3: Source
    		-> "4500000.ticsi2rx context 2":0 [ENABLED,IMMUTABLE]
    	pad4: Source
    		-> "4500000.ticsi2rx context 3":0 [ENABLED,IMMUTABLE]
    	pad5: Source
    		-> "4500000.ticsi2rx context 4":0 [ENABLED,IMMUTABLE]
    	pad6: Source
    		-> "4500000.ticsi2rx context 5":0 [ENABLED,IMMUTABLE]
    	pad7: Source
    		-> "4500000.ticsi2rx context 6":0 [ENABLED,IMMUTABLE]
    	pad8: Source
    		-> "4500000.ticsi2rx context 7":0 [ENABLED,IMMUTABLE]
    	pad9: Source
    		-> "4500000.ticsi2rx context 8":0 [ENABLED,IMMUTABLE]
    	pad10: Source
    		-> "4500000.ticsi2rx context 9":0 [ENABLED,IMMUTABLE]
    	pad11: Source
    		-> "4500000.ticsi2rx context 10":0 [ENABLED,IMMUTABLE]
    	pad12: Source
    		-> "4500000.ticsi2rx context 11":0 [ENABLED,IMMUTABLE]
    	pad13: Source
    		-> "4500000.ticsi2rx context 12":0 [ENABLED,IMMUTABLE]
    	pad14: Source
    		-> "4500000.ticsi2rx context 13":0 [ENABLED,IMMUTABLE]
    	pad15: Source
    		-> "4500000.ticsi2rx context 14":0 [ENABLED,IMMUTABLE]
    	pad16: Source
    		-> "4500000.ticsi2rx context 15":0 [ENABLED,IMMUTABLE]
    
    - entity 19: cdns_csi2rx.4504000.csi-bridge (5 pads, 2 links, 1 route)
                 type V4L2 subdev subtype Unknown flags 0
                 device node name /dev/v4l-subdev1
    	routes:
    		0/0 -> 1/0 [ACTIVE]
    	pad0: Sink
    		[stream:0 fmt:UYVY8_1X16/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range]
    		<- "samsung_s5k1h1sb 6-0010":0 [ENABLED,IMMUTABLE]
    	pad1: Source
    		[stream:0 fmt:UYVY8_1X16/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range]
    		-> "4500000.ticsi2rx":0 [ENABLED,IMMUTABLE]
    	pad2: Source
    	pad3: Source
    	pad4: Source
    
    - entity 25: samsung_s5k1h1sb 6-0010 (1 pad, 1 link, 0 route)
                 type V4L2 subdev subtype Sensor flags 0
                 device node name /dev/v4l-subdev2
    	pad0: Source
    		-> "cdns_csi2rx.4504000.csi-bridge":0 [ENABLED,IMMUTABLE]
    
    - entity 31: 4500000.ticsi2rx context 0 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video2
    	pad0: Sink
    		<- "4500000.ticsi2rx":1 [ENABLED,IMMUTABLE]
    
    - entity 37: 4500000.ticsi2rx context 1 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video3
    	pad0: Sink
    		<- "4500000.ticsi2rx":2 [ENABLED,IMMUTABLE]
    
    - entity 43: 4500000.ticsi2rx context 2 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video4
    	pad0: Sink
    		<- "4500000.ticsi2rx":3 [ENABLED,IMMUTABLE]
    
    - entity 49: 4500000.ticsi2rx context 3 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video5
    	pad0: Sink
    		<- "4500000.ticsi2rx":4 [ENABLED,IMMUTABLE]
    
    - entity 55: 4500000.ticsi2rx context 4 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video6
    	pad0: Sink
    		<- "4500000.ticsi2rx":5 [ENABLED,IMMUTABLE]
    
    - entity 61: 4500000.ticsi2rx context 5 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video7
    	pad0: Sink
    		<- "4500000.ticsi2rx":6 [ENABLED,IMMUTABLE]
    
    - entity 67: 4500000.ticsi2rx context 6 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video8
    	pad0: Sink
    		<- "4500000.ticsi2rx":7 [ENABLED,IMMUTABLE]
    
    - entity 73: 4500000.ticsi2rx context 7 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video9
    	pad0: Sink
    		<- "4500000.ticsi2rx":8 [ENABLED,IMMUTABLE]
    
    - entity 79: 4500000.ticsi2rx context 8 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video10
    	pad0: Sink
    		<- "4500000.ticsi2rx":9 [ENABLED,IMMUTABLE]
    
    - entity 85: 4500000.ticsi2rx context 9 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video11
    	pad0: Sink
    		<- "4500000.ticsi2rx":10 [ENABLED,IMMUTABLE]
    
    - entity 91: 4500000.ticsi2rx context 10 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video12
    	pad0: Sink
    		<- "4500000.ticsi2rx":11 [ENABLED,IMMUTABLE]
    
    - entity 97: 4500000.ticsi2rx context 11 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video13
    	pad0: Sink
    		<- "4500000.ticsi2rx":12 [ENABLED,IMMUTABLE]
    
    - entity 103: 4500000.ticsi2rx context 12 (1 pad, 1 link, 0 route)
                  type Node subtype V4L flags 0
                  device node name /dev/video14
    	pad0: Sink
    		<- "4500000.ticsi2rx":13 [ENABLED,IMMUTABLE]
    
    - entity 109: 4500000.ticsi2rx context 13 (1 pad, 1 link, 0 route)
                  type Node subtype V4L flags 0
                  device node name /dev/video15
    	pad0: Sink
    		<- "4500000.ticsi2rx":14 [ENABLED,IMMUTABLE]
    
    - entity 115: 4500000.ticsi2rx context 14 (1 pad, 1 link, 0 route)
                  type Node subtype V4L flags 0
                  device node name /dev/video16
    	pad0: Sink
    		<- "4500000.ticsi2rx":15 [ENABLED,IMMUTABLE]
    
    - entity 121: 4500000.ticsi2rx context 15 (1 pad, 1 link, 0 route)
                  type Node subtype V4L flags 0
                  device node name /dev/video17
    	pad0: Sink
    		<- "4500000.ticsi2rx":16 [ENABLED,IMMUTABLE]



    It didn't change anything probably, because my camera is not have its own function there.

    But when I execute the following commands, I can see it sets correct format and resolution for my camera:

    root@tda4vm-sk:/opt/edgeai-gst-apps/scripts# media-ctl -d /dev/media0 --set-v4l2 '"cdns_csi2rx.4504000.csi-bridge":0 [fmt:SRGGB12_1X12/3840x2160]' \
    > media-ctl -d /dev/media0 --links '"cdns_csi2rx.4504000.csi-bridge":1 -> "4500000.ticsi2rx":0[1]'
    media-ctl -p
    Media controller API version 6.1.46
    
    Media device information
    ------------------------
    driver          j721e-csi2rx
    model           TI-CSI2RX
    serial          
    bus info        platform:4500000.ticsi2rx
    hw revision     0x1
    driver version  6.1.46
    
    Device topology
    - entity 1: 4500000.ticsi2rx (17 pads, 17 links, 1 route)
                type V4L2 subdev subtype Unknown flags 0
                device node name /dev/v4l-subdev0
    	routes:
    		0/0 -> 1/0 [ACTIVE]
    	pad0: Sink
    		[stream:0 fmt:UYVY8_1X16/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range]
    		<- "cdns_csi2rx.4504000.csi-bridge":1 [ENABLED,IMMUTABLE]
    	pad1: Source
    		[stream:0 fmt:UYVY8_1X16/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range]
    		-> "4500000.ticsi2rx context 0":0 [ENABLED,IMMUTABLE]
    	pad2: Source
    		-> "4500000.ticsi2rx context 1":0 [ENABLED,IMMUTABLE]
    	pad3: Source
    		-> "4500000.ticsi2rx context 2":0 [ENABLED,IMMUTABLE]
    	pad4: Source
    		-> "4500000.ticsi2rx context 3":0 [ENABLED,IMMUTABLE]
    	pad5: Source
    		-> "4500000.ticsi2rx context 4":0 [ENABLED,IMMUTABLE]
    	pad6: Source
    		-> "4500000.ticsi2rx context 5":0 [ENABLED,IMMUTABLE]
    	pad7: Source
    		-> "4500000.ticsi2rx context 6":0 [ENABLED,IMMUTABLE]
    	pad8: Source
    		-> "4500000.ticsi2rx context 7":0 [ENABLED,IMMUTABLE]
    	pad9: Source
    		-> "4500000.ticsi2rx context 8":0 [ENABLED,IMMUTABLE]
    	pad10: Source
    		-> "4500000.ticsi2rx context 9":0 [ENABLED,IMMUTABLE]
    	pad11: Source
    		-> "4500000.ticsi2rx context 10":0 [ENABLED,IMMUTABLE]
    	pad12: Source
    		-> "4500000.ticsi2rx context 11":0 [ENABLED,IMMUTABLE]
    	pad13: Source
    		-> "4500000.ticsi2rx context 12":0 [ENABLED,IMMUTABLE]
    	pad14: Source
    		-> "4500000.ticsi2rx context 13":0 [ENABLED,IMMUTABLE]
    	pad15: Source
    		-> "4500000.ticsi2rx context 14":0 [ENABLED,IMMUTABLE]
    	pad16: Source
    		-> "4500000.ticsi2rx context 15":0 [ENABLED,IMMUTABLE]
    
    - entity 19: cdns_csi2rx.4504000.csi-bridge (5 pads, 2 links, 1 route)
                 type V4L2 subdev subtype Unknown flags 0
                 device node name /dev/v4l-subdev1
    	routes:
    		0/0 -> 1/0 [ACTIVE]
    	pad0: Sink
    		[stream:0 fmt:SRGGB12_1X12/3840x2160]
    		<- "samsung_s5k1h1sb 6-0010":0 [ENABLED,IMMUTABLE]
    	pad1: Source
    		[stream:0 fmt:SRGGB12_1X12/3840x2160]
    		-> "4500000.ticsi2rx":0 [ENABLED,IMMUTABLE]
    	pad2: Source
    	pad3: Source
    	pad4: Source
    
    - entity 25: samsung_s5k1h1sb 6-0010 (1 pad, 1 link, 0 route)
                 type V4L2 subdev subtype Sensor flags 0
                 device node name /dev/v4l-subdev2
    	pad0: Source
    		-> "cdns_csi2rx.4504000.csi-bridge":0 [ENABLED,IMMUTABLE]
    
    - entity 31: 4500000.ticsi2rx context 0 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video2
    	pad0: Sink
    		<- "4500000.ticsi2rx":1 [ENABLED,IMMUTABLE]
    
    - entity 37: 4500000.ticsi2rx context 1 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video3
    	pad0: Sink
    		<- "4500000.ticsi2rx":2 [ENABLED,IMMUTABLE]
    
    - entity 43: 4500000.ticsi2rx context 2 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video4
    	pad0: Sink
    		<- "4500000.ticsi2rx":3 [ENABLED,IMMUTABLE]
    
    - entity 49: 4500000.ticsi2rx context 3 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video5
    	pad0: Sink
    		<- "4500000.ticsi2rx":4 [ENABLED,IMMUTABLE]
    
    - entity 55: 4500000.ticsi2rx context 4 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video6
    	pad0: Sink
    		<- "4500000.ticsi2rx":5 [ENABLED,IMMUTABLE]
    
    - entity 61: 4500000.ticsi2rx context 5 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video7
    	pad0: Sink
    		<- "4500000.ticsi2rx":6 [ENABLED,IMMUTABLE]
    
    - entity 67: 4500000.ticsi2rx context 6 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video8
    	pad0: Sink
    		<- "4500000.ticsi2rx":7 [ENABLED,IMMUTABLE]
    
    - entity 73: 4500000.ticsi2rx context 7 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video9
    	pad0: Sink
    		<- "4500000.ticsi2rx":8 [ENABLED,IMMUTABLE]
    
    - entity 79: 4500000.ticsi2rx context 8 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video10
    	pad0: Sink
    		<- "4500000.ticsi2rx":9 [ENABLED,IMMUTABLE]
    
    - entity 85: 4500000.ticsi2rx context 9 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video11
    	pad0: Sink
    		<- "4500000.ticsi2rx":10 [ENABLED,IMMUTABLE]
    
    - entity 91: 4500000.ticsi2rx context 10 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video12
    	pad0: Sink
    		<- "4500000.ticsi2rx":11 [ENABLED,IMMUTABLE]
    
    - entity 97: 4500000.ticsi2rx context 11 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video13
    	pad0: Sink
    		<- "4500000.ticsi2rx":12 [ENABLED,IMMUTABLE]
    
    - entity 103: 4500000.ticsi2rx context 12 (1 pad, 1 link, 0 route)
                  type Node subtype V4L flags 0
                  device node name /dev/video14
    	pad0: Sink
    		<- "4500000.ticsi2rx":13 [ENABLED,IMMUTABLE]
    
    - entity 109: 4500000.ticsi2rx context 13 (1 pad, 1 link, 0 route)
                  type Node subtype V4L flags 0
                  device node name /dev/video15
    	pad0: Sink
    		<- "4500000.ticsi2rx":14 [ENABLED,IMMUTABLE]
    
    - entity 115: 4500000.ticsi2rx context 14 (1 pad, 1 link, 0 route)
                  type Node subtype V4L flags 0
                  device node name /dev/video16
    	pad0: Sink
    		<- "4500000.ticsi2rx":15 [ENABLED,IMMUTABLE]
    
    - entity 121: 4500000.ticsi2rx context 15 (1 pad, 1 link, 0 route)
                  type Node subtype V4L flags 0
                  device node name /dev/video17
    	pad0: Sink
    		<- "4500000.ticsi2rx":16 [ENABLED,IMMUTABLE]
    


    EDIT:
    I modify the setup_cameras.sh and added the following function:

    setup_s5k1h1sb(){
        S5K1H1SB_CAM_FMT='[fmt:SRGGB12_1X12/3840x2160]'
        count=0
        for media_id in {0..1}; do
        for name in `media-ctl -d $media_id -p | grep entity | grep s5k1h1sb | cut -d ' ' -f 5`; do
            CAM_SUBDEV=`media-ctl -d $media_id -p -e "samsung_s5k1h1sb $name" | grep v4l-subdev | awk '{print $4}'`
            media-ctl -d $media_id --set-v4l2 ''"\"s5k1h1sb $name\""':0 '$S5K1H1SB_CAM_FMT''
    
            CSI_BRIDGE_NAME=`media-ctl -d $media_id -p -e "s5k1h1sb $name" | grep csi-bridge | cut -d "\"" -f 2`
            CSI2RX_NAME=`media-ctl -d $media_id -p -e "$CSI_BRIDGE_NAME" | grep "ticsi2rx\"" | cut -d "\"" -f 2`
            CSI2RX_CONTEXT_NAME="$CSI2RX_NAME context 0"
    
            CAM_DEV=`media-ctl -d $media_id -p -e "$CSI2RX_CONTEXT_NAME" | grep video | awk '{print $4}'`
            CAM_DEV_NAME=/dev/video-rpi-cam$count
    
            CAM_SUBDEV_NAME=/dev/v4l-rpi-subdev$count
    
            ln -snf $CAM_DEV $CAM_DEV_NAME
            ln -snf $CAM_SUBDEV $CAM_SUBDEV_NAME
    
            echo -e "${GREEN}CSI Camera $media_id detected${NOCOLOR}"
            echo "    device = $CAM_DEV_NAME"
            echo "    name = s5k1h1sb"
            echo "    format = $S5K1H1SB_CAM_FMT"
            echo "    subdev_id = $CAM_SUBDEV_NAME"
            echo "    isp_required = yes"
            count=$(($count + 1))
        done
        done
    }


    Now when I run the ./setup_cameras.sh it gives me the following log:

    root@tda4vm-sk:/opt/edgeai-gst-apps/scripts# ./setup_cameras.sh 
    Unable to setup formats: Inappropriate ioctl for device (25)
    CSI Camera 0 detected
        device = /dev/video-rpi-cam0
        name = s5k1h1sb
        format = [fmt:SRGGB12_1X12/3840x2160]
        subdev_id = /dev/v4l-rpi-subdev0
        isp_required = yes


    Thanks.

  • Hi,

    Is your sensor streaming SRGGB12_1X12 output? I see yuv422 mentioned in the device tree 

    gmsl-link {
    src-csi-port = "b";
    dst-csi-port = "a";
    serdes-csi-link = "a";
    csi-mode = "1x4";
    st-vc = <0>;
    vc-id = <0>;
    num-lanes = <2>;
    streams = "yuv422";

    :

    Fullscreen
    1
    yavta /dev/video2 -c8 -f SRGGB12 -F5.raw -s 3840x2160
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Could you share me the logs after executing the above command?

    Could you please check if /dev/video-rpi-cam0 is linked to /dev/video2?

    Regards,

    Nikhil

  • Hi Nikhil,

    Is your sensor streaming SRGGB12_1X12 output? I see yuv422 mentioned in the device tree 

    Yes it is SRGGB12_1X12. In gmsl-link node, I leave the streams variable yuv422 since it has no effect for my serializer. It just dummy for now I will adjust it later once I know the camera is working fine.

    - Could you share me the logs after executing the above command?

    Sure here is your logs:

    root@tda4vm-sk:~/yavta_capture# yavta /dev/video2 -c8 -f SRGGB12 -F5.raw -s 3840x2160
    Device /dev/video2 opened.
    Device `j721e-csi2rx' on `platform:4500000.ticsi2rx' (driver 'j721e-csi2rx') supports video, capture, without mplanes.
    Video format set: SRGGB12 (32314752) 3840x2160 (stride 7680) field none buffer size 16588800
    Video format: SRGGB12 (32314752) 3840x2160 (stride 7680) field none buffer size 16588800
    8 buffers requested.
    length: 16588800 offset: 0 timestamp type/source: mono/EoF
    Buffer 0/0 mapped at address 0xffffab20e000.
    length: 16588800 offset: 16588800 timestamp type/source: mono/EoF
    Buffer 1/0 mapped at address 0xffffaa23c000.
    length: 16588800 offset: 33177600 timestamp type/source: mono/EoF
    Buffer 2/0 mapped at address 0xffffa926a000.
    length: 16588800 offset: 49766400 timestamp type/source: mono/EoF
    Buffer 3/0 mapped at address 0xffffa8298000.
    length: 16588800 offset: 66355200 timestamp type/source: mono/EoF
    Buffer 4/0 mapped at address 0xffffa72c6000.
    length: 16588800 offset: 82944000 timestamp type/source: mono/EoF
    Buffer 5/0 mapped at address 0xffffa62f4000.
    length: 16588800 offset: 99532800 timestamp type/source: mono/EoF
    Buffer 6/0 mapped at address 0xffffa5322000.
    length: 16588800 offset: 116121600 timestamp type/source: mono/EoF
    Buffer 7/0 mapped at address 0xffffa4350000.
    

    And here is the dmesg log:

    [  234.465458] vb2_ioctl_reqbufs
    [  234.483916] vb2_ioctl_streamon
    [  234.515529] j721e-csi2rx 4500000.ticsi2rx: Enabling all streams (1) on sink.
    [  234.526309] Inside s5k1h1sb_start_streaming
    [  234.530494] max9296_gmsl2 6-0028: buyutech_max9296_start_streaming func start.
    [  235.562930] samsung_s5k1h1sb 6-0010: s5k1h1sb_set_ctrl, func begin
    [  235.569108] samsung_s5k1h1sb 6-0010: s5k1h1sb_set_ctrl, func begin
    [  235.575277] samsung_s5k1h1sb 6-0010: s5k1h1sb_set_ctrl, func begin
    [  235.581447] samsung_s5k1h1sb 6-0010: s5k1h1sb_set_ctrl, func begin
    [  235.587885] samsung_s5k1h1sb 6-0010: DEBUG...
    [  281.801204] j721e-csi2rx 4500000.ticsi2rx: Disabling all streams (1) on sink.
    [  281.808363] samsung_s5k1h1sb 6-0010: Inside function s5k1h1sb_stop_streaming
    [  281.869894] j721e-csi2rx 4500000.ticsi2rx: DMA transfer timed out for drain buffer
    [  281.877459] j721e-csi2rx 4500000.ticsi2rx: Failed to drain DMA. Next frame might be bogus

    Note: I hit ctrl+c at time [281.801204].

    - Could you please check if /dev/video-rpi-cam0 is linked to /dev/video2?

    By the looks of media-ctl -p , it is indeed linked, as you can see on pad1: Source:

    - entity 19: cdns_csi2rx.4504000.csi-bridge (5 pads, 2 links, 1 route)
                 type V4L2 subdev subtype Unknown flags 0
                 device node name /dev/v4l-subdev1
    	routes:
    		0/0 -> 1/0 [ACTIVE]
    	pad0: Sink
    		[stream:0 fmt:SRGGB12_1X12/3840x2160]
    		<- "samsung_s5k1h1sb 6-0010":0 [ENABLED,IMMUTABLE]
    	pad1: Source
    		[stream:0 fmt:SRGGB12_1X12/3840x2160]
    		-> "4500000.ticsi2rx":0 [ENABLED,IMMUTABLE]
    	pad2: Source
    	pad3: Source
    	pad4: Source
    
    - entity 25: samsung_s5k1h1sb 6-0010 (1 pad, 1 link, 0 route)
                 type V4L2 subdev subtype Sensor flags 0
                 device node name /dev/v4l-subdev2
    	pad0: Source
    		-> "cdns_csi2rx.4504000.csi-bridge":0 [ENABLED,IMMUTABLE]
    
    - entity 31: 4500000.ticsi2rx context 0 (1 pad, 1 link, 0 route)
                 type Node subtype V4L flags 0
                 device node name /dev/video2
    	pad0: Sink
    		<- "4500000.ticsi2rx":1 [ENABLED,IMMUTABLE]
    

    Thanks

    [  234.465458] vb2_ioctl_reqbufs
    [  234.483916] vb2_ioctl_streamon
    [  234.515529] j721e-csi2rx 4500000.ticsi2rx: Enabling all streams (1) on sink.
    [  234.526309] Inside s5k1h1sb_start_streaming
    [  234.530494] max9296_gmsl2 6-0028: max9296_start_streaming func start.
    [  235.562930] samsung_s5k1h1sb 6-0010: s5k1h1sb_set_ctrl, func begin
    [  235.569108] samsung_s5k1h1sb 6-0010: s5k1h1sb_set_ctrl, func begin
    [  235.575277] samsung_s5k1h1sb 6-0010: s5k1h1sb_set_ctrl, func begin
    [  235.581447] samsung_s5k1h1sb 6-0010: s5k1h1sb_set_ctrl, func begin
    [  235.587885] samsung_s5k1h1sb 6-0010: DEBUG...
    [  281.801204] j721e-csi2rx 4500000.ticsi2rx: Disabling all streams (1) on sink.
    [  281.808363] samsung_s5k1h1sb 6-0010: Inside function s5k1h1sb_stop_streaming
    [  281.869894] j721e-csi2rx 4500000.ticsi2rx: DMA transfer timed out for drain buffer
    [  281.877459] j721e-csi2rx 4500000.ticsi2rx: Failed to drain DMA. Next frame might be bogus

  • Hi,

    Do you see the below error in your linux boot logs from csi-rx?

    cdns-csi2rx 4514000.csi-bridge: Failed to configure external DPHY: -2 

    Also, your current flow is samsung_s5k1h1sb to the csi directly. Hence I would also suggest to compare the enable_stream on the driver with the UB960 deserializer driver (which is tested from TI).

    Regards,

    Nikhil

  • Hi Nikhil,

    Do you see the below error in your linux boot logs from csi-rx?

    It says both of them probed.

    [ 7.934875] cdns-csi2rx 4504000.csi-bridge: Probed CSI2RX with 2/4 lanes, 4 streams, external D-PHY
    [ 8.082148] cdns-csi2rx 4514000.csi-bridge: Probed CSI2RX with 2/4 lanes, 4 streams, external D-PHY

    Also, your current flow is samsung_s5k1h1sb to the csi directly. Hence I would also suggest to compare the enable_stream on the driver with the UB960 deserializer driver (which is tested from TI).

    I'll check this and comeback to you.

    Thanks.

  • Hi Nikhil,

    So I check the UB960 deserializer driver, and as far as I understand this is the important bit I suppose:

    	/* Collect sink streams per pad which we need to enable */
    	for_each_active_route(&state->routing, route) {
    		if (route->source_pad != source_pad)
    			continue;
    
    		if (!(source_streams_mask & BIT_ULL(route->source_stream)))
    			continue;
    
    		nport = ub960_pad_to_port(priv, route->sink_pad);
    
    		sink_streams[nport] |= BIT_ULL(route->sink_stream);
    	}
    
    	for (nport = 0; nport < priv->hw_data->num_rxports; nport++) {
    		if (!sink_streams[nport])
    			continue;
    
    		/* Enable the RX port if not yet enabled */
    		if (!priv->stream_enable_mask[nport]) {
    			ret = ub960_enable_rx_port(priv, nport);
    			if (ret) {
    				failed_port = nport;
    				goto err;
    			}
    		}
    
    		priv->stream_enable_mask[nport] |= sink_streams[nport];
    
    		dev_dbg(dev, "enable RX port %u streams %#llx\n", nport,
    			sink_streams[nport]);
    
    		ret = v4l2_subdev_enable_streams(
    			priv->rxports[nport]->source.sd,
    			priv->rxports[nport]->source.pad,
    			sink_streams[nport]);
    		if (ret) {
    			priv->stream_enable_mask[nport] &= ~sink_streams[nport];
    
    			if (!priv->stream_enable_mask[nport])
    				ub960_disable_rx_port(priv, nport);
    
    			failed_port = nport;
    			goto err;
    		}
    	}
    
    	priv->streaming = true;
    
    	return 0;

    However, I think j721e-csi2rx.c library does this operation automatically on ``ti_csi2rx_sd_enable_streams`` function, which I know it is entering into.

    Can you confirm this ? Or I'm mistaken something perhaps ? Please do correct me if my hypothesis is wrong.

    Thanks 

  • Little update, I manage to get frames now by changing the "DESKEW_INIT" registers on my deserializer to "Auto initial deskew on".

    However the frame I get is corrupted:



    I believe some clock settings or similar is wrongly configured. But what are your suggestions ?

    And by the way it is actually good that frame is orange like the above since the picture I get on nano is something similar.

    Thanks

  • Hello Nikhil,

    Daniel Waleniak here, FAE for this customer.
    I was hoping that you could find some time to analyze the most recent feedback and offer guidance on the next suggested steps?

    Thank you for your support!

    Daniel

  • Hi,

    Little update, I manage to get frames now by changing the "DESKEW_INIT" registers on my deserializer to "Auto initial deskew on".

    However the frame I get is corrupted:

    If the lanebandspeed on the csi-rx is more than 1.5Gbps, then you would have to enable deskew on the source so that the source sends the correct deskew sequence. In this case, is serdes involved in your path? I thought it was just "samsung_s5k1h1sb to the csi directly" 

    Are you sending frames at a lane speed more that 1.5Gbps?

    Regards,

    Nikhil

  • Hi Nikhil,

    - In this case, is serdes involved in your path? I thought it was just "samsung_s5k1h1sb to the csi directly" 

    Serdes involved in our path also can be seen on .dtso snipet I send at the beginning.


    - Are you sending frames at a lane speed more that 1.5Gbps?

    I2C 03232F //1.5Gbps MIPI Data

    as you can see from the above configuration, I give exactly 1.5Gbps not any higher, but it's weird that I can get frames that way.

    Should I change my device tree file for serdes ? Can you check it ?

    Thanks

  • Hi Nikhil,

    I solve the problem. The problematic line was the following:

    ```
    link-frequencies = /bits/ 64 <833333333>;
    ```

    It was <215000000>; before and I tempted to change this cause I thought it was for my camera link frequency. The value i need to give, was obviously serdes link frequency, which is 833333333.

    Also for the future, don't forget to give link frequencies to v4l2.

    static const s64 s5k1h1sb_link_freq_menu[] = 
    {
    	SENSOR_SERDES_LINK_FREQ 
    };
    
    /*************************/
    	sensor->link_freq =
    		v4l2_ctrl_new_int_menu(ctrl_hdlr, &sensor_ctrl_ops,
    				       V4L2_CID_LINK_FREQ,
    				       ARRAY_SIZE(sensor_link_freq_menu) - 1, 0,
    				       sensor_link_freq_menu);
    				    
    				    
    	

    Thank you Nikhil for your attention, we may close this topic now.