This is a cache of https://discuss.96boards.org/t/tb-96aiot-camera-get-it-working/10302. It is a snapshot of the page at 2020-08-10T00:01:14.637+0000.
TB-96AIoT camera get it working - TB-96AIoT - 96Boards Forum

TB-96AIoT camera get it working

Has anybody got the camera to work ? How did you do it?

I’m trying to run the “gstvideotest.sh” and get the exact same error as @evant got on an earlier post.

The “media-ctl -p” output is the same as @evant reported:

/ # media-ctl -p
Media controller API version 0.1.0

Media device information
------------------------
driver          rkisp1
model           rkisp1
serial
bus info
hw revision     0x0
driver version  0.0.0

Device topology
- entity 1: rkisp1-isp-subdev (4 pads, 7 links)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev0
        pad0: Sink
                [fmt:SBGGR10_1X10/800x600 field:none
                 crop.bounds:(0,0)/800x600
                 crop:(0,0)/800x600]
                <- "rkisp1_dmapath":0 []
                <- "rockchip-mipi-dphy-rx":1 [ENABLED]
        pad1: Sink
                <- "rkisp1-input-params":0 [ENABLED]
        pad2: Source
                [fmt:YUYV8_2X8/800x600 field:none
                 crop.bounds:(0,0)/800x600
                 crop:(0,0)/800x600]
                -> "rkisp1_selfpath":0 [ENABLED]
                -> "rkisp1_mainpath":0 [ENABLED]
                -> "rkisp1_rawpath":0 [ENABLED]
        pad3: Source
                -> "rkisp1-statistics":0 [ENABLED]

