Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to develop RK3399 camera driver

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

How to carry out RK3399 camera-driven development, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

Android camera-driven development

Overview

At present, there are two mipi rx channels on the board, which can be connected to dual cameras.

DTS configuration

1 、 Enabled isp

& isp0 {

Status = "okay"

}

& isp1 {

Status = "okay"

}

& isp0_mmu {

Status = "okay"

}

& isp1_mmu {

Status = "okay"

}

2. I2C corresponding to Enabled mipi

& i2c1 {

Status = "okay"

}

Camera driver (default is OV9750)

1. Android driver code path

Hardware/rockchip/camera/SiliconImage/isi/drv/OV9750_A

2. The libisp_isi_drv_OV9750_A.so generated by compilation is placed in / vendor/lib/hw

3 、 cp hardware/rockchip/camera/SiliconImage/isi/drv/OV9750_A/calib/ OV9750_A.xml / vendor/etc/

4 、 cp hardware/rockchip/camera/Config/cam_board_rk3399.xml / vendor/etc/cam_board.xml

Xml configuration

1. Power on camera according to the circuit diagram, and configure rst,pdn. Configure voltage according to mipi0 and related gpio,I2C channel (1), mipi phy channel (0), IO voltage 1.8v, CORE voltage 1.8v, analog voltage: 3.2v, see circuit diagram and OV9750 datasheet for details.

Linux camera-driven development

Overview

The RK3399Pro toybrick development board has two MIPI and one DVP camera interface respectively. MIPI supports up to 4K shooting and video recording above 1080p 30fps. In addition, the development board also supports USB cameras.

This article takes the OV9750 camera as an example to explain the configuration process on the development board.

Configuration principle

As can be seen from the following circuit diagram, the two MIPI cameras are connected to different ISP and I2C channels.

MIPI0: use ISP0 and I2C1, and configure MIPI_MCLK0, MIPI_PDN, MIPI_RST

MIPI1: use ISP1 and I2C2, and configure MIPI_MCLK_T2, JMIPI_PDN2, JMIPI_RST2

DTS configuration

Configure the isp nod

Cif_isp0: cif_isp@ff910000 {

Compatible = "rockchip,rk3399-cif-isp"

Rockchip,grf =

Reg =,

Reg-names = "register", "dsihost-register"

Clocks =

,

,

,

,

Clock-names =

"aclk_isp0_noc", "aclk_isp0_wrapper"

"hclk_isp0_noc", "hclk_isp0_wrapper"

"clk_isp0", "pclk_dphyrx"

"clk_cif_out", "clk_cif_pll"

"pclk_dphy_ref"

Interrupts =

Interrupt-names = "cif_isp10_irq"

Power-domains =

Rockchip,isp,iommu-enable =

Iommus =

Status = "disabled"

}

& isp0 {

Status = "okay"

}

& isp0_mmu {

Status = "okay"

}

& cif_isp0 {

Rockchip,camera-modules-attached =

Status = "okay"

}

Set up CPU MCLK pin function

& pinctrl {

/ * /

Cam_mclk {

Cam_default_pins: cam-default-pins {

Rockchip,pins =

}

}

}

Configure the camera node on i2C, and mipi0 camera connects to the i2c1

& i2c1 {

Status = "okay"; / * enable i2c1 * /

/ *

* it is generally written as cameraX:camera-module@ID, where X is the serial number and ID is the 7bit I2C address of camera

* camera0 represents the name of the node. When you bind an isp node, camera0 attach it to isp0

, /

Camera0: camera-module@10 {

Status = "okay"

Compatible = "omnivision,ov9750-v4l2-i2c-subdev"

Reg =; / * 7bit I2C address * /

Device_type = "v4l2-i2c-subdev"; / * No modification is required * /

Clocks =; / * No modification is required, clock source is selected * /

Clock-names = "clk_cif_out"; / * No modification is required, clock source name * /

Pinctrl-names = "default"; / * configure MCLK pins through pinctrl without modification * /

Pinctrl-0 =; / * No modification is required, which is consistent with the pinctrl definition above * /

Rockchip,pd-gpio =; / * PD pin distribution and effective level * /

Rockchip,rst-gpio =; / * RST pin distribution and effective level * /

Rockchip,camera-module-mclk-name = "clk_cif_out"; / * No modification is required * /

Rockchip,camera-module-facing = "back"; / / pre-and post-configuration

Rockchip,camera-module-name = "MDG001"; / / Camera module name

Rockchip,camera-module-len-name = "NONE"; / / Camera module lens

Rockchip,camera-module-fov-h = "80"; / / Module horizontal visual angle configuration

Rockchip,camera-module-fov-v = "65"; / / Vertical visual angle configuration of the module

Rockchip,camera-module-orientation =; / / Module Angle setting

Rockchip,camera-module-iq-flip =; / / IQ flips up and down

Rockchip,camera-module-iq-mirror =; / / IQ left or right mirror

/ / the above two attributes control the mirror configuration of the camera's effect parameters, which are generally set to 0, but the following phenomena are found: when shooting a white wall, the color bias of the upper half of the image is not consistent with that of the lower half, or the left and right half of the image is inconsistent. That is, you can set these two attributes to 1.

Rockchip,camera-module-flip =

Rockchip,camera-module-mirror =

/ / the above two attributes control the mirror configuration in the camera driver. If the image is rotated 180 degrees, you can change these two attributes to opposite values to rotate 180.

Rockchip,camera-module-defrect0 =; / / set according to camera resolution

Rockchip,camera-module-flash-support = / / Flash support

Rockchip,camera-module-mipi-dphy-index =; / / Mipi port configuration, based on physical connection definition

As-master =

}

}

Driver description

The code directory related to the camera is as follows:

Drivers/media/i2c/soc_camera/rockchip

|-- ov9750_v4l2-i2c-subdev.c / / OV9750 driver

|-- ov_camera_module.c / / OV series common functions

|-- ov_camera_module.h / /

|-- rk_camera_mclk.c / / RK Camera MCLK clock signal management

|-- rk_camera_mclk.h

|-- rk_camera_module.c / / RK series common functions

`--rk_camera_module_version.h / / module version information

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report