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 IMX708 on SP7350 platforms.

Table of Contents

Table of Contents

1 IMX708 Specification

  • Back-illuminated and stacked CMOS 12-megapixel image sensor

  • Pixel Size: 1.4 x 1.4 μm

  • HorizoHorizontal/vertical: 4608 × 2592 pixels

  • Sensor size: 7.4mm sensor diagonal

  • Optical size: 1/2.43"

  • Maximum exposure times (seconds): 112

  • HDR mode (up to 3 megapixel output)

  • video modes: 2304 × 1296p56, 2304 × 1296p30 HDR, 1536 × 864p120

2 Setup

2.1 Enable IMX708 in Linux Kernel Configuration

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

...

3 Select “Sony IMX708 sensor support” and press <Y>. 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 IMX708 source for driver

2.2.1 Using SP7350 MIPI/CSI-RX4

Open IMX708_IN4 macro to add IMX708 node and link mipicsirx4.

2.2.2 Using SP7350 Other MIPI/CSI-RX

Define IMX708 node in i2c node:

...

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

	/* MIPI CSI-2 bus endpoint */
	csi_ep: endpoint {
		remote-endpoint = <&imx708_ep>;
		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               : 16
	Name             : VIN8 output
	Type             : V4L2 I/O
	Pad              : 0: Sink
Priority: 2
Video input : 0 (VIN8 output: ok)
Format Video Capture:
	Width/Height      : 1536/864
	Pixel Format      : 'RG10' (10-bit Bayer RGRG/GBGB)
	Field             : None
	Bytes per Line    : 3072
	Size Image        : 2654208
	Colorspace        : Raw
	Transfer Function : None
	YCbCr/HSV Encoding: ITU-R 601
	Quantization      : Full Range
	Flags             : 

User Controls

                       exposure 0x00980911 (int)    : min=1 max=2602 step=1 default=1600 value=1600
                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

             wide_dynamic_range 0x009a0915 (bool)   : default=0 value=0 flags=modify-layout

Image Source Controls

              vertical_blanking 0x009e0901 (int)    : min=40 max=8387616 step=1 default=2755 value=58
            horizontal_blanking 0x009e0902 (int)    : min=3680 max=3680 step=1 default=3680 value=3680 flags=read-only
                  analogue_gain 0x009e0903 (int)    : min=112 max=960 step=1 default=112 value=112
                red_pixel_value 0x009e0904 (int)    : min=0 max=4095 step=1 default=4095 value=4095
          green_red_pixel_value 0x009e0905 (int)    : min=0 max=4095 step=1 default=4095 value=4095
               blue_pixel_value 0x009e0906 (int)    : min=0 max=4095 step=1 default=4095 value=4095
         green_blue_pixel_value 0x009e0907 (int)    : min=0 max=4095 step=1 default=4095 value=4095
                   notify_gains 0x009e0909 (u32)    : min=1 max=65535 step=1 default=256 [4] flags=has-payload

Image Processing Controls

                 link_frequency 0x009f0901 (intmenu): min=0 max=0 default=0 value=0 flags=read-only
                     pixel_rate 0x009f0902 (int64)  : min=566400000 max=566400000 step=1 default=566400000 value=566400000 flags=read-only
                   test_pattern 0x009f0903 (menu)   : min=0 max=4 default=0 value=0
                   digital_gain 0x009f0905 (int)    : min=256 max=65535 step=1 default=256 value=256

3.2 Capture Image

3.2.1 Config Video Device

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

...

Change image brightness by changing the exposure, analogue_gain and digital_gain.

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/imx708.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

...

3.3 HDR

Enable HDR

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

...