- entity 2: rkisp1_mainpath (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video0
        pad0: Sink
                <- "rkisp1-isp-subdev":2 [ENABLED]

- entity 3: rkisp1_selfpath (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video1
        pad0: Sink
                <- "rkisp1-isp-subdev":2 [ENABLED]

- entity 4: rkisp1_rawpath (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video2
        pad0: Sink
                <- "rkisp1-isp-subdev":2 [ENABLED]

- entity 5: rkisp1_dmapath (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video3
        pad0: Source
                -> "rkisp1-isp-subdev":0 []

- entity 6: rkisp1-statistics (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video4
        pad0: Sink
                <- "rkisp1-isp-subdev":3 [ENABLED]

- entity 7: rkisp1-input-params (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video5
        pad0: Source
                -> "rkisp1-isp-subdev":1 [ENABLED]

- entity 8: rockchip-mipi-dphy-rx (2 pads, 1 link)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev1
        pad0: Sink
        pad1: Source
                -> "rkisp1-isp-subdev":0 [ENABLED]

Then I followed what suggested by @Loic to look at the rockchip wiki for camera driver, many commands are failing. After fixing a few typos, the first few commands are working ok now:

media-ctl -l '"rockchip-mipi-dphy-rx":1->"rkisp1-isp-subdev":0[1]'
media-ctl -l '"rkisp1-input-params":0->"rkisp1-isp-subdev":1[1]'
media-ctl -l '"rkisp1-isp-subdev":2->"rkisp1_selfpath":0[1]'
media-ctl -l '"rkisp1-isp-subdev":2->"rkisp1_mainpath":0[1]'
media-ctl -l '"rkisp1-isp-subdev":3->"rkisp1-statistics":0[1]'

## rkisp1 source pad : format\selection
media-ctl --set-v4l2 '"rkisp1-isp-subdev":2[fmt:YUYV2X8/800x600]'
media-ctl --set-v4l2 '"rkisp1-isp-subdev":2[fmt:YUYV2X8/800x600]' --set-v4l2 '"rkisp1-isp-subdev":0[crop:(0,0)/800x600]'

## rkisp1 sink pad : format\selection
media-ctl --set-v4l2 '"rkisp1-isp-subdev":0[fmt:SRGGB10/800x600]'
media-ctl --set-v4l2 '"rkisp1-isp-subdev":0[fmt:SBGGR10/800x600]' --set-v4l2 '"rkisp1-isp-subdev":0[crop:(0,0)/800x600]'

I can’t find a sensor node to continue with the other commands.

When running a command to capture:

gst-launch-1.0 v4l2src device=/dev/video1 ! fakesink

The error on UART console still prints:

[ 2145.239470] rkisp1: rkisp_enum_frameintervals Not active sensor
[ 2145.239521] rkisp1: rkisp_enum_frameintervals Not active sensor
[ 2145.239552] rkisp1: rkisp_enum_frameintervals Not active sensor
[ 2145.239579] rkisp1: rkisp_enum_frameintervals Not active sensor
[ 2145.239607] rkisp1: rkisp_enum_frameintervals Not active sensor
[ 2145.239635] rkisp1: rkisp_enum_frameintervals Not active sensor
[ 2145.239671] rkisp1: rkisp_enum_frameintervals Not active sensor
[ 2145.239699] rkisp1: rkisp_enum_frameintervals Not active sensor
[ 2145.239728] rkisp1: rkisp_enum_frameintervals Not active sensor
[ 2145.239756] rkisp1: rkisp_enum_frameintervals Not active sensor
[ 2145.239784] rkisp1: rkisp_enum_frameintervals Not active sensor
[ 2145.244314] rockchip-mipi-dphy-rx: No link between dphy and sensor
[ 2145.244348] rockchip-mipi-dphy-rx: No link between dphy and sensor
[ 2145.244356] rkisp1: update sensor info failed -19

If someone can share the detailed steps to get it working, it will be great!

I believe the sensor is not properly detected or driver not loaded. Look at the other thread, it is getting a subtype “Sensor” that is missing from the output of “media-ctl -p”:

- entity 7: ar0330_2 1-003c (1 pad, 1 link)
            type V4L2 subdev subtype Sensor flags 0
            device node name /dev/v4l-subdev2
        pad0: Source
                [fmt:UYVY2X8/1920x1080 field:none]
                -> "rockchip-sy-mipi-dphy":0 [ENABLED]

It turns out to be bad connection on connectors probably. After switched the camera between two boards a few times, the sensor entity is showing up:

/ # media-ctl -p
Media controller API version 0.1.0

Media device information
------------------------
driver          rkisp1
model           rkisp1
serial          
bus info        
hw revision     0x0
driver version  0.0.0

Device topology
- entity 1: rkisp1-isp-subdev (4 pads, 7 links)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev0
	pad0: Sink
		[fmt:SRGGB12_1X12/1920x1080 field:none
		 crop.bounds:(0,0)/1920x1080
		 crop:(0,0)/1920x1080]
		<- "rkisp1_dmapath":0 []
		<- "rockchip-mipi-dphy-rx":1 [ENABLED]
	pad1: Sink
		<- "rkisp1-input-params":0 [ENABLED]
	pad2: Source
		[fmt:YUYV8_2X8/1920x1080 field:none
		 crop.bounds:(0,0)/1920x1080
		 crop:(0,0)/1920x1080]
		-> "rkisp1_selfpath":0 [ENABLED]
		-> "rkisp1_mainpath":0 [ENABLED]
		-> "rkisp1_rawpath":0 [ENABLED]
	pad3: Source
		-> "rkisp1-statistics":0 [ENABLED]

- entity 2: rkisp1_mainpath (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video0
	pad0: Sink
		<- "rkisp1-isp-subdev":2 [ENABLED]

- entity 3: rkisp1_selfpath (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video1
	pad0: Sink
		<- "rkisp1-isp-subdev":2 [ENABLED]

- entity 4: rkisp1_rawpath (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video2
	pad0: Sink
		<- "rkisp1-isp-subdev":2 [ENABLED]

- entity 5: rkisp1_dmapath (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video3
	pad0: Source
		-> "rkisp1-isp-subdev":0 []

- entity 6: rkisp1-statistics (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video4
	pad0: Sink
		<- "rkisp1-isp-subdev":3 [ENABLED]

- entity 7: rkisp1-input-params (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video5
	pad0: Source
		-> "rkisp1-isp-subdev":1 [ENABLED]

- entity 8: rockchip-mipi-dphy-rx (2 pads, 2 links)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev1
	pad0: Sink
		[fmt:SRGGB12_1X12/1920x1080@10000/300000 field:none]
		<- "m00_b_imx327 2-001a":0 [ENABLED]
	pad1: Source
		[fmt:SRGGB12_1X12/1920x1080@10000/300000 field:none]
		-> "rkisp1-isp-subdev":0 [ENABLED]

- entity 9: m00_b_imx327 2-001a (1 pad, 1 link)
            type V4L2 subdev subtype Sensor flags 0
            device node name /dev/v4l-subdev2
	pad0: Source
		[fmt:SRGGB12_1X12/1920x1080@10000/300000 field:none]
		-> "rockchip-mipi-dphy-rx":0 [ENABLED]
1 Like

The camera stopped working again. An inspection showed the flat cable is not a good fit at the sensor end. Disconnect and carefully touch it up solved the problem.

By the way, a document linked by one of other threads is very useful. The command below will capture 150 video frames into a file:

v4l2-ctl -d /dev/video1 \
    -vwidth=720,height=480,pixelformat=NV21 \
    --stream-mmap=3 --stream-skip=3 --stream-to=stream-capture.nv21 \
    --stream-count=150 --stream-poll

The board can’t keep up with 30-fps 1920x1080 speed.

Before issuing the capturing command, kill the rknn-server first:

killall start_rknn.sh
sleep 1
killall rknn_server
sleep 1