Camera Module

Neardi supports the following cameras:

  • [ov13855]

  • [os04a10]

ov13855 Practice

Firmware can be obtained by compiling the SDK, or it can be downloaded from the network disk download location. Ensure that the downloaded firmware includes the ov13855 feature.

SDK Compilation

Select Configuration

./build.sh lunch BoardConfig-rk3588-neardi-linux-lkd3588-f0.mk

BoardConfig-rk3588-neardi-linux-lkd3588-f0.mk corresponds to kernel/arch/arm64/boot/dts/rockchip/rk3588-neardi-linux-lkd3588-f0.dts

Ensure the ov13855 driver is opened in rk3588-neardi-linux-lkd3588-f0.dts, as follows:

#include "rk3588-neardi-linux-ld160-x0.dtsi"
#include "rk3588-linux.dtsi"
...
#include "rk3588-neardi-linux-ld160-ov13855-os04a10-dphy0.dtsi"  //dphy0
#include "rk3588-neardi-linux-ld160-ov13855-os04a10-dphy1.dtsi"  //dphy1
...
};

Compile Kernel

./build.sh kernel

For specific compilation details, see the Ubuntu System Compilation chapter.

Hardware Connection

LPC3588 connection to ov13855

Open Camera with Gstreamer

Check Camera Nodes

neardi@LPA3588:~$ v4l2-ctl --list-devices

rkisp_mainpath (platform:rkisp0-vir0):
	/dev/video22
	/dev/video23
	/dev/video24
	/dev/video25
	/dev/video26
	/dev/video27
	/dev/video28
	/dev/media2

rkisp_mainpath (platform:rkisp1-vir1):
	/dev/video31
	/dev/video32
	/dev/video33
	/dev/video34
	/dev/video35
	/dev/video36
	/dev/video37
	/dev/media3

Find mainpath,the nodes are /dev/video22 and /dev/video31

../../_images/camera-ov13855-dev-video.png

Open video22 with GStreamer

gst-launch-1.0 v4l2src device=/dev/video22 ! \
	video/x-raw,format=NV12,width=800,height=600, framerate=30/1 ! \
	fpsdisplaysink

Open video31 with GStreamer

gst-launch-1.0 v4l2src device=/dev/video31 ! \
	video/x-raw,format=NV12,width=800,height=600, framerate=30/1 ! \
	fpsdisplaysink

Successful execution:

../../_images/camera-ov13855.png

FAQ

Camera Shows Blank Screen

No image returned

neardi@LPA3588:~$ gst-launch-1.0 v4l2src device=/dev/video22 ! \
> video/x-raw,format=NV12,width=800,height=600, framerate=30/1 ! \
> fpsdisplaysink
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
  • Check if the camera is properly connected.

  • Replace the FPC cable or camera.

Camera Opening Failed

neardi@LPA3588:~$ gst-launch-1.0 v4l2src device=/dev/video22 ! \
> video/x-raw,format=NV12,width=800,height=600, framerate=30/1 ! \
> fpsdisplaysink
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Failed to allocate required memory.
Additional debug info:
../sys/v4l2/gstv4l2src.c(800): gst_v4l2src_decide_allocation (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
Buffer pool activation failed
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
Additional debug info:
../libs/gst/base/gstbasesrc.c(3127): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)
Execution ended after 0:00:00.011081484
Setting pipeline to NULL ...
Freeing pipeline ...

Using v4l2-ctl tool for image capture testing

Capture 1 frame of NV12 data output to /tmp/nv12.bin, resolution 1920x1080. Before saving the data, discard the first 3 frames (i.e., the first 3 frames are returned to userspace but not saved to the file).

shell
v4l2-ctl -d /dev/video22  --set-fmt-video=width=1920,height=1080,pixelformat=NV12  --stream-mmap=3  --stream-skip=3  --stream-to=/tmp/nv12.bin  --stream-count=1  --stream-poll
  • -d, specifies the operation object as the /dev/video0 device.

  • –set-selection, specifies cropping of the input image. Especially when the size of the previous stage of RKISP1 changes, ensure that the selection does not exceed the output size of the previous stage. RKCIF’s cropping is set through the –set-crop parameter.

  • –set-fmt-video, specifies the width, height, and pxielformat (represented by FourCC). NV12 is the pixelformat represented by FourCC.

  • –stream-mmap, specifies the type of buffer as mmap, i.e., physically continuous or iommu-mapped buffer allocated by the kernel.

  • –stream-skip, specifies discarding (not saving to file) the first 3 frames.

  • –stream-to, specifies the file path where frame data is saved.

  • –stream-count, specifies the number of frames to capture, not including the number discarded by –stream-skip.

  • –stream-poll, this option indicates that v4l2-ctl uses asynchronous IO, i.e., it waits for frame data to complete with select before dqbuf, thus ensuring dqbuf does not block. Otherwise, dqbuf will block until data frames arrive.

Normal return result for image capture:

<<<<

Abnormal return result for image capture:

could not open /camera.out for writing
		VIDIOC_STREAMON returned -1 (Operation not permitted)
  • Check if the FPC cable is connected in reverse.

  • Check if the FPC cable is loose.

  • Check if the camera is properly connected.

  • Replace the FPC cable or camera.