Using Video Camera IMX415

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

1 IMX415 Specification

The IMX415-AAQR-C is a diagonal 6.4 mm (Type 1/2.8) CMOS active pixel type solid-state image sensor with a square pixel array and 8.46 M effective pixels. This chip operates with analog 2.9 V, digital 1.1 V, and interface 1.8 V triple power supply, and has low power consumption. High sensitivity, low dark current and no smear are achieved through the adoption of R, G and B primary color mosaic filters. This chip features an electronic shutter with variable charge-integration time.

(Applications: Surveillance cameras, FA cameras, Industrial cameras)

Features:

  • CMOS active pixel type dots

  • Built-in timing adjustment circuit, H/V driver and serial communication circuit

  • Input frequency: 24 MHz/27 MHz /37.125 MHz/72 MHz/74.25 MHz

  • Number of recommended recording pixels: 3840 (H) x 2160 (V) approx. 8.29M pixel

  • Readout mode

    • All-pixel scan mode

    • Horizontal / Vertical 2/2-line binning mode

    • Window cropping mode

    • Horizontal /Vertical direction-Normal/Inverted readout modeOLe

  • Readout rate

    • Maximum frame rate in All-pixel scan mode: 12 bit: 60.3 frame/s, 10 bit: 90.9 frame/s

  • High dynamic range (HDR) function

    • Digital overlap HDR

    • Multiple exposure HDR

  • Synchronizing sensors function

  • Variable-speed shutter function (resolution 1H units)

  • CDS/PGA function30.3 dB to 72 dB:Analog Gain 30 dB+ Digital Gain 0.3 dB to 42 dB (step pitch 0.3 dB)0 dB to 30 dB: Analog Gain 30 dB (step pitch 0.3 dB)

  • Supports I/O CSI-2 serial data output (2 Lane/4 Lane), RAW10/RAW12 output

  • Recommended exit pupil distance: -30 mm to-∞

2 Setup

2.1 Enable IMX415 in Linux Kernel Configuration

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

make kconfig

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

image-20240725-063926.png

3 Select “Sony IMX415 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/.

Here lists all files for SP7350 boards:

oards

Device-tree source files

C3V-W EVB

sp7350-ev.dts

Modify device tree source file to define IMX415 source for driver

2.2.1 Using SP7350 MIPI/CSI-RX5

Open IMX415_IN5 macro to add IMX415 node and link mipicsirx5.

PS: MIPI/CSI-RX2 is currently not supported.

2.3 Compile and Burn

Downloading and Compiling Code | 7. Build code

2.4 Connect Sensor Module

Using C3V-W board MIPI-CSI-RX5, as follows:

imx415 conect.jpg

2.5 Check

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

[ 2.166197] i2c /dev entries driver [ 2.254105] imx415 3-001a: Detected IMX415 image sensor [ 2.262331] sp-csi2 f8005500.csirx: 4 lanes found [ 2.267198] sp-vin f8005a80.video: assigned reserved memory node mipicsirx@4f400000 [ 2.274561] imx415 3-001a: Consider updating driver imx415 to match on endpoints [ 2.282168] sp-vin f8005a80.video: Device VIN10 registered as video0 [ 2.288277] sp-vin f8005a80.video: SP VIN driver probed

After the system startup is completed, the video device can be viewed.

# 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.

Use v4l2-ctl --all --device /dev/video0 command getting device all information.

3.2 Capture Image

3.2.1 Config Video Device

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

Exposure:

set exposure(exposure 0x00980911 (int): min=4 max=2242 step=1 default=2242 value=2242):

At a frame rate of 60FPS, the exposure time(s) is approximately equal to 1/60/2250 * exposure_value

analogue gain:

set analogue_gain(analogue_gain 0x009e0903 (int) : min=0 max=100 step=1 default=70 value=70)

analogue_gain min=0,max=100, step=1,each step corresponding to 0.3db gain(value=100 corresponding to 30db gain)

 

Change image brightness by changing the exposure, analogue_gain.

3.2.2 Capture

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

The frame rate of the following format is 60FPS:

Use v4l2-ctl --stream capture image.

  • --set-fmt-video=width=3864,height=2192,pixelformat=GB12 set image format

  • --stream-count <count> stream <count> buffers. The default is to keep streaming forever. This count does not include the number of initial skipped buffers as is passed by --stream-skip.

  • --stream-skip <count> skip the first <count> buffers. The default is 0.

  • --stream-to <file> stream to this file. The default is to discard the data. If <file> is '-', then the data is written to stdout and the --silent option is turned on automatically.

  • --stream-mmap <count> capture video using mmap() [VIDIOC_(D)QBUF] count: the number of buffers to allocate. The default is 3.

After executing the capture command, the stream data is written to /home/imx415_GB12_8M_001.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