Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In this guide, we will step-by-step guide you to use video camera OV5647 on SP7350 platforms.

Table of Contents

Table of Contents

1 OV5647

...

Specification

  • 5MP Max photograph resolution (2592 x 1944 = 5,038,848 pixels)

  • Pixel Size: 1.4 x 1.4 μm

  • Optical size: 1/4"

  • Lens: f=3.6 mm, f/2.9

  • Viewing Angle: 54° x 41°

  • Max video resolution: 1080p@30fps

  • Max frame rate: 480p@90fps

  • Maximum exposure times (seconds): 0.97

  • Selectable video resolutions: 1080p@30fps, 720p@60fps, 480p@90fps

2 Setup

2.1 Enable OV5647 in

...

Linux Kernel Configuration

1 Enter the kernel configuration by running the following command in the top directory of project.

Code Block
languagebash
make kconfig

2 Selects submenussub-menus: Device Drivers>Multimedia support>Media ancillary drivers>Camera sensor devices

...

3 Select OmniVision “OmniVision OV5647 sensor support support” and pressing press <Y> inlucdes. Then save and exit.

2.2 Modify

...

Device-tree

...

Source

Device-tree source files of SP7350 are located in linux/kernel/arch/arm64/boot/dts/sunplus/.

...

Modify device tree source file to define OV5647 source for driver

2.2.1 Using SP7350 MIPI

...

/CSI-RX4

Open OV5647_INT macro to add OV5647 node and link mipicsirx4.

2.2.2 Using SP7350

...

Other MIPI

...

/CSI-RX

Define OV5647 node in i2c node:

...

Code Block
mipicsirx: csirx@f8005480 {
  port@0 {
	reg = <0>;

	/* MIPI CSI-2 bus endpoint */
	csi1_ep1: endpoint {
		remote-endpoint = <&ov5647_out>;
		bus-type = <4>;
		clock-lanes = <0>;
		data-lanes = <1 2>;
	};
  };

2.3 Compile and

...

Burn

https://sunplus.atlassian.net/wiki/spaces/C3/pages/1988034774/A+guide+to+downloading+and+compiling+SP7350+code#7.-Build-code

2.4 Connect

...

Sensor Module

Using C3V-W board MIPI-/CSI-RX4, as follows:

...

2.5 Check

After the burning is completed, start the board. The system should print the following information through the serial port.

...

Code Block
root@dbv3:~# ls /dev/video0
/dev/video0

3 Test

3.1

...

v4l2-ctl

...

Command

This command is used to control V4L2 devices from the command line. It allows you to query device capabilities, set device parameters, and capture video and still image.

...

Code Block
root@dbv3:~# v4l2-ctl --all --device /dev/video0
Driver Info:
	Driver name      : sp_vin
	Card type        : SP_VIN
	Bus info         : platform:f8005980.video
	Driver version   : 5.10.201
	Capabilities     : 0xa5200001
		Video Capture
		Read/Write
		Streaming
		Extended Pix Format
		Device Capabilities
	Device Caps      : 0x25200001
		Video Capture
		Read/Write
		Streaming
		Extended Pix Format
Media Driver Info:
	Driver name      : sp_vin
	Model            : sunplus,sp7350-vin
	Serial           : 
	Bus info         : platform:f8005980.video
	Media version    : 5.10.201
	Hardware revision: 0x00000000 (0)
	Driver version   : 5.10.201
Entity Info:
	ID               : 15
	Name             : VIN8 output
	Type             : V4L2 I/O
	Pad              : 0: Sink
Priority: 2
Video input : 0 (VIN8 output: ok)
Format Video Capture:
	Width/Height      : 640/480
	Pixel Format      : 'GBRG' (8-bit Bayer GBGB/RGRG)
	Field             : None
	Bytes per Line    : 640
	Size Image        : 307200
	Colorspace        : Raw
	Transfer Function : Default (maps to None)
	YCbCr/HSV Encoding: Default (maps to ITU-R 601)
	Quantization      : Default (maps to Full Range)
	Flags             : 

User Controls

        white_balance_automatic 0x0098090c (bool)   : default=0 value=0
                       exposure 0x00980911 (int)    : min=4 max=980 step=1 default=980 value=980
                 gain_automatic 0x00980912 (bool)   : default=0 value=0
                horizontal_flip 0x00980914 (bool)   : default=0 value=0 flags=modify-layout
                  vertical_flip 0x00980915 (bool)   : default=0 value=0 flags=modify-layout
                alpha_component 0x00980929 (int)    : min=0 max=255 step=1 default=255 value=255

Camera Controls

                  auto_exposure 0x009a0901 (menu)   : min=0 max=1 default=1 value=1

Image Source Controls

              vertical_blanking 0x009e0901 (int)    : min=24 max=32287 step=1 default=504 value=504
            horizontal_blanking 0x009e0902 (int)    : min=1256 max=1256 step=1 default=1256 value=1256 flags=read-only
                  analogue_gain 0x009e0903 (int)    : min=16 max=1023 step=1 default=32 value=32

Image Processing Controls

                     pixel_rate 0x009f0902 (int64)  : min=77291670 max=77291670 step=1 default=77291670 value=77291670 flags=read-only

3.2 Capture

...

Image

3.2.1 Config

...

Video Device

Use v4l2-ctl -d /dev/video0 --set-ctrl params=value setting device controls.

...

Code Block
v4l2-ctl -d /dev/video0 --set-ctrl white_balance_automatic=1

3.2.2 Capture

Use v4l2-ctl --list-formats-ext --device /dev/video0 querying device video format.

...

After executing the capture command, the stream data is written to /home/root/ov5647.raw.

3.3 Display

...

Image Raw Data

3.3.1 Download and

...

Install Raw Image Viewer

Download raw image viewer from PixelViewer | Carina Studio. And PixelViewer is an open source project based cross-platform image which viewer supports reading raw Luminance/YUV/RGB/ARGB/Bayer pixels data from file and rendering it.

3.3.2 Use

...

PixelViewer to Open Image

...

Config render params by 3.2.2 v4l2-ctl capture command

...